]> git.mxchange.org Git - flightgear.git/commitdiff
- more efficient filter routine
authormfranz <mfranz>
Sun, 11 Mar 2007 19:30:36 +0000 (19:30 +0000)
committermfranz <mfranz>
Sun, 11 Mar 2007 19:30:36 +0000 (19:30 +0000)
- fix wrong log message
- cleanup & cosmetics, as always

scripts/tools/fg-check
scripts/tools/fg-submit

index 138d7585aa52256b2924d97380b162ec3ca76d9b..38fb89925ef9c6cbd6a3d5c350f2827e1daa49dc 100755 (executable)
@@ -4,7 +4,7 @@
 # Meant to be executed before submitting/committing.
 
 
-SELF=${0/#*\/}
+SELF=${0##*/}
 
 # optional apps
 RLE=$(which rle &>/dev/null)              # http://members.aon.at/mfranz/rle.tar.gz (depends on Qt lib)
@@ -27,8 +27,8 @@ find .|grep " "|while read i; do RESULT "$i"; done
 LOG "checking for upper-case extensions ..."
 find .|while read i; do
        case "$i" in .|..|CVS/*|*/CVS/*|*.Opt|*.README|*.Po|*.TXT) continue ;; esac
-       base=${i/#.*\/}
-       ext=${base/#*./}
+       base=${i##*/}
+       ext=${base##*.}
        [ "$base" == "$ext" ] && continue          # has no extension
        ext=${ext//[^a-zA-Z]/}
        [ "$ext" ] || continue                     # only non-letters
index e768a13ba947ad4d446eb541c70ec3a59ca65627..1b894ef45569004bb2c94adc74921539cf36e888 100755 (executable)
@@ -28,7 +28,7 @@
 # to have the date in the archive name can conveniently achieve this
 # by defining a shell alias in ~/.bashrc:
 #
-#     alias submit='fg-submit "${PWD/#*\/}-$(date +%Y-%m-%d)"'
+#     alias submit='fg-submit "${PWD##*/}-$(date +%Y-%m-%d)"'
 #
 #
 #
 
 
 
-SELF=${0/#*\/}
-DIR=${PWD/#*\/}
+SELF=${0##*/}
+DIR=${PWD##*/}
 
 if [ "$1" == "-v" ]; then
        DBG=1
@@ -230,16 +230,16 @@ function search_config {
 }
 
 
-set -f
 RULES=
+set -f
 if search_config "$PWD"; then
        LOG "loading config file $CONFIG"
        source "$CONFIG"
 elif [ -f ~/$CONFIG_FILE ]; then
-       DEBUG "loading config file $CONFIG"
+       DEBUG "loading config file ~/$CONFIG_FILE"
        source ~/$CONFIG_FILE
 elif [ -f ~/${CONFIG_FILE}rc ]; then
-       DEBUG "loading config file $CONFIG"
+       DEBUG "loading config file ~/${CONFIG}rc"
        source ~/${CONFIG_FILE}rc
 fi
 set +f
@@ -319,20 +319,14 @@ if [ -f $TMP/check ]; then
                DEBUG "checking whether file '$i' matches"
                for r in $RULES; do
                        DEBUG "\t\trule $r"
-                       rule=${r#?}
-                       case "!$i" in $r)
-                               DEBUG "\t\t\t\"silently\" rejected\t\t$rule"
-                               break
-                               ;;
-                       esac
-                       case "-$i" in $r)
-                               REJECT "$i\t\t$rule"
-                               break
-                               ;;
-                       esac
-                       case "+$i" in $r)
-                               NEW "$i\t\t$rule"
-                               echo "$i" >>$TMP/files
+                       class=${r:0:1}
+                       rule=${r:1}
+                       case "$i" in $rule)
+                               case $class in
+                               !) DEBUG "$i\t\t\"silently\" rejected\t\t$rule" ;;
+                               -) REJECT "$i\t\t$rule" ;;
+                               +) NEW "$i\t\t$rule" && echo "$i" >>$TMP/files ;;
+                               esac
                                break
                                ;;
                        esac