+Option -c: clean
authorlace <>
Tue, 29 Jan 2008 19:38:54 +0000 (19:38 +0000)
committerlace <>
Tue, 29 Jan 2008 19:38:54 +0000 (19:38 +0000)
bin/gdbunpack

index 561e3f8..73fed1a 100755 (executable)
@@ -7,15 +7,27 @@ if [ "$1" = "-f" ];then
        force=true
        shift
 fi
-for log in "$@";do
+clean=false
+if [ "$1" = "-c" ];then
+       clean=true
+       shift
+fi
+args="$*"
+if [ -z "$args" ];then
+       args="`find -name "*.log"`"
+fi
+for log in $args;do
        base="${log%.log}"
        if [ "$base" = "$log" -o "$log" != "${log%/gdb.log}" -o "$log" = "gdb.log" ];then
                echo >&2 "file has no .log suffix or is gdb.log: $log"
                continue
        fi
-       if $force && test -d "$base";then
+       if ($force || $clean) && test -d "$base";then
                rm -rf "$base"
        fi
+       if $clean;then
+               continue
+       fi
        if ! mkdir "$base";then
                echo >&2 "Error <$log>: mkdir"
                exit 1