From 1891e3c8344a4724e3b667a458bf4e9ebd64ded2 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 20 Jun 2017 17:11:49 +0200 Subject: lr: fix output of empty string --- lr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lr.c') 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; } -- cgit 1.4.1