diff options
author | Jim Meyering <jim@meyering.net> | 2002-04-16 06:50:54 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-04-16 06:50:54 +0000 |
commit | 5bd81eab0f7b434087085849968ad8e234a0a391 (patch) | |
tree | 3742b9c24d2c2453c2681d52c44eac9b1983a6b0 | |
parent | 598064934e470674885f3a6a18778817e6855dc2 (diff) | |
download | coreutils-5bd81eab0f7b434087085849968ad8e234a0a391.tar.xz |
(human_fstype): Rename from print_human_fstype, and rework accordingly.
(print_statfs): Use human_fstype to honor format width on %T.
-rw-r--r-- | src/stat.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/stat.c b/src/stat.c index a9d0b0ff5..f7ff86688 100644 --- a/src/stat.c +++ b/src/stat.c @@ -128,8 +128,8 @@ print_human_type (mode_t mode) fputs (type, stdout); } -static void -print_human_fstype (struct statfs const *statfsbuf) +static char * +human_fstype (struct statfs const *statfsbuf) { char const *type; @@ -312,9 +312,14 @@ print_human_fstype (struct statfs const *statfsbuf) } if (type) - fputs (type, stdout); - else - printf ("UNKNOWN (0x%x)\n", statfsbuf->f_type); + return (char *) type; + + { + static char buf[sizeof "UNKNOWN (0x%x)" - 2 + + 2 * sizeof (statfsbuf->f_type)]; + sprintf (buf, "UNKNOWN (0x%x)", statfsbuf->f_type); + return buf; + } } static void @@ -376,8 +381,8 @@ print_statfs (char *pformat, char m, char const *filename, printf (pformat, (long int) (statfsbuf->f_type)); break; case 'T': -/* print_human_fstype(statfsbuf, pformat);*/ - print_human_fstype (statfsbuf); + strcat (pformat, "s"); + printf (pformat, human_fstype (statfsbuf)); break; case 'b': strcat (pformat, PRIdMAX); |