[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix for short options.
From: |
Pavel Roskin |
Subject: |
Fix for short options. |
Date: |
Thu, 26 Oct 2000 20:02:13 -0400 (EDT) |
Hello!
I tried to make argument parsing as consistent as possible, but it appears
that sometimes rare constructs are more correct than the widely used ones.
Unfortunately, my patch removed the ability to write an argument after a
short option without a space. I don't know how correct this feature is,
but "autoconf -Wall" is consistent with "gcc -Wall" and "autoconf -o-" is
used in the testsuite (that I should have run before).
If we move the case with $optarg above the case with a separate argument
there will be a problem matching abbreviations:
--autoconf-dir | --a* | -A )
--autoconf-dir=* | --a*=* | -A* )
(--a* will match --auto=dir)
So I think it's better to add a "?" so that "-A?*" doesn't match "-A". I
want to make sure that it's portable (looking at config.guess it appears
to be Ok) and whether it's right way to do it.
Also few further inconsistencies were found while making this patch.
Changelog:
* autoconf.sh: Recognize short options followed by arguments
without separators.
* autoheader.sh: Likewise.
* autoreconf.sh: Likewise. Recognize abbreviations for
"--autoconf-dir" and "--m4dir"
* autoupdate.sh: Likewise. Recognize abbreviations for
"--autoconf-dir"
Regards,
Pavel Roskin
________________________________________
Index: autoconf.sh
--- autoconf.sh Thu Oct 26 18:42:58 2000
+++ autoconf.sh Thu Oct 26 19:54:37 2000
@@ -144,7 +144,7 @@
verbose=echo
shift;;
- --localdir=* | --l*=* )
+ --localdir=* | --l*=* | -l?* )
localdir=$optarg
shift ;;
--localdir | --l* | -l )
@@ -153,7 +153,7 @@
localdir=$1
shift ;;
- --autoconf-dir=* | --a*=* )
+ --autoconf-dir=* | --a*=* | -A?* )
autoconf_dir=$optarg
shift ;;
--autoconf-dir | --a* | -A )
@@ -161,7 +161,7 @@
shift
autoconf_dir=$1
shift ;;
- --macrodir=* | --m*=* )
+ --macrodir=* | --m*=* | -m?* )
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
autoconf_dir=$optarg
shift ;;
@@ -172,7 +172,7 @@
autoconf_dir=$1
shift ;;
- --trace=* | --t*=* )
+ --trace=* | --t*=* | -t?* )
task=trace
traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'"
shift ;;
@@ -186,7 +186,7 @@
initialization=:
shift;;
- --output=* | --o*=* )
+ --output=* | --o*=* | -o?* )
outfile=$optarg
shift ;;
--output | --o* | -o )
@@ -195,7 +195,7 @@
outfile=$1
shift ;;
- --warnings=* | --w*=* )
+ --warnings=* | --w*=* | -W?* )
warnings=$warnings,$optarg
shift ;;
--warnings | --w* | -W )
Index: autoheader.sh
--- autoheader.sh Thu Oct 26 18:28:32 2000
+++ autoheader.sh Thu Oct 26 19:24:49 2000
@@ -115,7 +115,7 @@
verbose=echo
shift;;
- --localdir=* | --l*=* )
+ --localdir=* | --l*=* | -l?* )
localdir=$optarg
shift ;;
--localdir | --l* | -l )
@@ -124,7 +124,7 @@
localdir=$1
shift ;;
- --autoconf-dir=* | --a*=* )
+ --autoconf-dir=* | --a*=* | -A?* )
autoconf_dir=$optarg
shift ;;
--autoconf-dir | --a* | -A )
@@ -132,7 +132,7 @@
shift
autoconf_dir=$1
shift ;;
- --macrodir=* | --m*=* )
+ --macrodir=* | --m*=* | -m?* )
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
autoconf_dir=$optarg
shift ;;
@@ -143,7 +143,7 @@
autoconf_dir=$1
shift ;;
- --warnings=* | --w*=* )
+ --warnings=* | --w*=* | -W?* )
warnings=$warnings,$optarg
shift ;;
--warnings | --w* | -W )
Index: autoreconf.sh
--- autoreconf.sh Thu Oct 26 18:28:32 2000
+++ autoreconf.sh Thu Oct 26 19:55:51 2000
@@ -141,7 +141,7 @@
--debug | --d* | -d )
debug=:; shift ;;
- --localdir=* | --l*=* )
+ --localdir=* | --l*=* | -l?* )
localdir=$optarg
shift ;;
--localdir | --l* | -l )
@@ -150,15 +150,15 @@
localdir=$1
shift ;;
- --autoconf-dir=*)
+ --autoconf-dir=* | --a*=* | -A?* )
autoconf_dir=$optarg
shift ;;
- --autoconf-dir | -A* )
+ --autoconf-dir | --a* | -A )
test $# = 1 && eval "$exit_missing_arg"
shift
autoconf_dir=$1
shift ;;
- --macrodir=* | --m*=* )
+ --macrodir=* | --m*=* | -m?* )
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
autoconf_dir=$optarg
shift ;;
@@ -169,13 +169,13 @@
autoconf_dir=$1
shift ;;
- --m4dir | -M )
+ --m4dir=* | --m4*=* | -M?* )
+ m4dir=$optarg
+ shift ;;
+ --m4dir | --m4* | -M )
test $# = 1 && eval "$exit_missing_arg"
shift
m4dir=$1
- shift ;;
- --m4dir=* | -M* )
- m4dir=$optarg
shift ;;
--force | --forc* | -f )
Index: autoupdate.sh
--- autoupdate.sh Thu Oct 26 18:28:32 2000
+++ autoupdate.sh Thu Oct 26 19:25:29 2000
@@ -125,7 +125,7 @@
verbose=echo
shift;;
- --localdir=* | --l*=* | -l* )
+ --localdir=* | --l*=* | -l?* )
localdir=$optarg
shift ;;
--localdir | --l* | -l )
@@ -134,15 +134,15 @@
localdir=$1
shift ;;
- --autoconf-dir=* | --a*=* )
+ --autoconf-dir=* | --a*=* | -A?* )
autoconf_dir=$optarg
shift ;;
- --autoconf-dir | -A )
+ --autoconf-dir | --a* | -A )
test $# = 1 && eval "$exit_missing_arg"
shift
autoconf_dir=$1
shift ;;
- --macrodir=* | --m*=* )
+ --macrodir=* | --m*=* | -m?* )
echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2
autoconf_dir=$optarg
shift ;;
________________________________________
- Fix for short options.,
Pavel Roskin <=