summary refs log tree commit diff
path: root/mscan.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-04 19:12:20 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-04 19:12:20 +0200
commit26f694c91d04edeb374a53fad60d63a87c0bf065 (patch)
tree716e884d33b634671196ee37d83dc2d9d6e0f508 /mscan.c
parentf628a10ff6c8e359036984c0a37a9cd1d3784914 (diff)
downloadmblaze-26f694c91d04edeb374a53fad60d63a87c0bf065.tar.gz
mblaze-26f694c91d04edeb374a53fad60d63a87c0bf065.tar.xz
mblaze-26f694c91d04edeb374a53fad60d63a87c0bf065.zip
mscan: support \n and \t
Diffstat (limited to 'mscan.c')
-rw-r--r--mscan.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/mscan.c b/mscan.c
index 4023910..bf93d05 100644
--- a/mscan.c
+++ b/mscan.c
@@ -248,6 +248,7 @@ oneline(char *file)
 nomsg:
 		flag1 = flag2 = flag3 = ' ';
 		*fromdec = 0;
+		flags = "";
 		snprintf(subjdec, sizeof subjdec, "\\_ %s", file);
 		lineno = 0;
 	}
@@ -256,6 +257,17 @@ nomsg:
 
 	char *f;
 	for (f = fflag; *f; f++) {
+		if (*f == '\\') {
+			f++;
+			switch (*f) {
+			case 'n': putchar('\n'); wleft = cols; break;
+			case 't': putchar('\t'); wleft -= (8 - wleft % 8); break;
+			default:
+				putchar('\\'); wleft--;
+				putchar(*f); wleft--;
+			}
+			continue;
+		}
 		if (*f != '%') {
 			putchar(*f);
 			wleft--;
@@ -277,7 +289,7 @@ nomsg:
 		if (!*f)
 			break;
 
-		switch(*f) {
+		switch (*f) {
 		case '%':
 			putchar('%');
 			wleft--;