From 7e17d9d631f9d47e9a03901c97a54649cd3542eb Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Sun, 17 Jul 2016 21:52:04 +0200 Subject: [PATCH] scan: look up mails in map instead of line numbers --- Makefile | 2 +- scan.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 6760978..c23e443 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ ALL = scan thread hdr show list unmime mseq all: $(ALL) -scan: blaze822.o scan.o rfc2047.o +scan: blaze822.o scan.o seq.o rfc2047.o thread: blaze822.o thread.o hdr: blaze822.o hdr.o rfc2047.o show: blaze822.o show.o rfc2045.o rfc2047.c diff --git a/scan.c b/scan.c index 3da54fe..d370f14 100644 --- a/scan.c +++ b/scan.c @@ -30,13 +30,9 @@ u8putstr(FILE *out, char *s, size_t l, int pad) putc(' ', out); } -long lineno; - void oneline(char *file) { - lineno++; - int indent = 0; while (*file == ' ' || *file == '\t') { indent++; @@ -117,7 +113,11 @@ oneline(char *file) } blaze822_decode_rfc2047(subjdec, subj, sizeof subjdec - 1, "UTF-8"); - printf("%c%c %-3ld %-10s ", flag1, flag2, lineno, date); + long lineno = blaze822_seq_find(file); + if (lineno) + printf("%c%c %-3ld %-10s ", flag1, flag2, lineno, date); + else + printf("%c%c %-10s ", flag1, flag2, date); u8putstr(stdout, fromdec, 17, 1); printf(" "); int z; @@ -132,6 +132,9 @@ oneline(char *file) int main(int argc, char *argv[]) { + char *seqmap = blaze822_seq_open(0); + blaze822_seq_load(seqmap); + int i = blaze822_loop(argc-1, argv+1, oneline); printf("%d mails scanned\n", i);