mirror of
https://gitea.home.endeavr.de/Marcel/Tarstats-pp.git
synced 2025-12-10 00:39:01 +01:00
this added output of global stats to stdout
This commit is contained in:
18
tarfunc.cpp
18
tarfunc.cpp
@@ -10,6 +10,7 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "zlib.h"
|
||||
#include <vector>
|
||||
|
||||
// checks if a valid modern tar file - ustar
|
||||
bool tar::validTar(std::istream &file) {
|
||||
@@ -82,6 +83,19 @@ void tar::consolestats (std::map<std::string, uintmax_t> &typecount, uintmax_t t
|
||||
for (auto &i : typecount) {
|
||||
std::cout << i.first <<": " << i.second << '\n';
|
||||
}
|
||||
std::cout << '\n' << '\n';
|
||||
}
|
||||
|
||||
void tar::consoleglobalstats (std::map<std::string, uintmax_t> &typecount, uintmax_t filesize,
|
||||
uintmax_t itemsize, std::vector<std::string> &files) {
|
||||
std::cout << "GLOBAL STATS" << '\n';
|
||||
std::cout << "File amount: " << files.size() << '\n';
|
||||
std::cout << "Size of all archives: " << filesize << " Bytes" << '\n';
|
||||
std::cout << "Size of all items: " << itemsize << " Bytes" << '\n';
|
||||
for (auto &i : typecount) {
|
||||
std::cout << i.first <<": " << i.second << '\n';
|
||||
}
|
||||
std::cout << '\n' << '\n';
|
||||
}
|
||||
|
||||
// writes default console output to txt file
|
||||
@@ -123,7 +137,7 @@ bool tar::fileOpen(std::string &filename) {
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user