From 058d7358ed569434d136ddfa7a21550aa68b76cb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 8 Feb 2005 21:38:53 +0000 Subject: (STATFS_FRSIZE): New macro. (print_statfs): Use it to implement %S. (do_statfs): Change default formats to include %S. (usage): Document %S (versus %s). --- src/stat.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/stat.c b/src/stat.c index 90a340bac..3d302e7fd 100644 --- a/src/stat.c +++ b/src/stat.c @@ -65,6 +65,7 @@ # endif # if STAT_STATVFS # define STATFS statvfs +# define STATFS_FRSIZE(S) ((S)->f_frsize) # endif #else # define STRUCT_STATVFS struct statfs @@ -76,6 +77,7 @@ #ifndef STATFS # define STATFS statfs +# define STATFS_FRSIZE(S) 0 #endif #ifndef SB_F_NAMEMAX @@ -347,6 +349,15 @@ print_statfs (char *pformat, char m, char const *filename, strcat (pformat, "lu"); printf (pformat, (unsigned long int) (statfsbuf->f_bsize)); break; + case 'S': + { + unsigned long int frsize = STATFS_FRSIZE (statfsbuf); + if (! frsize) + frsize = statfsbuf->f_bsize; + strcat (pformat, "lu"); + printf (pformat, frsize); + } + break; case 'c': strcat (pformat, PRIdMAX); printf (pformat, (intmax_t) (statfsbuf->f_files)); @@ -577,11 +588,12 @@ do_statfs (char const *filename, bool terse, char const *format) if (format == NULL) { format = (terse - ? "%n %i %l %t %b %f %a %s %c %d\n" + ? "%n %i %l %t %s %S %b %f %a %c %d\n" : " File: \"%n\"\n" " ID: %-8i Namelen: %-7l Type: %T\n" - "Blocks: Total: %-10b Free: %-10f Available: %-10a Size: %s\n" - "Inodes: Total: %-10c Free: %-10d\n"); + "Block size: %-10s Fundamental block size: %S\n" + "Blocks: Total: %-10b Free: %-10f Available: %a\n" + "Inodes: Total: %-10c Free: %d\n"); } print_it (format, filename, print_statfs, &statfsbuf); @@ -707,7 +719,8 @@ Valid format sequences for file systems:\n\ %i File System ID in hex\n\ %l Maximum length of filenames\n\ %n File name\n\ - %s Fundamental block size\n\ + %s Block size (for faster transfers)\n\ + %S Fundamental block size (for block counts)\n\ %t Type in hex\n\ %T Type in human readable form\n\ "), stdout); -- cgit v1.2.3-70-g09d2