Re: /bin/df align inode output

2018-10-25 Thread Todd C. Miller
With your patch the mount point is offset by a space from the
"Mounted on" header.

 - todd



/bin/df align inode output

2018-10-25 Thread Solene Rapenne
the following diff makes df printing aligned inode informations.

before patch

solene@t480 /usr/src/bin/df $ df -ik
Filesystem  1K-blocks  Used Avail Capacity iused   ifree  %iused  
Mounted on
/dev/sd2a 102887813786283957414%2227  153675 1%   /
/dev/sd2l   312080984  38691660 25778527613%  519480 19221190 3%   /home
/dev/sd2d 4125390  7718   3911404 0% 113  545549 0%   /tmp
/dev/sd2f 2061054786084   117191840%   14608  271214 5%   /usr
/dev/sd2g 102887819105278638420%9211  146691 6%   
/usr/X11R6
/dev/sd2h10318462   7347916   245462475%  171668 115351413%   
/usr/local
/dev/sd2k 6189758150842   5729430 3%2469  803033 0%   
/usr/obj
/dev/sd2j 2061054   111567884232457%  105820  18000237%   
/usr/src
/dev/sd2e20124398   1498948  17619232 8%   14606 2557808 1%   /var
/dev/sd2m   127381766  92115060  2889761876%  623330 15616668 4%   /data

with patch

solene@t480 /usr/src/bin/df $ ./df -ik
Filesystem  1K-blocks  Used Avail Capacity  iusedifree %iused  
Mounted on
/dev/sd2a 102887813786283957414% 2227   153675 1%   /
/dev/sd2l   312080984  38691660 25778527613%   519480 19221190 3%   
/home
/dev/sd2d 4125390  7718   3911404 0%  113   545549 0%   /tmp
/dev/sd2f 2061054786084   117191840%14608   271214 5%   /usr
/dev/sd2g 102887819105278638420% 9211   146691 6%   
/usr/X11R6
/dev/sd2h10318462   7347916   245462475%   171668  115351413%   
/usr/local
/dev/sd2k 6189758150842   5729430 3% 2469   803033 0%   
/usr/obj
/dev/sd2j 2061054   111567884232457%   105820   18000237%   
/usr/src
/dev/sd2e20124398   1498948  17619232 8%14606  2557808 1%   /var
/dev/sd2m   127381766  92115060  2889761876%   623330 15616668 4%   
/data


Index: df.c
===
RCS file: /cvs/src/bin/df/df.c,v
retrieving revision 1.59
diff -u -p -r1.59 df.c
--- df.c14 Aug 2016 21:07:40 -  1.59
+++ df.c25 Oct 2018 10:52:21 -
@@ -328,7 +328,7 @@ prtstat(struct statfs *sfsp, int maxwidt
if (iflag) {
inodes = sfsp->f_files;
used = inodes - sfsp->f_ffree;
-   (void)printf(" %7llu %7llu %5.0f%% ", used, sfsp->f_ffree,
+   (void)printf(" %8llu %8llu %5.0f%% ", used, sfsp->f_ffree,
   inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0);
} else
(void)printf("  ");
@@ -363,7 +363,7 @@ bsdprint(struct statfs *mntbuf, long mnt
 maxwidth, maxwidth, "Filesystem", header);
}
if (iflag)
-   (void)printf(" iused   ifree  %%iused");
+   (void)printf("  iusedifree %%iused");
(void)printf("  Mounted on\n");