diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-06-20 17:11:49 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-06-20 17:11:49 +0200 |
commit | 1891e3c8344a4724e3b667a458bf4e9ebd64ded2 (patch) | |
tree | a4d2e1b18380bb21ef3abb16f80857442fd2ab91 /lr.c | |
parent | de33e3a8fa8715ad5f7c46e7f9638e45dcd757f9 (diff) | |
download | lr-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.c | 7 |
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; } |