From e97bf25a4e16baa46e91d74d76aabdaf8abe4ad5 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Thu, 4 Aug 2016 19:39:01 +0200 Subject: mscan: look up message number when needed --- mscan.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'mscan.c') 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': -- cgit 1.4.1