aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stat.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
commit5e34ff29bcc870936ab18172f438a34d042d4e03 (patch)
treea5e7a528f2f916eb883f1161eadceacdf2dca4be /coreutils/stat.c
parent8b814b4a349e2262c0ad25793b05206a14651ebb (diff)
downloadbusybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.bz2
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.zip
*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
Diffstat (limited to 'coreutils/stat.c')
-rw-r--r--coreutils/stat.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 32e8b42f3..44a03e5e7 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -156,7 +156,7 @@ static void printfs(char *pformat, const char *msg)
156/* print statfs info */ 156/* print statfs info */
157static void print_statfs(char *pformat, const char m, 157static void print_statfs(char *pformat, const char m,
158 const char *const filename, const void *data 158 const char *const filename, const void *data
159 USE_SELINUX(, security_context_t scontext)) 159 IF_SELINUX(, security_context_t scontext))
160{ 160{
161 const struct statfs *statfsbuf = data; 161 const struct statfs *statfsbuf = data;
162 if (m == 'n') { 162 if (m == 'n') {
@@ -203,7 +203,7 @@ static void print_statfs(char *pformat, const char m,
203/* print stat info */ 203/* print stat info */
204static void print_stat(char *pformat, const char m, 204static void print_stat(char *pformat, const char m,
205 const char *const filename, const void *data 205 const char *const filename, const void *data
206 USE_SELINUX(, security_context_t scontext)) 206 IF_SELINUX(, security_context_t scontext))
207{ 207{
208#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) 208#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
209 struct stat *statbuf = (struct stat *) data; 209 struct stat *statbuf = (struct stat *) data;
@@ -306,9 +306,9 @@ static void print_stat(char *pformat, const char m,
306} 306}
307 307
308static void print_it(const char *masterformat, const char *filename, 308static 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)), 309 void (*print_func) (char*, char, const char*, const void* IF_SELINUX(, security_context_t scontext)),
310 const void *data 310 const void *data
311 USE_SELINUX(, security_context_t scontext) ) 311 IF_SELINUX(, security_context_t scontext) )
312{ 312{
313 /* Create a working copy of the format string */ 313 /* Create a working copy of the format string */
314 char *format = xstrdup(masterformat); 314 char *format = xstrdup(masterformat);
@@ -347,7 +347,7 @@ static void print_it(const char *masterformat, const char *filename,
347 break; 347 break;
348 default: 348 default:
349 /* Completes "%<modifiers>" with specifier and printfs */ 349 /* Completes "%<modifiers>" with specifier and printfs */
350 print_func(dest, *p, filename, data USE_SELINUX(,scontext)); 350 print_func(dest, *p, filename, data IF_SELINUX(,scontext));
351 break; 351 break;
352 } 352 }
353 } 353 }
@@ -416,7 +416,7 @@ static bool do_statfs(const char *filename, const char *format)
416 ); 416 );
417#endif /* SELINUX */ 417#endif /* SELINUX */
418 } 418 }
419 print_it(format, filename, print_statfs, &statfsbuf USE_SELINUX(, scontext)); 419 print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext));
420#else /* FEATURE_STAT_FORMAT */ 420#else /* FEATURE_STAT_FORMAT */
421 format = (option_mask32 & OPT_TERSE 421 format = (option_mask32 & OPT_TERSE
422 ? "%s %llx %lu " 422 ? "%s %llx %lu "
@@ -560,11 +560,11 @@ static bool do_stat(const char *filename, const char *format)
560 } 560 }
561#endif 561#endif
562 } 562 }
563 print_it(format, filename, print_stat, &statbuf USE_SELINUX(, scontext)); 563 print_it(format, filename, print_stat, &statbuf IF_SELINUX(, scontext));
564#else /* FEATURE_STAT_FORMAT */ 564#else /* FEATURE_STAT_FORMAT */
565 if (option_mask32 & OPT_TERSE) { 565 if (option_mask32 & OPT_TERSE) {
566 printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu" 566 printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu"
567 SKIP_SELINUX("\n"), 567 IF_NOT_SELINUX("\n"),
568 filename, 568 filename,
569 (uintmax_t) (statbuf.st_size), 569 (uintmax_t) (statbuf.st_size),
570 (uintmax_t) statbuf.st_blocks, 570 (uintmax_t) statbuf.st_blocks,
@@ -642,14 +642,14 @@ static bool do_stat(const char *filename, const char *format)
642int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 642int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
643int stat_main(int argc, char **argv) 643int stat_main(int argc, char **argv)
644{ 644{
645 USE_FEATURE_STAT_FORMAT(char *format = NULL;) 645 IF_FEATURE_STAT_FORMAT(char *format = NULL;)
646 int i; 646 int i;
647 int ok = 1; 647 int ok = 1;
648 statfunc_ptr statfunc = do_stat; 648 statfunc_ptr statfunc = do_stat;
649 649
650 getopt32(argv, "ftL" 650 getopt32(argv, "ftL"
651 USE_SELINUX("Z") 651 IF_SELINUX("Z")
652 USE_FEATURE_STAT_FORMAT("c:", &format) 652 IF_FEATURE_STAT_FORMAT("c:", &format)
653 ); 653 );
654 654
655 if (option_mask32 & OPT_FILESYS) /* -f */ 655 if (option_mask32 & OPT_FILESYS) /* -f */
@@ -663,7 +663,7 @@ int stat_main(int argc, char **argv)
663 } 663 }
664#endif /* ENABLE_SELINUX */ 664#endif /* ENABLE_SELINUX */
665 for (i = optind; i < argc; ++i) 665 for (i = optind; i < argc; ++i)
666 ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format)); 666 ok &= statfunc(argv[i] IF_FEATURE_STAT_FORMAT(, format));
667 667
668 return (ok ? EXIT_SUCCESS : EXIT_FAILURE); 668 return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
669} 669}