about summary refs log tree commit diff
path: root/mscan.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-09 21:27:22 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-09 21:27:44 +0200
commit923ef6a51e7ca3787025b7b87e6b2ace19eca8b7 (patch)
treef4815942216379ff5a1376bbf49660d63869df12 /mscan.c
parent4c5a0070309768c422163c81ceccd754c1b94d64 (diff)
downloadmblaze-923ef6a51e7ca3787025b7b87e6b2ace19eca8b7.tar.gz
mblaze-923ef6a51e7ca3787025b7b87e6b2ace19eca8b7.tar.xz
mblaze-923ef6a51e7ca3787025b7b87e6b2ace19eca8b7.zip
mscan: better width for %F
Diffstat (limited to 'mscan.c')
-rw-r--r--mscan.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/mscan.c b/mscan.c
index 6163f24..b2b5cb2 100644
--- 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);