diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-13 16:47:24 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-13 16:47:24 +0200 |
commit | d3080b92d3d010567945550831514f130e6c8c2d (patch) | |
tree | bca51aca30782d0049614bca26f63b29f0df8513 | |
parent | 797ddf96dc0864cf8895fdc827f5a2385d1acc4a (diff) | |
download | mblaze-d3080b92d3d010567945550831514f130e6c8c2d.tar.gz mblaze-d3080b92d3d010567945550831514f130e6c8c2d.tar.xz mblaze-d3080b92d3d010567945550831514f130e6c8c2d.zip |
scan: print line number
-rw-r--r-- | scan.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scan.c b/scan.c index 5da4e02..97eadfb 100644 --- a/scan.c +++ b/scan.c @@ -30,9 +30,13 @@ u8putstr(FILE *out, char *s, size_t l, int pad) putc(' ', out); } +long lineno; + int oneline(char *file) { + lineno++; + int indent = 0; while (*file == ' ') { indent++; @@ -42,8 +46,8 @@ oneline(char *file) struct message *msg = blaze822(file); if (!msg) { - int p = 80-33-3-indent; - printf("%*.*s\\_ %*.*s\n", -33 - indent, 33 + indent, "", + int p = 80-38-3-indent; + printf("%*.*s\\_ %*.*s\n", -38 - indent, 38 + indent, "", -p, p, file); return 0; } @@ -110,13 +114,13 @@ oneline(char *file) } blaze822_decode_rfc2047(subjdec, subj, sizeof subjdec - 1, "UTF-8"); - printf("%c%c%-10s ", flag1, flag2, date); + printf("%c%c %-3d %-10s ", flag1, flag2, lineno, date); u8putstr(stdout, fromdec, 17, 1); printf(" "); int z; for (z = 0; z < indent; z++) printf(" "); - u8putstr(stdout, subjdec, 80-33-indent, 0); + u8putstr(stdout, subjdec, 80-38-indent, 0); printf("\n"); } |