about summary refs log tree commit diff
path: root/mscan.c
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 /mscan.c
parente34e3dc9ea6a1e24960a084d2137e5e7c450e2dd (diff)
downloadmblaze-2ad6ae80d8512c985fd613e5340c472582225dcd.tar.gz
mblaze-2ad6ae80d8512c985fd613e5340c472582225dcd.tar.xz
mblaze-2ad6ae80d8512c985fd613e5340c472582225dcd.zip
mscan: make negative width in %f, %s mean "rest minus N"
Diffstat (limited to 'mscan.c')
-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);