df(1): Fix field widths for iused and ifree when df -hi is used.
authorSascha Wildner <saw@online.de>
Tue, 10 Jun 2014 13:28:10 +0000 (15:28 +0200)
committerSascha Wildner <saw@online.de>
Tue, 10 Jun 2014 13:28:26 +0000 (15:28 +0200)
Submitted-by: Robin Hahling <robin.hahling@gw-computing.net>
bin/df/df.c

index a930642..91f5be7 100644 (file)
@@ -404,8 +404,10 @@ prtstat(struct statfs *sfsp, struct statvfs *vsfsp, struct maxwidths *mwp)
                printf(" %-*s %*s %*s Capacity", mwp->total, header, mwp->used,
                    "Used", mwp->avail, "Avail");
                if (iflag) {
-                       mwp->iused = imax(mwp->iused, strlen("  iused"));
-                       mwp->ifree = imax(mwp->ifree, strlen("ifree"));
+                       mwp->iused = imax(hflag ? 0 : mwp->iused,
+                           (int)strlen("  iused"));
+                       mwp->ifree = imax(hflag ? 0 : mwp->ifree,
+                           (int)strlen("ifree"));
                        printf(" %*s %*s %%iused", mwp->iused - 2,
                            "iused", mwp->ifree, "ifree");
                }