1 /* vi: set sw=4 ts=4: */
3 * stat -- display file or file system status
5 * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation.
6 * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org>
7 * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org>
8 * Copyright (C) 2006 by Yoshinori Sato <ysato@users.sourceforge.jp>
10 * Written by Michael Meskes
11 * Taken from coreutils and turned into a busybox applet by Mike Frysinger
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
18 /* vars to control behavior */
19 #define OPT_FILESYS (1 << 0)
20 #define OPT_TERSE (1 << 1)
21 #define OPT_DEREFERENCE (1 << 2)
22 #define OPT_SELINUX (1 << 3)
24 #if ENABLE_FEATURE_STAT_FORMAT
25 typedef bool (*statfunc_ptr
)(const char *, const char *);
27 typedef bool (*statfunc_ptr
)(const char *);
30 static const char *file_type(const struct stat
*st
)
32 /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
33 * for some of these formats.
34 * To keep diagnostics grammatical in English, the
35 * returned string must start with a consonant.
37 if (S_ISREG(st
->st_mode
)) return st
->st_size
== 0 ? "regular empty file" : "regular file";
38 if (S_ISDIR(st
->st_mode
)) return "directory";
39 if (S_ISBLK(st
->st_mode
)) return "block special file";
40 if (S_ISCHR(st
->st_mode
)) return "character special file";
41 if (S_ISFIFO(st
->st_mode
)) return "fifo";
42 if (S_ISLNK(st
->st_mode
)) return "symbolic link";
43 if (S_ISSOCK(st
->st_mode
)) return "socket";
44 if (S_TYPEISMQ(st
)) return "message queue";
45 if (S_TYPEISSEM(st
)) return "semaphore";
46 if (S_TYPEISSHM(st
)) return "shared memory object";
48 if (S_TYPEISTMO(st
)) return "typed memory object";
53 static const char *human_time(time_t t
)
58 str[strlen(str)-1] = '\0';
61 /* coreutils 6.3 compat: */
63 /*static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")] ALIGN1;*/
64 #define buf bb_common_bufsiz1
66 strftime(buf
, sizeof(buf
), "%Y-%m-%d %H:%M:%S.000000000", localtime(&t
));
71 /* Return the type of the specified file system.
72 * Some systems have statfvs.f_basetype[FSTYPSZ]. (AIX, HP-UX, and Solaris)
73 * Others have statfs.f_fstypename[MFSNAMELEN]. (NetBSD 1.5.2)
74 * Still others have neither and have to get by with f_type (Linux).
76 static const char *human_fstype(uint32_t f_type
)
78 static const struct types
{
86 { 0xEF53, "ext2/ext3" },
87 { 0x3153464a, "jfs" },
88 { 0x58465342, "xfs" },
89 { 0xF995E849, "hpfs" },
94 { 0x138F, "minix (30 char.)" },
95 { 0x2468, "minix v2" },
96 { 0x2478, "minix v2 (30 char.)" },
103 { 0x012FF7B4, "xenix" },
104 { 0x012FF7B5, "sysv4" },
105 { 0x012FF7B6, "sysv2" },
106 { 0x012FF7B7, "coh" },
107 { 0x00011954, "ufs" },
108 { 0x012FD16D, "xia" },
109 { 0x5346544e, "ntfs" },
110 { 0x1021994, "tmpfs" },
111 { 0x52654973, "reiserfs" },
112 { 0x28cd3d45, "cramfs" },
114 { 0x858458f6, "romfs" },
115 { 0x73717368, "squashfs" },
116 { 0x62656572, "sysfs" },
122 for (i
= 0; humantypes
[i
].type
; ++i
)
123 if (humantypes
[i
].type
== f_type
)
125 return humantypes
[i
].fs
;
128 /* "man statfs" says that statfsbuf->f_fsid is a mess */
129 /* coreutils treats it as an array of ints, most significant first */
130 static unsigned long long get_f_fsid(const struct statfs
*statfsbuf
)
132 const unsigned *p
= (const void*) &statfsbuf
->f_fsid
;
133 unsigned sz
= sizeof(statfsbuf
->f_fsid
) / sizeof(unsigned);
134 unsigned long long r
= 0;
137 r
= (r
<< (sizeof(unsigned)*8)) | *p
++;
142 #if ENABLE_FEATURE_STAT_FORMAT
143 static void strcatc(char *str
, char c
)
145 int len
= strlen(str
);
150 static void printfs(char *pformat
, const char *msg
)
152 strcatc(pformat
, 's');
153 printf(pformat
, msg
);
156 /* print statfs info */
157 static void print_statfs(char *pformat
, const char m
,
158 const char *const filename
, const void *data
159 USE_SELINUX(, security_context_t scontext
))
161 const struct statfs
*statfsbuf
= data
;
163 printfs(pformat
, filename
);
164 } else if (m
== 'i') {
165 strcat(pformat
, "llx");
166 printf(pformat
, get_f_fsid(statfsbuf
));
167 } else if (m
== 'l') {
168 strcat(pformat
, "lu");
169 printf(pformat
, (unsigned long) (statfsbuf
->f_namelen
));
170 } else if (m
== 't') {
171 strcat(pformat
, "lx");
172 printf(pformat
, (unsigned long) (statfsbuf
->f_type
)); /* no equiv */
173 } else if (m
== 'T') {
174 printfs(pformat
, human_fstype(statfsbuf
->f_type
));
175 } else if (m
== 'b') {
176 strcat(pformat
, "jd");
177 printf(pformat
, (intmax_t) (statfsbuf
->f_blocks
));
178 } else if (m
== 'f') {
179 strcat(pformat
, "jd");
180 printf(pformat
, (intmax_t) (statfsbuf
->f_bfree
));
181 } else if (m
== 'a') {
182 strcat(pformat
, "jd");
183 printf(pformat
, (intmax_t) (statfsbuf
->f_bavail
));
184 } else if (m
== 's' || m
== 'S') {
185 strcat(pformat
, "lu");
186 printf(pformat
, (unsigned long) (statfsbuf
->f_bsize
));
187 } else if (m
== 'c') {
188 strcat(pformat
, "jd");
189 printf(pformat
, (intmax_t) (statfsbuf
->f_files
));
190 } else if (m
== 'd') {
191 strcat(pformat
, "jd");
192 printf(pformat
, (intmax_t) (statfsbuf
->f_ffree
));
194 } else if (m
== 'C' && (option_mask32
& OPT_SELINUX
)) {
195 printfs(pformat
, scontext
);
198 strcatc(pformat
, 'c');
203 /* print stat info */
204 static void print_stat(char *pformat
, const char m
,
205 const char *const filename
, const void *data
206 USE_SELINUX(, security_context_t scontext
))
208 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
209 struct stat
*statbuf
= (struct stat
*) data
;
210 struct passwd
*pw_ent
;
211 struct group
*gw_ent
;
214 printfs(pformat
, filename
);
215 } else if (m
== 'N') {
216 strcatc(pformat
, 's');
217 if (S_ISLNK(statbuf
->st_mode
)) {
218 char *linkname
= xmalloc_readlink_or_warn(filename
);
219 if (linkname
== NULL
)
221 /*printf("\"%s\" -> \"%s\"", filename, linkname); */
222 printf(pformat
, filename
);
224 printf(pformat
, linkname
);
227 printf(pformat
, filename
);
229 } else if (m
== 'd') {
230 strcat(pformat
, "ju");
231 printf(pformat
, (uintmax_t) statbuf
->st_dev
);
232 } else if (m
== 'D') {
233 strcat(pformat
, "jx");
234 printf(pformat
, (uintmax_t) statbuf
->st_dev
);
235 } else if (m
== 'i') {
236 strcat(pformat
, "ju");
237 printf(pformat
, (uintmax_t) statbuf
->st_ino
);
238 } else if (m
== 'a') {
239 strcat(pformat
, "lo");
240 printf(pformat
, (unsigned long) (statbuf
->st_mode
& (S_ISUID
|S_ISGID
|S_ISVTX
|S_IRWXU
|S_IRWXG
|S_IRWXO
)));
241 } else if (m
== 'A') {
242 printfs(pformat
, bb_mode_string(statbuf
->st_mode
));
243 } else if (m
== 'f') {
244 strcat(pformat
, "lx");
245 printf(pformat
, (unsigned long) statbuf
->st_mode
);
246 } else if (m
== 'F') {
247 printfs(pformat
, file_type(statbuf
));
248 } else if (m
== 'h') {
249 strcat(pformat
, "lu");
250 printf(pformat
, (unsigned long) statbuf
->st_nlink
);
251 } else if (m
== 'u') {
252 strcat(pformat
, "lu");
253 printf(pformat
, (unsigned long) statbuf
->st_uid
);
254 } else if (m
== 'U') {
256 pw_ent
= getpwuid(statbuf
->st_uid
);
257 printfs(pformat
, (pw_ent
!= NULL
) ? pw_ent
->pw_name
: "UNKNOWN");
258 } else if (m
== 'g') {
259 strcat(pformat
, "lu");
260 printf(pformat
, (unsigned long) statbuf
->st_gid
);
261 } else if (m
== 'G') {
263 gw_ent
= getgrgid(statbuf
->st_gid
);
264 printfs(pformat
, (gw_ent
!= NULL
) ? gw_ent
->gr_name
: "UNKNOWN");
265 } else if (m
== 't') {
266 strcat(pformat
, "lx");
267 printf(pformat
, (unsigned long) major(statbuf
->st_rdev
));
268 } else if (m
== 'T') {
269 strcat(pformat
, "lx");
270 printf(pformat
, (unsigned long) minor(statbuf
->st_rdev
));
271 } else if (m
== 's') {
272 strcat(pformat
, "ju");
273 printf(pformat
, (uintmax_t) (statbuf
->st_size
));
274 } else if (m
== 'B') {
275 strcat(pformat
, "lu");
276 printf(pformat
, (unsigned long) 512); //ST_NBLOCKSIZE
277 } else if (m
== 'b') {
278 strcat(pformat
, "ju");
279 printf(pformat
, (uintmax_t) statbuf
->st_blocks
);
280 } else if (m
== 'o') {
281 strcat(pformat
, "lu");
282 printf(pformat
, (unsigned long) statbuf
->st_blksize
);
283 } else if (m
== 'x') {
284 printfs(pformat
, human_time(statbuf
->st_atime
));
285 } else if (m
== 'X') {
286 strcat(pformat
, TYPE_SIGNED(time_t) ? "ld" : "lu");
287 printf(pformat
, (unsigned long) statbuf
->st_atime
);
288 } else if (m
== 'y') {
289 printfs(pformat
, human_time(statbuf
->st_mtime
));
290 } else if (m
== 'Y') {
291 strcat(pformat
, TYPE_SIGNED(time_t) ? "ld" : "lu");
292 printf(pformat
, (unsigned long) statbuf
->st_mtime
);
293 } else if (m
== 'z') {
294 printfs(pformat
, human_time(statbuf
->st_ctime
));
295 } else if (m
== 'Z') {
296 strcat(pformat
, TYPE_SIGNED(time_t) ? "ld" : "lu");
297 printf(pformat
, (unsigned long) statbuf
->st_ctime
);
299 } else if (m
== 'C' && (option_mask32
& OPT_SELINUX
)) {
300 printfs(pformat
, scontext
);
303 strcatc(pformat
, 'c');
308 static void print_it(const char *masterformat
, const char *filename
,
309 void (*print_func
) (char*, char, const char*, const void* USE_SELINUX(, security_context_t scontext
)),
311 USE_SELINUX(, security_context_t scontext
) )
313 /* Create a working copy of the format string */
314 char *format
= xstrdup(masterformat
);
315 /* Add 2 to accomodate our conversion of the stat '%s' format string
316 * to the printf '%llu' one. */
317 char *dest
= xmalloc(strlen(format
) + 2 + 1);
323 char *p
= strchr(b
, '%');
325 /* coreutils 6.3 always prints <cr> at the end */
326 /*fputs(b, stdout);*/
333 /* dest = "%<modifiers>" */
334 len
= strspn(p
, "#-+.I 0123456789");
336 memcpy(dest
+ 1, p
, len
);
337 dest
[1 + len
] = '\0';
349 /* Completes "%<modifiers>" with specifier and printfs */
350 print_func(dest
, *p
, filename
, data
USE_SELINUX(,scontext
));
360 /* Stat the file system and print what we find. */
361 #if !ENABLE_FEATURE_STAT_FORMAT
362 #define do_statfs(filename, format) do_statfs(filename)
364 static bool do_statfs(const char *filename
, const char *format
)
366 struct statfs statfsbuf
;
368 #if !ENABLE_FEATURE_STAT_FORMAT
372 security_context_t scontext
= NULL
;
374 if (option_mask32
& OPT_SELINUX
) {
375 if ((option_mask32
& OPT_DEREFERENCE
376 ? lgetfilecon(filename
, &scontext
)
377 : getfilecon(filename
, &scontext
)
380 bb_perror_msg(filename
);
385 if (statfs(filename
, &statfsbuf
) != 0) {
386 bb_perror_msg("cannot read file system information for '%s'", filename
);
390 #if ENABLE_FEATURE_STAT_FORMAT
391 if (format
== NULL
) {
393 format
= (option_mask32
& OPT_TERSE
394 ? "%n %i %l %t %s %b %f %a %c %d\n"
396 " ID: %-8i Namelen: %-7l Type: %T\n"
397 "Block size: %-10s\n"
398 "Blocks: Total: %-10b Free: %-10f Available: %a\n"
399 "Inodes: Total: %-10c Free: %d");
401 format
= (option_mask32
& OPT_TERSE
402 ? (option_mask32
& OPT_SELINUX
? "%n %i %l %t %s %b %f %a %c %d %C\n":
403 "%n %i %l %t %s %b %f %a %c %d\n")
404 : (option_mask32
& OPT_SELINUX
?
406 " ID: %-8i Namelen: %-7l Type: %T\n"
407 "Block size: %-10s\n"
408 "Blocks: Total: %-10b Free: %-10f Available: %a\n"
409 "Inodes: Total: %-10c Free: %d"
412 " ID: %-8i Namelen: %-7l Type: %T\n"
413 "Block size: %-10s\n"
414 "Blocks: Total: %-10b Free: %-10f Available: %a\n"
415 "Inodes: Total: %-10c Free: %d\n")
419 print_it(format
, filename
, print_statfs
, &statfsbuf
USE_SELINUX(, scontext
));
420 #else /* FEATURE_STAT_FORMAT */
421 format
= (option_mask32
& OPT_TERSE
424 " ID: %-8llx Namelen: %-7lu ");
427 get_f_fsid(&statfsbuf
),
428 statfsbuf
.f_namelen
);
430 if (option_mask32
& OPT_TERSE
)
431 printf("%lx ", (unsigned long) (statfsbuf
.f_type
));
433 printf("Type: %s\n", human_fstype(statfsbuf
.f_type
));
436 format
= (option_mask32
& OPT_TERSE
437 ? "%lu %ld %ld %ld %ld %ld\n"
438 : "Block size: %-10lu\n"
439 "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n"
440 "Inodes: Total: %-10jd Free: %jd\n");
442 (unsigned long) (statfsbuf
.f_bsize
),
443 (intmax_t) (statfsbuf
.f_blocks
),
444 (intmax_t) (statfsbuf
.f_bfree
),
445 (intmax_t) (statfsbuf
.f_bavail
),
446 (intmax_t) (statfsbuf
.f_files
),
447 (intmax_t) (statfsbuf
.f_ffree
));
449 format
= (option_mask32
& OPT_TERSE
450 ? (option_mask32
& OPT_SELINUX
? "%lu %ld %ld %ld %ld %ld %C\n":
451 "%lu %ld %ld %ld %ld %ld\n")
452 : (option_mask32
& OPT_SELINUX
?
453 "Block size: %-10lu\n"
454 "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n"
455 "Inodes: Total: %-10jd Free: %jd"
457 "Block size: %-10lu\n"
458 "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n"
459 "Inodes: Total: %-10jd Free: %jd\n"));
461 (unsigned long) (statfsbuf
.f_bsize
),
462 (intmax_t) (statfsbuf
.f_blocks
),
463 (intmax_t) (statfsbuf
.f_bfree
),
464 (intmax_t) (statfsbuf
.f_bavail
),
465 (intmax_t) (statfsbuf
.f_files
),
466 (intmax_t) (statfsbuf
.f_ffree
),
472 #endif /* FEATURE_STAT_FORMAT */
476 /* stat the file and print what we find */
477 #if !ENABLE_FEATURE_STAT_FORMAT
478 #define do_stat(filename, format) do_stat(filename)
480 static bool do_stat(const char *filename
, const char *format
)
484 security_context_t scontext
= NULL
;
486 if (option_mask32
& OPT_SELINUX
) {
487 if ((option_mask32
& OPT_DEREFERENCE
488 ? lgetfilecon(filename
, &scontext
)
489 : getfilecon(filename
, &scontext
)
492 bb_perror_msg(filename
);
497 if ((option_mask32
& OPT_DEREFERENCE
? stat
: lstat
) (filename
, &statbuf
) != 0) {
498 bb_perror_msg("cannot stat '%s'", filename
);
502 #if ENABLE_FEATURE_STAT_FORMAT
503 if (format
== NULL
) {
505 if (option_mask32
& OPT_TERSE
) {
506 format
= "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o";
508 if (S_ISBLK(statbuf
.st_mode
) || S_ISCHR(statbuf
.st_mode
)) {
511 " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
512 "Device: %Dh/%dd\tInode: %-10i Links: %-5h"
513 " Device type: %t,%T\n"
514 "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
515 "Access: %x\n" "Modify: %y\n" "Change: %z\n";
519 " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
520 "Device: %Dh/%dd\tInode: %-10i Links: %h\n"
521 "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
522 "Access: %x\n" "Modify: %y\n" "Change: %z\n";
526 if (option_mask32
& OPT_TERSE
) {
527 format
= (option_mask32
& OPT_SELINUX
?
528 "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n":
529 "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n");
531 if (S_ISBLK(statbuf
.st_mode
) || S_ISCHR(statbuf
.st_mode
)) {
532 format
= (option_mask32
& OPT_SELINUX
?
534 " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
535 "Device: %Dh/%dd\tInode: %-10i Links: %-5h"
536 " Device type: %t,%T\n"
537 "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
539 "Access: %x\n" "Modify: %y\n" "Change: %z\n":
541 " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
542 "Device: %Dh/%dd\tInode: %-10i Links: %-5h"
543 " Device type: %t,%T\n"
544 "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
545 "Access: %x\n" "Modify: %y\n" "Change: %z\n");
547 format
= (option_mask32
& OPT_SELINUX
?
549 " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
550 "Device: %Dh/%dd\tInode: %-10i Links: %h\n"
551 "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
553 "Access: %x\n" "Modify: %y\n" "Change: %z\n":
555 " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n"
556 "Device: %Dh/%dd\tInode: %-10i Links: %h\n"
557 "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n"
558 "Access: %x\n" "Modify: %y\n" "Change: %z\n");
563 print_it(format
, filename
, print_stat
, &statbuf
USE_SELINUX(, scontext
));
564 #else /* FEATURE_STAT_FORMAT */
565 if (option_mask32
& OPT_TERSE
) {
566 printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu"
569 (uintmax_t) (statbuf
.st_size
),
570 (uintmax_t) statbuf
.st_blocks
,
571 (unsigned long) statbuf
.st_mode
,
572 (unsigned long) statbuf
.st_uid
,
573 (unsigned long) statbuf
.st_gid
,
574 (uintmax_t) statbuf
.st_dev
,
575 (uintmax_t) statbuf
.st_ino
,
576 (unsigned long) statbuf
.st_nlink
,
577 (unsigned long) major(statbuf
.st_rdev
),
578 (unsigned long) minor(statbuf
.st_rdev
),
579 (unsigned long) statbuf
.st_atime
,
580 (unsigned long) statbuf
.st_mtime
,
581 (unsigned long) statbuf
.st_ctime
,
582 (unsigned long) statbuf
.st_blksize
585 if (option_mask32
& OPT_SELINUX
)
586 printf(" %lc\n", *scontext
);
591 char *linkname
= NULL
;
593 struct passwd
*pw_ent
;
594 struct group
*gw_ent
;
596 gw_ent
= getgrgid(statbuf
.st_gid
);
598 pw_ent
= getpwuid(statbuf
.st_uid
);
600 if (S_ISLNK(statbuf
.st_mode
))
601 linkname
= xmalloc_readlink_or_warn(filename
);
603 printf(" File: \"%s\" -> \"%s\"\n", filename
, linkname
);
605 printf(" File: \"%s\"\n", filename
);
607 printf(" Size: %-10ju\tBlocks: %-10ju IO Block: %-6lu %s\n"
608 "Device: %jxh/%jud\tInode: %-10ju Links: %-5lu",
609 (uintmax_t) (statbuf
.st_size
),
610 (uintmax_t) statbuf
.st_blocks
,
611 (unsigned long) statbuf
.st_blksize
,
613 (uintmax_t) statbuf
.st_dev
,
614 (uintmax_t) statbuf
.st_dev
,
615 (uintmax_t) statbuf
.st_ino
,
616 (unsigned long) statbuf
.st_nlink
);
617 if (S_ISBLK(statbuf
.st_mode
) || S_ISCHR(statbuf
.st_mode
))
618 printf(" Device type: %lx,%lx\n",
619 (unsigned long) major(statbuf
.st_rdev
),
620 (unsigned long) minor(statbuf
.st_rdev
));
623 printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n",
624 (unsigned long) (statbuf
.st_mode
& (S_ISUID
|S_ISGID
|S_ISVTX
|S_IRWXU
|S_IRWXG
|S_IRWXO
)),
625 bb_mode_string(statbuf
.st_mode
),
626 (unsigned long) statbuf
.st_uid
,
627 (pw_ent
!= NULL
) ? pw_ent
->pw_name
: "UNKNOWN",
628 (unsigned long) statbuf
.st_gid
,
629 (gw_ent
!= NULL
) ? gw_ent
->gr_name
: "UNKNOWN");
631 printf(" S_Context: %lc\n", *scontext
);
633 printf("Access: %s\n" "Modify: %s\n" "Change: %s\n",
634 human_time(statbuf
.st_atime
),
635 human_time(statbuf
.st_mtime
),
636 human_time(statbuf
.st_ctime
));
638 #endif /* FEATURE_STAT_FORMAT */
642 int stat_main(int argc
, char **argv
) MAIN_EXTERNALLY_VISIBLE
;
643 int stat_main(int argc
, char **argv
)
645 USE_FEATURE_STAT_FORMAT(char *format
= NULL
;)
648 statfunc_ptr statfunc
= do_stat
;
652 USE_FEATURE_STAT_FORMAT("c:", &format
)
655 if (option_mask32
& OPT_FILESYS
) /* -f */
656 statfunc
= do_statfs
;
657 if (argc
== optind
) /* files */
661 if (option_mask32
& OPT_SELINUX
) {
664 #endif /* ENABLE_SELINUX */
665 for (i
= optind
; i
< argc
; ++i
)
666 ok
&= statfunc(argv
[i
] USE_FEATURE_STAT_FORMAT(, format
));
668 return (ok
? EXIT_SUCCESS
: EXIT_FAILURE
);