diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-22 16:51:47 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2016-07-22 16:51:47 +0200 |
commit | 5f9837446472eb2401a24ee989cfc3c9b72d2806 (patch) | |
tree | 4961185d7f03644f488b8041a37238702c577361 /mseq.c | |
parent | 98456df2cf775ab630d77e6bc9cae157333da6c4 (diff) | |
download | mblaze-5f9837446472eb2401a24ee989cfc3c9b72d2806.tar.gz mblaze-5f9837446472eb2401a24ee989cfc3c9b72d2806.tar.xz mblaze-5f9837446472eb2401a24ee989cfc3c9b72d2806.zip |
mseq: -r to strip indentation
Diffstat (limited to 'mseq.c')
-rw-r--r-- | mseq.c | 15 |
1 files changed, 11 insertions, 4 deletions
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); } } |