about summary refs log tree commit diff
path: root/lr.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-06-20 17:11:49 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-06-20 17:11:49 +0200
commit1891e3c8344a4724e3b667a458bf4e9ebd64ded2 (patch)
treea4d2e1b18380bb21ef3abb16f80857442fd2ab91 /lr.c
parentde33e3a8fa8715ad5f7c46e7f9638e45dcd757f9 (diff)
downloadlr-1891e3c8344a4724e3b667a458bf4e9ebd64ded2.tar.gz
lr-1891e3c8344a4724e3b667a458bf4e9ebd64ded2.tar.xz
lr-1891e3c8344a4724e3b667a458bf4e9ebd64ded2.zip
lr: fix output of empty string
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 6626268..e36cb03 100644
--- a/lr.c
+++ b/lr.c
@@ -1438,7 +1438,7 @@ print_shquoted(const char *s)
 void
 print_noprefix(struct fileinfo *fi)
 {
-	if (fi->prefixl == 0)
+	if (fi->prefixl == 0 && fi->fpath[0])
 		print_shquoted(fi->fpath);
 	else if (strlen(fi->fpath) > fi->prefixl + 1)  /* strip prefix */
 		print_shquoted(fi->fpath + fi->prefixl + 1);
@@ -1571,7 +1571,10 @@ print_format(struct fileinfo *fi)
 		case 'p':
 			if (!sflag) {
 				color_name_on(fi->color, fi->fpath, fi->sb.st_mode);
-				print_shquoted(fi->fpath);
+				if (!fi->fpath[0] && S_ISDIR(fi->sb.st_mode))
+					print_shquoted(".");
+				else
+					print_shquoted(fi->fpath);
 				fgdefault();
 				break;
 			}