From 5f9837446472eb2401a24ee989cfc3c9b72d2806 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 22 Jul 2016 16:51:47 +0200 Subject: mseq: -r to strip indentation --- mseq.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'mseq.c') diff --git a/mseq.c b/mseq.c index 3974ec8..6fba5f0 100644 --- a/mseq.c +++ b/mseq.c @@ -6,14 +6,16 @@ #include "blaze822.h" static int nflag; +static int rflag; int main(int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "n")) != -1) + while ((c = getopt(argc, argv, "rn")) != -1) switch(c) { case 'n': nflag = 1; break; + case 'r': rflag = 1; break; default: // XXX usage exit(1); @@ -41,10 +43,15 @@ hack: continue; } while ((f = blaze822_seq_next(map, a, &iter))) { - if (nflag) + if (nflag) { printf("%ld\n", iter.line-1); - else - printf("%s\n", f); + } else { + char *s = f; + if (rflag) + while (*s == ' ' || *s == '\t') + s++; + printf("%s\n", s); + } free(f); } } -- cgit 1.4.1