summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorivo <ivo@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-31 14:48:13 +0000
committerivo <ivo@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-31 14:48:13 +0000
commitc9be32501bd2da02e41ef92ec2db84c9c7e1c081 (patch)
tree424aaa82eb4b46bfd8ca7617095486277dae6005 /TOOLS
parentbbc21b2104e232fdf739cb6e775041500450ddc6 (diff)
downloadmpv-c9be32501bd2da02e41ef92ec2db84c9c7e1c081.tar.bz2
mpv-c9be32501bd2da02e41ef92ec2db84c9c7e1c081.tar.xz
Much smaller command line parser
This removes all code duplication for setting and unsetting -(no)flags specified on the command line git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23968 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/checktree.sh111
1 files changed, 21 insertions, 90 deletions
diff --git a/TOOLS/checktree.sh b/TOOLS/checktree.sh
index 3f094ae6c7..2329a1f8d0 100755
--- a/TOOLS/checktree.sh
+++ b/TOOLS/checktree.sh
@@ -27,6 +27,12 @@
# -----------------------------------------------------------------------------
+# All yes/no flags. Spaces around flagnames are important!
+
+testflags=" spaces extensions crlf tabs trailws rcsid oll charset stupid gnu \
+res "
+allflags="$testflags showcont color head svn "
+
# Default settings
_spaces=yes
@@ -141,78 +147,6 @@ for i in "$@"; do
echo -e "If there are, -(no)svn has no effect.\n"
exit
;;
- -stupid)
- _stupid=yes
- ;;
- -nostupid)
- _stupid=no
- ;;
- -charset)
- _charset=yes
- ;;
- -nocharset)
- _charset=no
- ;;
- -oll)
- _oll=yes
- ;;
- -nooll)
- _oll=no
- ;;
- -svn)
- _svn=yes
- ;;
- -nosvn)
- _svn=no
- ;;
- -head)
- _head=yes
- ;;
- -nohead)
- _head=no
- ;;
- -color)
- _color=yes
- ;;
- -nocolor)
- _color=no
- ;;
- -spaces)
- _spaces=yes
- ;;
- -nospaces)
- _spaces=no
- ;;
- -extensions)
- _extensions=yes
- ;;
- -noextensions)
- _extensions=no
- ;;
- -crlf)
- _crlf=yes
- ;;
- -nocrlf)
- _crlf=no
- ;;
- -tabs)
- _tabs=yes
- ;;
- -notabs)
- _tabs=no
- ;;
- -trailws)
- _trailws=yes
- ;;
- -notrailws)
- _trailws=no
- ;;
- -rcsid)
- _rcsid=yes
- ;;
- -norcsid)
- _rcsid=no
- ;;
-all)
enable_all_tests
;;
@@ -222,28 +156,25 @@ for i in "$@"; do
-none)
disable_all_tests
;;
- -showcont)
- _showcont=yes
- ;;
- -noshowcont)
- _showcont=no
- ;;
- -gnu)
- _gnu=yes
- ;;
- -nognu)
- _gnu=no
- ;;
- -res)
- _res=yes
- ;;
- -nores)
- _res=no
- ;;
-*)
+ var=`echo X$i | sed 's/^X-//'`
+ val=yes
+ case "$var" in
+ no*)
+ var=`echo "$var" | cut -c 3-`
+ val=no
+ ;;
+ esac
+ case "$allflags" in
+ *\ $var\ *)
+ eval _$var=$val
+ ;;
+ *)
echo "unknown option: $i" >&2
exit 0
;;
+ esac
+ ;;
*)
_files="$_files $i"
;;