mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 91749bf3b421cebc1c36ac229792bdca168db905
parent 06c9f23365611e19a31205d3e480ab29d4b481dd
Author: Duncaen <mail@duncano.de>
Date:   Sun, 25 Jun 2017 00:11:06 +0200

mseq: remove the ,2: suffix from the file we search for and add testcase

This fixes #38

Diffstat:
mseq.c | 16+++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/mseq.c b/mseq.c @@ -2,9 +2,9 @@ #include <errno.h> #include <limits.h> #include <search.h> +#include <string.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <unistd.h> #include "blaze822.h" @@ -29,6 +29,7 @@ nameorder(const void *a, const void *b) struct name *ia = (struct name *)a; struct name *ib = (struct name *)b; + fprintf(stderr, "# >> %s == %s\n", ia->id, ib->id); return strcmp(ia->id, ib->id); } @@ -98,7 +99,6 @@ search(char *file) if ((e = strstr(file, ":2,"))) *e = 0; - return namefind(file); } @@ -151,7 +151,7 @@ fix(FILE *out, char *file) return 0; ok: - while (i--) + while(i--) putc(' ', out); fprintf(out, "%s\n", bufptr); return 1; @@ -251,9 +251,6 @@ stdinmode() void overridecur(char *file) { - static int once = 0; - if (once++) - return; while (*file == ' ') file++; setenv("MAILDOT", file, 1); @@ -262,9 +259,6 @@ overridecur(char *file) void setcur(char *file) { - static int once = 0; - if (once++) - return; while (*file == ' ') file++; unsetenv("MAILDOT"); @@ -276,7 +270,7 @@ main(int argc, char *argv[]) { int c; while ((c = getopt(argc, argv, "c:frAC:S")) != -1) - switch (c) { + switch(c) { case 'c': cflag = optarg; break; case 'f': fflag = 1; break; case 'r': rflag = 1; break; @@ -284,7 +278,7 @@ main(int argc, char *argv[]) case 'C': Cflag = optarg; break; case 'S': Sflag = 1; break; default: -usage: + usage: fprintf(stderr, "Usage: mseq [-fr] [-c msg] [msgs...]\n" " mseq -S [-fr] < sequence\n"