From: mfranz Date: Sun, 11 Mar 2007 19:30:36 +0000 (+0000) Subject: - more efficient filter routine X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=962e61903a16dd900a36398a9cd8f1e331be5531;p=flightgear.git - more efficient filter routine - fix wrong log message - cleanup & cosmetics, as always --- diff --git a/scripts/tools/fg-check b/scripts/tools/fg-check index 138d7585a..38fb89925 100755 --- a/scripts/tools/fg-check +++ b/scripts/tools/fg-check @@ -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 diff --git a/scripts/tools/fg-submit b/scripts/tools/fg-submit index e768a13ba..1b894ef45 100755 --- a/scripts/tools/fg-submit +++ b/scripts/tools/fg-submit @@ -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)"' # # # @@ -112,8 +112,8 @@ -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