(v0.19-24-g0617ca1 with changes)
#include <sys/statvfs.h>
#include <sys/vfs.h>
#include <iostream>
#include <list>
#include "Options.h"
#include "throwcall.h"
Go to the source code of this file.
|
int | main (int argc, const char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Definition at line 126 of file statvfs.cpp.
128 std::list<fieldHandlerBase*> handlers;
137 handlers.emplace_back(
new idHandler(
'i',
"fsid",
"filesystem id"));
143 parser.fParse(argc, argv);
145 bool printAll = !(type || Type);
146 for (
auto& handler : handlers) {
152 for (
const auto& filesystem : fileSystems) {
155 throwcall::good0(statvfs(filesystem.c_str(), &stat),
"can't statvfs ", filesystem);
156 for (
auto& handler : handlers) {
157 handler->print(filesystem, stat, printAll);
160 if (type || Type || printAll) {
162 throwcall::good0(statfs(filesystem.c_str(), &stat),
"can't statfs ", filesystem);
164 std::cout << filesystem <<
" " <<
"type" <<
": ";
166 if (type || printAll) {
167 std::cout << stat.f_type;
168 if (Type || printAll) {
172 if (Type || printAll) {
173 auto item =
magicMap.find(stat.f_type);
175 std::cout <<
"unknown";
177 std::cout << item->second;
References throwcall::good0(), magicMap, and quiet.
◆ magicMap
std::map<__fsword_t, std::string> magicMap |
|
static |
◆ quiet
options::single<bool> quiet( 'q', "quiet", "be quiet: no prefix to values") |
|
static |