]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(human_fstype): Rename from print_human_fstype, and rework accordingly.
authorJim Meyering <jim@meyering.net>
Tue, 16 Apr 2002 06:50:54 +0000 (06:50 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 16 Apr 2002 06:50:54 +0000 (06:50 +0000)
(print_statfs): Use human_fstype to honor format width on %T.

src/stat.c

index a9d0b0ff5979ae9f67f463f4257ff00c63cfeb95..f7ff86688b350a34494b647449ee3d346a3f10a4 100644 (file)
@@ -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);