From 2ad6ae80d8512c985fd613e5340c472582225dcd Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 10 Aug 2016 18:00:51 +0200 Subject: mscan: make negative width in %f, %s mean "rest minus N" --- mscan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mscan.c') diff --git a/mscan.c b/mscan.c index 684faae..7d192d5 100644 --- a/mscan.c +++ b/mscan.c @@ -36,8 +36,6 @@ static char *fflag = default_fflag; int u8putstr(FILE *out, char *s, ssize_t l, int pad) { - if (l < 0) - l = -l; ssize_t ol = l; while (*s && l > 0) { @@ -378,6 +376,8 @@ oneline(char *file) fmt_date(msg, w, Iflag || *f == 'D')); break; case 'f': + if (w < 0) + w += wleft; if (w) wleft -= u8putstr(stdout, fmt_from(msg), w, 1); @@ -403,6 +403,8 @@ oneline(char *file) break; case 's': case 'S': + if (w < 0) + w += wleft; if (w) wleft -= u8putstr(stdout, fmt_subject(msg, file, *f == 'S'), w, 1); -- cgit 1.4.1