ossp-pkg/shtool/sh.common 1.18 -> 1.19
--- sh.common 2001/06/14 19:02:54 1.18
+++ sh.common 2001/09/23 10:58:10 1.19
@@ -45,6 +45,10 @@
eval `echo h.$opt_spec |\
sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
+# parse option alias string
+eval `echo h:help,$opt_alias |\
+ tr 'x-' 'x_' | sed -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
+
# interate over argument line
opt_PREV=''
while [ $# -gt 0 ]; do
@@ -65,6 +69,18 @@
else
# split argument into option and argument
case "$1" in
+ --[a-zA-Z0-9]*=*)
+ eval `echo "x$1" |\
+ sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
+ opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
+ eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
+ ;;
+ --[a-zA-Z0-9]*)
+ opt_OPT=`echo "x$1" | cut -c4-`
+ opt_STR=`echo $opt_OPT | tr 'x-' 'x_'`
+ eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
+ opt_ARG=''
+ ;;
-[a-zA-Z0-9]*)
eval `echo "x$1" |\
sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
@@ -107,14 +123,14 @@
eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\""
;;
* )
- echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
+ echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2
echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
exit 1
;;
esac
done
if [ ".$opt_PREV" != . ]; then
- echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
+ echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2
echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
exit 1
fi
|
|