aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-10 18:00:51 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-10 18:00:51 +0200
commit2ad6ae80d8512c985fd613e5340c472582225dcd (patch)
treec240760d49f884efdeb39758424cfc011cc5b5cc
parente34e3dc9ea6a1e24960a084d2137e5e7c450e2dd (diff)
downloadmblaze-2ad6ae80d8512c985fd613e5340c472582225dcd.tar.gz
mscan: make negative width in %f, %s mean "rest minus N"
-rw-r--r--mscan.c6
1 files changed, 4 insertions, 2 deletions
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);