From: Jim Meyering Date: Tue, 16 Apr 2002 06:50:54 +0000 (+0000) Subject: (human_fstype): Rename from print_human_fstype, and rework accordingly. X-Git-Tag: SH-UTILS-2_0_12~136 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5bd81eab0f7b434087085849968ad8e234a0a391;p=thirdparty%2Fcoreutils.git (human_fstype): Rename from print_human_fstype, and rework accordingly. (print_statfs): Use human_fstype to honor format width on %T. --- diff --git a/src/stat.c b/src/stat.c index a9d0b0ff59..f7ff86688b 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);