diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-08-04 19:39:01 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-08-04 19:39:01 +0200 |
commit | e97bf25a4e16baa46e91d74d76aabdaf8abe4ad5 (patch) | |
tree | 5794edb1d4ba3b88f9ec3bde062496a05326fbe9 /mscan.c | |
parent | 3f1fb14ecd0ef14e0bb3cd6a4a119c2b7ccf0038 (diff) | |
download | mblaze-e97bf25a4e16baa46e91d74d76aabdaf8abe4ad5.tar.gz mblaze-e97bf25a4e16baa46e91d74d76aabdaf8abe4ad5.tar.xz mblaze-e97bf25a4e16baa46e91d74d76aabdaf8abe4ad5.zip |
mscan: look up message number when needed
Diffstat (limited to 'mscan.c')
-rw-r--r-- | mscan.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mscan.c b/mscan.c index 4994a04..c84ec6f 100644 --- a/mscan.c +++ b/mscan.c @@ -242,7 +242,6 @@ oneline(char *file) struct message *msg = blaze822(file); char *flags = msg ? strstr(file, ":2,") : ""; - long lineno = msg ? blaze822_seq_find(file) : 0; int wleft = cols; @@ -320,11 +319,15 @@ oneline(char *file) wleft -= printf("%.*s", w, flags); break; case 'n': - if (lineno) - printf("%*ld", w, lineno); - else - printf("%*s", w, ""); - wleft -= w > 0 ? w : -w; + { + long lineno = msg ? blaze822_seq_find(file) : 0; + + if (lineno) + printf("%*ld", w, lineno); + else + printf("%*s", w, ""); + wleft -= w > 0 ? w : -w; + } break; case 'd': case 'D': |