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:39:35 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2015-11-01 14:39:35 +0100
commit30cb6ead1b6bc2df8946e18f1a3505b5e0045c70 (patch)
tree2268c72bb0543bf413f3418b9684b0950996edd9 /lr.c
parent9c7dc7fbecf015b087e1626335190e8a456f5da9 (diff)
downloadlr-30cb6ead1b6bc2df8946e18f1a3505b5e0045c70.tar.gz
lr-30cb6ead1b6bc2df8946e18f1a3505b5e0045c70.tar.xz
lr-30cb6ead1b6bc2df8946e18f1a3505b5e0045c70.zip
simplify %u/%g
Diffstat (limited to 'lr.c')
-rw-r--r--lr.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/lr.c b/lr.c
index 510f8cc..485241c 100644
--- a/lr.c
+++ b/lr.c
@@ -1114,25 +1114,10 @@ print_format(struct fileinfo *fi)
 			putchar("0pcCd?bBf?l?s???"[(fi->sb.st_mode >> 12) & 0x0f]);
 			break;
 
-		case 'g': {
-			char *s = groupname(fi->sb.st_gid);
-			if (s) {
-				printf("%*s", -gwid, s);
-				break;
-			}
-			/* FALLTHRU */
-		}
-		case 'G': printf("%*ld", gwid, (long)fi->sb.st_gid); break;
-
-		case 'u': {
-			char *s = username(fi->sb.st_uid);
-			if (s) {
-				printf("%*s", -uwid, s);
-				break;
-			}
-			/* FALLTHRU */
-		}
-		case 'U': printf("%*ld", uwid, (long)fi->sb.st_uid); break;
+		case 'g': printf("%*s", -gwid, groupname(fi->sb.st_gid)); break;
+		case 'G': printf("%*ld", intlen(maxgid), (long)fi->sb.st_gid); break;
+		case 'u': printf("%*s", -uwid, username(fi->sb.st_uid)); break;
+		case 'U': printf("%*ld", intlen(maxuid), (long)fi->sb.st_uid); break;
 
 		case 'e': printf("%ld", (long)fi->entries); break;
 		case 't': printf("%jd", (intmax_t)fi->total); break;