From 78d87be0b2fd7a69cbf5a40611e44670029cd383 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Sun, 1 Nov 2015 14:37:57 +0100 Subject: compute fstype widths --- lr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lr.c') diff --git a/lr.c b/lr.c index f64abfb..762d622 100644 --- a/lr.c +++ b/lr.c @@ -94,7 +94,7 @@ struct idmap { static off_t maxsize; static nlink_t maxlinks; -static int uwid, gwid; +static int uwid, gwid, fwid; struct fileinfo { char *fpath; @@ -779,6 +779,9 @@ fstype(dev_t devid) scan_filesystems(); result = tfind(&key, &filesystems, idorder); + if (result && (int)strlen((*result)->name) > fwid) + fwid = strlen((*result)->name); + return result ? (*result)->name : strid(devid); } @@ -1111,7 +1114,7 @@ print_format(struct fileinfo *fi) case 'e': printf("%ld", (long)fi->entries); break; case 't': printf("%jd", (intmax_t)fi->total); break; - case 'Y': printf("%s", fstype(fi->sb.st_dev)); break; + case 'Y': printf("%*s", -fwid, fstype(fi->sb.st_dev)); break; default: putchar('%'); putchar(*s); -- cgit 1.4.1