about summary refs log tree commit diff
path: root/lr.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-11-01 14:37:57 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2015-11-01 14:37:57 +0100
commit78d87be0b2fd7a69cbf5a40611e44670029cd383 (patch)
tree6fa21ee2c738a9647949a611cfe09d06911ecbc3 /lr.c
parentb483f6f560d7ce9225194ec9f9f66bd55c67b589 (diff)
downloadlr-78d87be0b2fd7a69cbf5a40611e44670029cd383.tar.gz
lr-78d87be0b2fd7a69cbf5a40611e44670029cd383.tar.xz
lr-78d87be0b2fd7a69cbf5a40611e44670029cd383.zip
compute fstype widths
Diffstat (limited to 'lr.c')
-rw-r--r--lr.c7
1 files changed, 5 insertions, 2 deletions
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);