parent
cb44816ba3
commit
fc5f318896
@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
@ -146,15 +146,15 @@ static void print_statfs(char *pformat, size_t buf_len, char m,
|
|||||||
printf(pformat, human_fstype(statfsbuf->f_type));
|
printf(pformat, human_fstype(statfsbuf->f_type));
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
strncat(pformat, "ld", buf_len);
|
strncat(pformat, "jd", buf_len);
|
||||||
printf(pformat, (intmax_t) (statfsbuf->f_blocks));
|
printf(pformat, (intmax_t) (statfsbuf->f_blocks));
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
strncat(pformat, "ld", buf_len);
|
strncat(pformat, "jd", buf_len);
|
||||||
printf(pformat, (intmax_t) (statfsbuf->f_bfree));
|
printf(pformat, (intmax_t) (statfsbuf->f_bfree));
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
strncat(pformat, "ld", buf_len);
|
strncat(pformat, "jd", buf_len);
|
||||||
printf(pformat, (intmax_t) (statfsbuf->f_bavail));
|
printf(pformat, (intmax_t) (statfsbuf->f_bavail));
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
@ -163,11 +163,11 @@ static void print_statfs(char *pformat, size_t buf_len, char m,
|
|||||||
printf(pformat, (unsigned long int) (statfsbuf->f_bsize));
|
printf(pformat, (unsigned long int) (statfsbuf->f_bsize));
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
strncat(pformat, "ld", buf_len);
|
strncat(pformat, "jd", buf_len);
|
||||||
printf(pformat, (intmax_t) (statfsbuf->f_files));
|
printf(pformat, (intmax_t) (statfsbuf->f_files));
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
strncat(pformat, "ld", buf_len);
|
strncat(pformat, "jd", buf_len);
|
||||||
printf(pformat, (intmax_t) (statfsbuf->f_ffree));
|
printf(pformat, (intmax_t) (statfsbuf->f_ffree));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -208,15 +208,15 @@ static void print_stat(char *pformat, size_t buf_len, char m,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
strncat(pformat, "lu", buf_len);
|
strncat(pformat, "ju", buf_len);
|
||||||
printf(pformat, (uintmax_t) statbuf->st_dev);
|
printf(pformat, (uintmax_t) statbuf->st_dev);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
strncat(pformat, "lx", buf_len);
|
strncat(pformat, "jx", buf_len);
|
||||||
printf(pformat, (uintmax_t) statbuf->st_dev);
|
printf(pformat, (uintmax_t) statbuf->st_dev);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
strncat(pformat, "lu", buf_len);
|
strncat(pformat, "ju", buf_len);
|
||||||
printf(pformat, (uintmax_t) statbuf->st_ino);
|
printf(pformat, (uintmax_t) statbuf->st_ino);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
@ -268,7 +268,7 @@ static void print_stat(char *pformat, size_t buf_len, char m,
|
|||||||
printf(pformat, (unsigned long int) minor(statbuf->st_rdev));
|
printf(pformat, (unsigned long int) minor(statbuf->st_rdev));
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
strncat(pformat, "lu", buf_len);
|
strncat(pformat, "ju", buf_len);
|
||||||
printf(pformat, (uintmax_t) (statbuf->st_size));
|
printf(pformat, (uintmax_t) (statbuf->st_size));
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
@ -276,7 +276,7 @@ static void print_stat(char *pformat, size_t buf_len, char m,
|
|||||||
printf(pformat, (unsigned long int) 512); //ST_NBLOCKSIZE
|
printf(pformat, (unsigned long int) 512); //ST_NBLOCKSIZE
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
strncat(pformat, "lu", buf_len);
|
strncat(pformat, "ju", buf_len);
|
||||||
printf(pformat, (uintmax_t) statbuf->st_blocks);
|
printf(pformat, (uintmax_t) statbuf->st_blocks);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
@ -405,8 +405,8 @@ static int do_statfs(char const *filename, char const *format)
|
|||||||
format = (flags & OPT_TERSE
|
format = (flags & OPT_TERSE
|
||||||
? "%lu %ld %ld %ld %ld %ld\n"
|
? "%lu %ld %ld %ld %ld %ld\n"
|
||||||
: "Block size: %-10lu\n"
|
: "Block size: %-10lu\n"
|
||||||
"Blocks: Total: %-10ld Free: %-10ld Available: %ld\n"
|
"Blocks: Total: %-10jd Free: %-10jd Available: %jd\n"
|
||||||
"Inodes: Total: %-10ld Free: %ld\n");
|
"Inodes: Total: %-10jd Free: %jd\n");
|
||||||
printf(format,
|
printf(format,
|
||||||
(unsigned long int) (statfsbuf.f_bsize),
|
(unsigned long int) (statfsbuf.f_bsize),
|
||||||
(intmax_t) (statfsbuf.f_blocks),
|
(intmax_t) (statfsbuf.f_blocks),
|
||||||
@ -455,7 +455,7 @@ static int do_stat(char const *filename, char const *format)
|
|||||||
print_it(format, filename, print_stat, &statbuf);
|
print_it(format, filename, print_stat, &statbuf);
|
||||||
#else
|
#else
|
||||||
if (flags & OPT_TERSE) {
|
if (flags & OPT_TERSE) {
|
||||||
printf("%s %"PRIuMAX" %"PRIuMAX" %lx %lu %lu %"PRIxMAX" %"PRIuMAX" %lu %lx %lx %lu %lu %lu %lu\n",
|
printf("%s %ju %ju %lx %lu %lu %jx %ju %lu %lx %lx %lu %lu %lu %lu\n",
|
||||||
filename,
|
filename,
|
||||||
(uintmax_t) (statbuf.st_size),
|
(uintmax_t) (statbuf.st_size),
|
||||||
(uintmax_t) statbuf.st_blocks,
|
(uintmax_t) statbuf.st_blocks,
|
||||||
@ -489,8 +489,8 @@ static int do_stat(char const *filename, char const *format)
|
|||||||
else
|
else
|
||||||
printf(" File: \"%s\"\n", filename);
|
printf(" File: \"%s\"\n", filename);
|
||||||
|
|
||||||
printf(" Size: %-10"PRIuMAX"\tBlocks: %-10"PRIuMAX" IO Block: %-6lu %s\n"
|
printf(" Size: %-10ju\tBlocks: %-10ju IO Block: %-6lu %s\n"
|
||||||
"Device: %"PRIxMAX"h/%"PRIuMAX"d\tInode: %-10"PRIuMAX" Links: %-5lu",
|
"Device: %jxh/%jud\tInode: %-10ju Links: %-5lu",
|
||||||
(uintmax_t) (statbuf.st_size),
|
(uintmax_t) (statbuf.st_size),
|
||||||
(uintmax_t) statbuf.st_blocks,
|
(uintmax_t) statbuf.st_blocks,
|
||||||
(unsigned long int) statbuf.st_blksize,
|
(unsigned long int) statbuf.st_blksize,
|
||||||
|
Loading…
Reference in New Issue
Block a user