diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-02 03:08:57 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-02 03:08:57 +0100 |
| commit | 5b9b1365a086056e992e7868db8e49989fedcbaf (patch) | |
| tree | afa6360504fab7057acb7477df353b178b250512 /coreutils | |
| parent | 4b061461d3f5cb62a6f384d80fd5a3f6be51bd25 (diff) | |
| download | busybox-w32-5b9b1365a086056e992e7868db8e49989fedcbaf.tar.gz busybox-w32-5b9b1365a086056e992e7868db8e49989fedcbaf.tar.bz2 busybox-w32-5b9b1365a086056e992e7868db8e49989fedcbaf.zip | |
stat: get rid on intmax_t
function old new delta
print_it 225 218 -7
print_stat 919 889 -30
print_statfs 370 339 -31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-68) Total: -68 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/stat.c | 181 |
1 files changed, 91 insertions, 90 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c index bbd2e6a7c..57f1f145a 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
| @@ -12,10 +12,8 @@ | |||
| 12 | * | 12 | * |
| 13 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 13 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
| 14 | */ | 14 | */ |
| 15 | |||
| 16 | #include "libbb.h" | 15 | #include "libbb.h" |
| 17 | 16 | ||
| 18 | /* vars to control behavior */ | ||
| 19 | #define OPT_FILESYS (1 << 0) | 17 | #define OPT_FILESYS (1 << 0) |
| 20 | #define OPT_TERSE (1 << 1) | 18 | #define OPT_TERSE (1 << 1) |
| 21 | #define OPT_DEREFERENCE (1 << 2) | 19 | #define OPT_DEREFERENCE (1 << 2) |
| @@ -154,7 +152,7 @@ static void printfs(char *pformat, const char *msg) | |||
| 154 | } | 152 | } |
| 155 | 153 | ||
| 156 | /* print statfs info */ | 154 | /* print statfs info */ |
| 157 | static void print_statfs(char *pformat, const char m, | 155 | static void FAST_FUNC print_statfs(char *pformat, const char m, |
| 158 | const char *const filename, const void *data | 156 | const char *const filename, const void *data |
| 159 | IF_SELINUX(, security_context_t scontext)) | 157 | IF_SELINUX(, security_context_t scontext)) |
| 160 | { | 158 | { |
| @@ -166,34 +164,34 @@ static void print_statfs(char *pformat, const char m, | |||
| 166 | printf(pformat, get_f_fsid(statfsbuf)); | 164 | printf(pformat, get_f_fsid(statfsbuf)); |
| 167 | } else if (m == 'l') { | 165 | } else if (m == 'l') { |
| 168 | strcat(pformat, "lu"); | 166 | strcat(pformat, "lu"); |
| 169 | printf(pformat, (unsigned long) (statfsbuf->f_namelen)); | 167 | printf(pformat, (unsigned long) statfsbuf->f_namelen); |
| 170 | } else if (m == 't') { | 168 | } else if (m == 't') { |
| 171 | strcat(pformat, "lx"); | 169 | strcat(pformat, "lx"); |
| 172 | printf(pformat, (unsigned long) (statfsbuf->f_type)); /* no equiv */ | 170 | printf(pformat, (unsigned long) statfsbuf->f_type); /* no equiv */ |
| 173 | } else if (m == 'T') { | 171 | } else if (m == 'T') { |
| 174 | printfs(pformat, human_fstype(statfsbuf->f_type)); | 172 | printfs(pformat, human_fstype(statfsbuf->f_type)); |
| 175 | } else if (m == 'b') { | 173 | } else if (m == 'b') { |
| 176 | strcat(pformat, "jd"); | 174 | strcat(pformat, "llu"); |
| 177 | printf(pformat, (intmax_t) (statfsbuf->f_blocks)); | 175 | printf(pformat, (unsigned long long) statfsbuf->f_blocks); |
| 178 | } else if (m == 'f') { | 176 | } else if (m == 'f') { |
| 179 | strcat(pformat, "jd"); | 177 | strcat(pformat, "llu"); |
| 180 | printf(pformat, (intmax_t) (statfsbuf->f_bfree)); | 178 | printf(pformat, (unsigned long long) statfsbuf->f_bfree); |
| 181 | } else if (m == 'a') { | 179 | } else if (m == 'a') { |
| 182 | strcat(pformat, "jd"); | 180 | strcat(pformat, "llu"); |
| 183 | printf(pformat, (intmax_t) (statfsbuf->f_bavail)); | 181 | printf(pformat, (unsigned long long) statfsbuf->f_bavail); |
| 184 | } else if (m == 's' || m == 'S') { | 182 | } else if (m == 's' || m == 'S') { |
| 185 | strcat(pformat, "lu"); | 183 | strcat(pformat, "lu"); |
| 186 | printf(pformat, (unsigned long) (statfsbuf->f_bsize)); | 184 | printf(pformat, (unsigned long) statfsbuf->f_bsize); |
| 187 | } else if (m == 'c') { | 185 | } else if (m == 'c') { |
| 188 | strcat(pformat, "jd"); | 186 | strcat(pformat, "llu"); |
| 189 | printf(pformat, (intmax_t) (statfsbuf->f_files)); | 187 | printf(pformat, (unsigned long long) statfsbuf->f_files); |
| 190 | } else if (m == 'd') { | 188 | } else if (m == 'd') { |
| 191 | strcat(pformat, "jd"); | 189 | strcat(pformat, "llu"); |
| 192 | printf(pformat, (intmax_t) (statfsbuf->f_ffree)); | 190 | printf(pformat, (unsigned long long) statfsbuf->f_ffree); |
| 193 | #if ENABLE_SELINUX | 191 | # if ENABLE_SELINUX |
| 194 | } else if (m == 'C' && (option_mask32 & OPT_SELINUX)) { | 192 | } else if (m == 'C' && (option_mask32 & OPT_SELINUX)) { |
| 195 | printfs(pformat, scontext); | 193 | printfs(pformat, scontext); |
| 196 | #endif | 194 | # endif |
| 197 | } else { | 195 | } else { |
| 198 | strcatc(pformat, 'c'); | 196 | strcatc(pformat, 'c'); |
| 199 | printf(pformat, m); | 197 | printf(pformat, m); |
| @@ -201,7 +199,7 @@ static void print_statfs(char *pformat, const char m, | |||
| 201 | } | 199 | } |
| 202 | 200 | ||
| 203 | /* print stat info */ | 201 | /* print stat info */ |
| 204 | static void print_stat(char *pformat, const char m, | 202 | static void FAST_FUNC print_stat(char *pformat, const char m, |
| 205 | const char *const filename, const void *data | 203 | const char *const filename, const void *data |
| 206 | IF_SELINUX(, security_context_t scontext)) | 204 | IF_SELINUX(, security_context_t scontext)) |
| 207 | { | 205 | { |
| @@ -227,14 +225,14 @@ static void print_stat(char *pformat, const char m, | |||
| 227 | printf(pformat, filename); | 225 | printf(pformat, filename); |
| 228 | } | 226 | } |
| 229 | } else if (m == 'd') { | 227 | } else if (m == 'd') { |
| 230 | strcat(pformat, "ju"); | 228 | strcat(pformat, "llu"); |
| 231 | printf(pformat, (uintmax_t) statbuf->st_dev); | 229 | printf(pformat, (unsigned long long) statbuf->st_dev); |
| 232 | } else if (m == 'D') { | 230 | } else if (m == 'D') { |
| 233 | strcat(pformat, "jx"); | 231 | strcat(pformat, "llx"); |
| 234 | printf(pformat, (uintmax_t) statbuf->st_dev); | 232 | printf(pformat, (unsigned long long) statbuf->st_dev); |
| 235 | } else if (m == 'i') { | 233 | } else if (m == 'i') { |
| 236 | strcat(pformat, "ju"); | 234 | strcat(pformat, "llu"); |
| 237 | printf(pformat, (uintmax_t) statbuf->st_ino); | 235 | printf(pformat, (unsigned long long) statbuf->st_ino); |
| 238 | } else if (m == 'a') { | 236 | } else if (m == 'a') { |
| 239 | strcat(pformat, "lo"); | 237 | strcat(pformat, "lo"); |
| 240 | printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO))); | 238 | printf(pformat, (unsigned long) (statbuf->st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO))); |
| @@ -269,14 +267,14 @@ static void print_stat(char *pformat, const char m, | |||
| 269 | strcat(pformat, "lx"); | 267 | strcat(pformat, "lx"); |
| 270 | printf(pformat, (unsigned long) minor(statbuf->st_rdev)); | 268 | printf(pformat, (unsigned long) minor(statbuf->st_rdev)); |
| 271 | } else if (m == 's') { | 269 | } else if (m == 's') { |
| 272 | strcat(pformat, "ju"); | 270 | strcat(pformat, "llu"); |
| 273 | printf(pformat, (uintmax_t) (statbuf->st_size)); | 271 | printf(pformat, (unsigned long long) statbuf->st_size); |
| 274 | } else if (m == 'B') { | 272 | } else if (m == 'B') { |
| 275 | strcat(pformat, "lu"); | 273 | strcat(pformat, "lu"); |
| 276 | printf(pformat, (unsigned long) 512); //ST_NBLOCKSIZE | 274 | printf(pformat, (unsigned long) 512); //ST_NBLOCKSIZE |
| 277 | } else if (m == 'b') { | 275 | } else if (m == 'b') { |
| 278 | strcat(pformat, "ju"); | 276 | strcat(pformat, "llu"); |
| 279 | printf(pformat, (uintmax_t) statbuf->st_blocks); | 277 | printf(pformat, (unsigned long long) statbuf->st_blocks); |
| 280 | } else if (m == 'o') { | 278 | } else if (m == 'o') { |
| 281 | strcat(pformat, "lu"); | 279 | strcat(pformat, "lu"); |
| 282 | printf(pformat, (unsigned long) statbuf->st_blksize); | 280 | printf(pformat, (unsigned long) statbuf->st_blksize); |
| @@ -284,31 +282,34 @@ static void print_stat(char *pformat, const char m, | |||
| 284 | printfs(pformat, human_time(statbuf->st_atime)); | 282 | printfs(pformat, human_time(statbuf->st_atime)); |
| 285 | } else if (m == 'X') { | 283 | } else if (m == 'X') { |
| 286 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); | 284 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); |
| 287 | printf(pformat, (unsigned long) statbuf->st_atime); | 285 | /* note: (unsigned long) would be wrong: |
| 286 | * imagine (unsigned long64)int32 */ | ||
| 287 | printf(pformat, (long) statbuf->st_atime); | ||
| 288 | } else if (m == 'y') { | 288 | } else if (m == 'y') { |
| 289 | printfs(pformat, human_time(statbuf->st_mtime)); | 289 | printfs(pformat, human_time(statbuf->st_mtime)); |
| 290 | } else if (m == 'Y') { | 290 | } else if (m == 'Y') { |
| 291 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); | 291 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); |
| 292 | printf(pformat, (unsigned long) statbuf->st_mtime); | 292 | printf(pformat, (long) statbuf->st_mtime); |
| 293 | } else if (m == 'z') { | 293 | } else if (m == 'z') { |
| 294 | printfs(pformat, human_time(statbuf->st_ctime)); | 294 | printfs(pformat, human_time(statbuf->st_ctime)); |
| 295 | } else if (m == 'Z') { | 295 | } else if (m == 'Z') { |
| 296 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); | 296 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); |
| 297 | printf(pformat, (unsigned long) statbuf->st_ctime); | 297 | printf(pformat, (long) statbuf->st_ctime); |
| 298 | #if ENABLE_SELINUX | 298 | # if ENABLE_SELINUX |
| 299 | } else if (m == 'C' && (option_mask32 & OPT_SELINUX)) { | 299 | } else if (m == 'C' && (option_mask32 & OPT_SELINUX)) { |
| 300 | printfs(pformat, scontext); | 300 | printfs(pformat, scontext); |
| 301 | #endif | 301 | # endif |
| 302 | } else { | 302 | } else { |
| 303 | strcatc(pformat, 'c'); | 303 | strcatc(pformat, 'c'); |
| 304 | printf(pformat, m); | 304 | printf(pformat, m); |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | static void print_it(const char *masterformat, const char *filename, | 308 | static void print_it(const char *masterformat, |
| 309 | void (*print_func) (char*, char, const char*, const void* IF_SELINUX(, security_context_t scontext)), | 309 | const char *filename, |
| 310 | void FAST_FUNC (*print_func)(char*, char, const char*, const void* IF_SELINUX(, security_context_t scontext)), | ||
| 310 | const void *data | 311 | const void *data |
| 311 | IF_SELINUX(, security_context_t scontext) ) | 312 | IF_SELINUX(, security_context_t scontext)) |
| 312 | { | 313 | { |
| 313 | /* Create a working copy of the format string */ | 314 | /* Create a working copy of the format string */ |
| 314 | char *format = xstrdup(masterformat); | 315 | char *format = xstrdup(masterformat); |
| @@ -355,7 +356,7 @@ static void print_it(const char *masterformat, const char *filename, | |||
| 355 | free(format); | 356 | free(format); |
| 356 | free(dest); | 357 | free(dest); |
| 357 | } | 358 | } |
| 358 | #endif | 359 | #endif /* FEATURE_STAT_FORMAT */ |
| 359 | 360 | ||
| 360 | /* Stat the file system and print what we find. */ | 361 | /* Stat the file system and print what we find. */ |
| 361 | #if !ENABLE_FEATURE_STAT_FORMAT | 362 | #if !ENABLE_FEATURE_STAT_FORMAT |
| @@ -364,7 +365,6 @@ static void print_it(const char *masterformat, const char *filename, | |||
| 364 | static bool do_statfs(const char *filename, const char *format) | 365 | static bool do_statfs(const char *filename, const char *format) |
| 365 | { | 366 | { |
| 366 | struct statfs statfsbuf; | 367 | struct statfs statfsbuf; |
| 367 | |||
| 368 | #if !ENABLE_FEATURE_STAT_FORMAT | 368 | #if !ENABLE_FEATURE_STAT_FORMAT |
| 369 | const char *format; | 369 | const char *format; |
| 370 | #endif | 370 | #endif |
| @@ -389,7 +389,7 @@ static bool do_statfs(const char *filename, const char *format) | |||
| 389 | 389 | ||
| 390 | #if ENABLE_FEATURE_STAT_FORMAT | 390 | #if ENABLE_FEATURE_STAT_FORMAT |
| 391 | if (format == NULL) { | 391 | if (format == NULL) { |
| 392 | #if !ENABLE_SELINUX | 392 | # if !ENABLE_SELINUX |
| 393 | format = (option_mask32 & OPT_TERSE | 393 | format = (option_mask32 & OPT_TERSE |
| 394 | ? "%n %i %l %t %s %b %f %a %c %d\n" | 394 | ? "%n %i %l %t %s %b %f %a %c %d\n" |
| 395 | : " File: \"%n\"\n" | 395 | : " File: \"%n\"\n" |
| @@ -397,7 +397,7 @@ static bool do_statfs(const char *filename, const char *format) | |||
| 397 | "Block size: %-10s\n" | 397 | "Block size: %-10s\n" |
| 398 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" | 398 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" |
| 399 | "Inodes: Total: %-10c Free: %d"); | 399 | "Inodes: Total: %-10c Free: %d"); |
| 400 | #else | 400 | # else |
| 401 | format = (option_mask32 & OPT_TERSE | 401 | format = (option_mask32 & OPT_TERSE |
| 402 | ? (option_mask32 & OPT_SELINUX ? "%n %i %l %t %s %b %f %a %c %d %C\n": | 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") | 403 | "%n %i %l %t %s %b %f %a %c %d\n") |
| @@ -414,7 +414,7 @@ static bool do_statfs(const char *filename, const char *format) | |||
| 414 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" | 414 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" |
| 415 | "Inodes: Total: %-10c Free: %d\n") | 415 | "Inodes: Total: %-10c Free: %d\n") |
| 416 | ); | 416 | ); |
| 417 | #endif /* SELINUX */ | 417 | # endif /* SELINUX */ |
| 418 | } | 418 | } |
| 419 | print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext)); | 419 | print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext)); |
| 420 | #else /* FEATURE_STAT_FORMAT */ | 420 | #else /* FEATURE_STAT_FORMAT */ |
| @@ -428,47 +428,48 @@ static bool do_statfs(const char *filename, const char *format) | |||
| 428 | statfsbuf.f_namelen); | 428 | statfsbuf.f_namelen); |
| 429 | 429 | ||
| 430 | if (option_mask32 & OPT_TERSE) | 430 | if (option_mask32 & OPT_TERSE) |
| 431 | printf("%lx ", (unsigned long) (statfsbuf.f_type)); | 431 | printf("%lx ", (unsigned long) statfsbuf.f_type); |
| 432 | else | 432 | else |
| 433 | printf("Type: %s\n", human_fstype(statfsbuf.f_type)); | 433 | printf("Type: %s\n", human_fstype(statfsbuf.f_type)); |
| 434 | 434 | ||
| 435 | #if !ENABLE_SELINUX | 435 | # if !ENABLE_SELINUX |
| 436 | format = (option_mask32 & OPT_TERSE | 436 | format = (option_mask32 & OPT_TERSE |
| 437 | ? "%lu %ld %ld %ld %ld %ld\n" | 437 | ? "%lu %llu %llu %llu %llu %llu\n" |
| 438 | : "Block size: %-10lu\n" | 438 | : "Block size: %-10lu\n" |
| 439 | "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n" | 439 | "Blocks: Total: %-10llu Free: %-10llu Available: %llu\n" |
| 440 | "Inodes: Total: %-10jd Free: %jd\n"); | 440 | "Inodes: Total: %-10llu Free: %llu\n"); |
| 441 | printf(format, | 441 | printf(format, |
| 442 | (unsigned long) (statfsbuf.f_bsize), | 442 | (unsigned long) statfsbuf.f_bsize, |
| 443 | (intmax_t) (statfsbuf.f_blocks), | 443 | (unsigned long long) statfsbuf.f_blocks, |
| 444 | (intmax_t) (statfsbuf.f_bfree), | 444 | (unsigned long long) statfsbuf.f_bfree, |
| 445 | (intmax_t) (statfsbuf.f_bavail), | 445 | (unsigned long long) statfsbuf.f_bavail, |
| 446 | (intmax_t) (statfsbuf.f_files), | 446 | (unsigned long long) statfsbuf.f_files, |
| 447 | (intmax_t) (statfsbuf.f_ffree)); | 447 | (unsigned long long) statfsbuf.f_ffree); |
| 448 | #else | 448 | # else |
| 449 | format = (option_mask32 & OPT_TERSE | 449 | format = (option_mask32 & OPT_TERSE |
| 450 | ? (option_mask32 & OPT_SELINUX ? "%lu %ld %ld %ld %ld %ld %C\n": | 450 | ? (option_mask32 & OPT_SELINUX ? "%lu %llu %llu %llu %llu %llu %C\n" : "%lu %llu %llu %llu %llu %llu\n") |
| 451 | "%lu %ld %ld %ld %ld %ld\n") | 451 | : (option_mask32 & OPT_SELINUX |
| 452 | : (option_mask32 & OPT_SELINUX ? | 452 | ? "Block size: %-10lu\n" |
| 453 | "Block size: %-10lu\n" | 453 | "Blocks: Total: %-10llu Free: %-10llu Available: %llu\n" |
| 454 | "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n" | 454 | "Inodes: Total: %-10llu Free: %llu" |
| 455 | "Inodes: Total: %-10jd Free: %jd" | 455 | "S_context: %C\n" |
| 456 | "S_context: %C\n": | 456 | : "Block size: %-10lu\n" |
| 457 | "Block size: %-10lu\n" | 457 | "Blocks: Total: %-10llu Free: %-10llu Available: %llu\n" |
| 458 | "Blocks: Total: %-10jd Free: %-10jd Available: %jd\n" | 458 | "Inodes: Total: %-10llu Free: %llu\n" |
| 459 | "Inodes: Total: %-10jd Free: %jd\n")); | 459 | ) |
| 460 | ); | ||
| 460 | printf(format, | 461 | printf(format, |
| 461 | (unsigned long) (statfsbuf.f_bsize), | 462 | (unsigned long) statfsbuf.f_bsize, |
| 462 | (intmax_t) (statfsbuf.f_blocks), | 463 | (unsigned long long) statfsbuf.f_blocks, |
| 463 | (intmax_t) (statfsbuf.f_bfree), | 464 | (unsigned long long) statfsbuf.f_bfree, |
| 464 | (intmax_t) (statfsbuf.f_bavail), | 465 | (unsigned long long) statfsbuf.f_bavail, |
| 465 | (intmax_t) (statfsbuf.f_files), | 466 | (unsigned long long) statfsbuf.f_files, |
| 466 | (intmax_t) (statfsbuf.f_ffree), | 467 | (unsigned long long) statfsbuf.f_ffree, |
| 467 | scontext); | 468 | scontext); |
| 468 | 469 | ||
| 469 | if (scontext) | 470 | if (scontext) |
| 470 | freecon(scontext); | 471 | freecon(scontext); |
| 471 | #endif | 472 | # endif |
| 472 | #endif /* FEATURE_STAT_FORMAT */ | 473 | #endif /* FEATURE_STAT_FORMAT */ |
| 473 | return 1; | 474 | return 1; |
| 474 | } | 475 | } |
| @@ -501,7 +502,7 @@ static bool do_stat(const char *filename, const char *format) | |||
| 501 | 502 | ||
| 502 | #if ENABLE_FEATURE_STAT_FORMAT | 503 | #if ENABLE_FEATURE_STAT_FORMAT |
| 503 | if (format == NULL) { | 504 | if (format == NULL) { |
| 504 | #if !ENABLE_SELINUX | 505 | # if !ENABLE_SELINUX |
| 505 | if (option_mask32 & OPT_TERSE) { | 506 | if (option_mask32 & OPT_TERSE) { |
| 506 | format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o"; | 507 | format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o"; |
| 507 | } else { | 508 | } else { |
| @@ -522,7 +523,7 @@ static bool do_stat(const char *filename, const char *format) | |||
| 522 | "Access: %x\n" "Modify: %y\n" "Change: %z\n"; | 523 | "Access: %x\n" "Modify: %y\n" "Change: %z\n"; |
| 523 | } | 524 | } |
| 524 | } | 525 | } |
| 525 | #else | 526 | # else |
| 526 | if (option_mask32 & OPT_TERSE) { | 527 | if (option_mask32 & OPT_TERSE) { |
| 527 | format = (option_mask32 & OPT_SELINUX ? | 528 | 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 %C\n": |
| @@ -558,21 +559,21 @@ static bool do_stat(const char *filename, const char *format) | |||
| 558 | "Access: %x\n" "Modify: %y\n" "Change: %z\n"); | 559 | "Access: %x\n" "Modify: %y\n" "Change: %z\n"); |
| 559 | } | 560 | } |
| 560 | } | 561 | } |
| 561 | #endif | 562 | # endif |
| 562 | } | 563 | } |
| 563 | print_it(format, filename, print_stat, &statbuf IF_SELINUX(, scontext)); | 564 | print_it(format, filename, print_stat, &statbuf IF_SELINUX(, scontext)); |
| 564 | #else /* FEATURE_STAT_FORMAT */ | 565 | #else /* FEATURE_STAT_FORMAT */ |
| 565 | if (option_mask32 & OPT_TERSE) { | 566 | if (option_mask32 & OPT_TERSE) { |
| 566 | printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu" | 567 | printf("%s %llu %llu %lx %lu %lu %llx %llu %lu %lx %lx %lu %lu %lu %lu" |
| 567 | IF_NOT_SELINUX("\n"), | 568 | IF_NOT_SELINUX("\n"), |
| 568 | filename, | 569 | filename, |
| 569 | (uintmax_t) (statbuf.st_size), | 570 | (unsigned long long) statbuf.st_size, |
| 570 | (uintmax_t) statbuf.st_blocks, | 571 | (unsigned long long) statbuf.st_blocks, |
| 571 | (unsigned long) statbuf.st_mode, | 572 | (unsigned long) statbuf.st_mode, |
| 572 | (unsigned long) statbuf.st_uid, | 573 | (unsigned long) statbuf.st_uid, |
| 573 | (unsigned long) statbuf.st_gid, | 574 | (unsigned long) statbuf.st_gid, |
| 574 | (uintmax_t) statbuf.st_dev, | 575 | (unsigned long long) statbuf.st_dev, |
| 575 | (uintmax_t) statbuf.st_ino, | 576 | (unsigned long long) statbuf.st_ino, |
| 576 | (unsigned long) statbuf.st_nlink, | 577 | (unsigned long) statbuf.st_nlink, |
| 577 | (unsigned long) major(statbuf.st_rdev), | 578 | (unsigned long) major(statbuf.st_rdev), |
| 578 | (unsigned long) minor(statbuf.st_rdev), | 579 | (unsigned long) minor(statbuf.st_rdev), |
| @@ -581,12 +582,12 @@ static bool do_stat(const char *filename, const char *format) | |||
| 581 | (unsigned long) statbuf.st_ctime, | 582 | (unsigned long) statbuf.st_ctime, |
| 582 | (unsigned long) statbuf.st_blksize | 583 | (unsigned long) statbuf.st_blksize |
| 583 | ); | 584 | ); |
| 584 | #if ENABLE_SELINUX | 585 | # if ENABLE_SELINUX |
| 585 | if (option_mask32 & OPT_SELINUX) | 586 | if (option_mask32 & OPT_SELINUX) |
| 586 | printf(" %lc\n", *scontext); | 587 | printf(" %lc\n", *scontext); |
| 587 | else | 588 | else |
| 588 | bb_putchar('\n'); | 589 | bb_putchar('\n'); |
| 589 | #endif | 590 | # endif |
| 590 | } else { | 591 | } else { |
| 591 | char *linkname = NULL; | 592 | char *linkname = NULL; |
| 592 | 593 | ||
| @@ -604,15 +605,15 @@ static bool do_stat(const char *filename, const char *format) | |||
| 604 | else | 605 | else |
| 605 | printf(" File: \"%s\"\n", filename); | 606 | printf(" File: \"%s\"\n", filename); |
| 606 | 607 | ||
| 607 | printf(" Size: %-10ju\tBlocks: %-10ju IO Block: %-6lu %s\n" | 608 | printf(" Size: %-10llu\tBlocks: %-10llu IO Block: %-6lu %s\n" |
| 608 | "Device: %jxh/%jud\tInode: %-10ju Links: %-5lu", | 609 | "Device: %llxh/%llud\tInode: %-10llu Links: %-5lu", |
| 609 | (uintmax_t) (statbuf.st_size), | 610 | (unsigned long long) statbuf.st_size, |
| 610 | (uintmax_t) statbuf.st_blocks, | 611 | (unsigned long long) statbuf.st_blocks, |
| 611 | (unsigned long) statbuf.st_blksize, | 612 | (unsigned long) statbuf.st_blksize, |
| 612 | file_type(&statbuf), | 613 | file_type(&statbuf), |
| 613 | (uintmax_t) statbuf.st_dev, | 614 | (unsigned long long) statbuf.st_dev, |
| 614 | (uintmax_t) statbuf.st_dev, | 615 | (unsigned long long) statbuf.st_dev, |
| 615 | (uintmax_t) statbuf.st_ino, | 616 | (unsigned long long) statbuf.st_ino, |
| 616 | (unsigned long) statbuf.st_nlink); | 617 | (unsigned long) statbuf.st_nlink); |
| 617 | if (S_ISBLK(statbuf.st_mode) || S_ISCHR(statbuf.st_mode)) | 618 | if (S_ISBLK(statbuf.st_mode) || S_ISCHR(statbuf.st_mode)) |
| 618 | printf(" Device type: %lx,%lx\n", | 619 | printf(" Device type: %lx,%lx\n", |
| @@ -627,9 +628,9 @@ static bool do_stat(const char *filename, const char *format) | |||
| 627 | (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN", | 628 | (pw_ent != NULL) ? pw_ent->pw_name : "UNKNOWN", |
| 628 | (unsigned long) statbuf.st_gid, | 629 | (unsigned long) statbuf.st_gid, |
| 629 | (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN"); | 630 | (gw_ent != NULL) ? gw_ent->gr_name : "UNKNOWN"); |
| 630 | #if ENABLE_SELINUX | 631 | # if ENABLE_SELINUX |
| 631 | printf(" S_Context: %lc\n", *scontext); | 632 | printf(" S_Context: %lc\n", *scontext); |
| 632 | #endif | 633 | # endif |
| 633 | printf("Access: %s\n" "Modify: %s\n" "Change: %s\n", | 634 | printf("Access: %s\n" "Modify: %s\n" "Change: %s\n", |
| 634 | human_time(statbuf.st_atime), | 635 | human_time(statbuf.st_atime), |
| 635 | human_time(statbuf.st_mtime), | 636 | human_time(statbuf.st_mtime), |
