From af9e32ecf836906f8c817dccaa7ea171ad404587 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 20 Jul 2016 23:22:59 +0200 Subject: mscan: delay loading of map until first line is read --- mscan.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mscan.c') diff --git a/mscan.c b/mscan.c index 7a94c55..8093f7f 100644 --- a/mscan.c +++ b/mscan.c @@ -50,6 +50,16 @@ u8putstr(FILE *out, char *s, size_t l, int pad) void oneline(char *file) { + static int init; + if (!init) { + // delay loading of the seqmap until we need to scan the first + // file, in case someone in the pipe updated the map before + char *seqmap = blaze822_seq_open(0); + blaze822_seq_load(seqmap); + cur = blaze822_seq_cur(); + init = 1; + } + int indent = 0; while (*file == ' ' || *file == '\t') { indent++; @@ -168,10 +178,6 @@ main(int argc, char *argv[]) if (cols <= 40) cols = 80; - char *seqmap = blaze822_seq_open(0); - blaze822_seq_load(seqmap); - cur = blaze822_seq_cur(); - long i; if (argc == 1 && isatty(0)) { char *all[] = { ":" }; -- cgit 1.4.1