]> thyrsus.com Git - comparator.git/commitdiff
Bring back -d option.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 30 Aug 2003 06:55:50 +0000 (06:55 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 30 Aug 2003 06:55:50 +0000 (06:55 +0000)
shredtree.c
shredtree.py

index d845fda4d6f398212b6c16b468af982fd193a56c..dd5faa3491af82a8b42eeb9dc1b3a99415b6a3f6 100644 (file)
@@ -197,7 +197,7 @@ main(int argc, char *argv[])
            break;
 
        case 'd':
-           debug = 1;
+           chdir(optarg);
            break;
 
        case 's':
@@ -208,12 +208,17 @@ main(int argc, char *argv[])
            rws = 1;
            break;
 
+       case 'x':
+           debug = 1;
+           break;
+
        case 'h':
        default:
-           fprintf(stderr,"usage: shredtree [-c] [-s shredsize] [-w] path\n");
+           fprintf(stderr,"usage: shredtree [-c] [-d dir ] [-s shredsize] [-w] [-x] path\n");
            fprintf(stderr,"  -c      = check .c, .h, and .txt files only.\n");
-           fprintf(stderr,"  -d      = debug, display chunks in output.\n");
+           fprintf(stderr,"  -d dir  = change directory before digesting.\n");
            fprintf(stderr,"  -h      = help (display this message).\n");
+           fprintf(stderr,"  -x      = debug, display chunks in output.\n");
            fprintf(stderr,"  -s size = set shred size (default %d)\n",
                    shredsize);
            fprintf(stderr,"  -w      = remove whitespace.\n");
index fe87f7c752f8010239a3b86db1b783f6e996f92a..a882bd760877ca0d62ec716836aba645c1d5cf3a 100755 (executable)
@@ -67,9 +67,9 @@ def shredfile(file):
 
 if __name__ == '__main__':
     try:
-        (optlist, args) = getopt.getopt(sys.argv[1:], 'cdhs:w')
+        (optlist, args) = getopt.getopt(sys.argv[1:], 'cd:hs:wx')
     except getopt.GetoptError:
-        sys.stderr.write("usage: shredtree [-c] [-d] [-w] [-s shredsize] tree\n")
+        sys.stderr.write("usage: shredtree [-c] [-d dir] [-w] [-s shredsize] tree\n")
         sys.exit(2)
     shredsize = 5
     ws = debug = c_only = False
@@ -77,20 +77,23 @@ if __name__ == '__main__':
         if opt == '-c':
             c_only = True
         elif opt == '-d':
-            debug = True
+            os.chdir(optarg);
         elif opt == '-h':
            sys.stderr.write("usage: shredtree [-c] [-s size] [-w] path\n");
            sys.stderr.write(" -c      = do .c, .h, and .txt files only.\n");
-           sys.stderr.write(" -d      = debug, display chunks in output.\n");
+            sys.stderr.write(" -d      = go to directory before digesting\n");
            sys.stderr.write(" -h      = help (display this message).\n");
            sys.stderr.write(" -s size = set shred size (default %d)\n",
                    shredsize);
            sys.stderr.write(" -w      = remove whitespace.\n");
+           sys.stderr.write(" -x      = debug, display chunks in output.\n");
            sys.exit(0);
         elif opt == '-s':
             shredsize = int(val)
         elif opt == '-w':
             ws = True
+        elif opt == '-d':
+            debug = True
     if args:
         print "#SHIF-A 1.0"
         print "Generator-Program: shredtree.py 1.0"