mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 923ef6a51e7ca3787025b7b87e6b2ace19eca8b7
parent 4c5a0070309768c422163c81ceccd754c1b94d64
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Tue,  9 Aug 2016 21:27:22 +0200

mscan: better width for %F

Diffstat:
mscan.c | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/mscan.c b/mscan.c @@ -403,7 +403,6 @@ oneline(char *file) break; case 'F': { - if (!w) w = -10; char *e = file + strlen(file); while (file < e && *e != '/') e--; @@ -417,9 +416,22 @@ oneline(char *file) b++; if (*b == '.') b++; - wleft -= printf("%*.*s", w, (int)(e-b), b); + if (w) { + if (w < 0) + w = -w; + wleft -= printf("%*.*s", + -w, (int)(e-b < w ? e-b : w), b); + } else { + wleft -= printf("%.*s", (int)(e-b), b); + } } break; + case 'R': + if (w) + wleft -= printf("%*.*s", w, w, file); + else + wleft -= printf("%s", file); + break; default: putchar('%'); putchar(*f);