autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Autoconf] Autoupdate and expr [Was: Autoupdate test failing on Solaris7


From: Akim Demaille
Subject: [Autoconf] Autoupdate and expr [Was: Autoupdate test failing on Solaris7]
Date: 19 Sep 2000 14:43:39 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

| On Sep 13, 2000, Bernard Dautrevaux <address@hidden> wrote:
| > $ echo `expr "-" : '-[^=]*=\(.*\)'`
| > expr: syntax error
| 
| > However the patch sent correct this anyway :-)
| 
| Nope, `echo' is also subject to `-' problems.
| 
| The right fix is one of:
| 
| option=`expr "x$1" : 'x-[^=]=\(.*\)'`
| 
| or
| 
| option=`echo "x$1" | sed -e '1s/^x//' -e 's/^-[^=]*=//'`
| 
| The former is slightly better in handling of backslashes, but the
| second wouldn't fail for command-line arguments that are too long,
| when using implementations of `expr' that fail if the matched string
| is longer 128 bytes or longer.

Sorry for the delays.  I chose the `expr' one.  Here is what I am
committing now:

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * autoconf.sh (optarg): More robust expr invocation.
        * autoreconf.sh: Likewise.
        * autoupdate.sh: Likewise.
        * autoheader.sh: Likewise.
        Reported by Bernard Dautrevaux.

Index: autoconf.sh
===================================================================
RCS file: /cvs/autoconf/autoconf.sh,v
retrieving revision 1.88
diff -u -r1.88 autoconf.sh
--- autoconf.sh 2000/09/11 07:16:34 1.88
+++ autoconf.sh 2000/09/19 12:30:37
@@ -125,8 +125,8 @@
 
 # Parse command line.
 while test $# -gt 0 ; do
-  optarg=`expr "$1" : '--[^=]*=\(.*\)' \| \
-               "$1" : '-.\(.*\)'`
+  optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
+               "x$1" : 'x-.\(.*\)'`
   case $1 in
     --version | --vers* | -V )
        echo "$version" ; exit 0 ;;
Index: autoheader.sh
===================================================================
RCS file: /cvs/autoconf/autoheader.sh,v
retrieving revision 1.79
diff -u -r1.79 autoheader.sh
--- autoheader.sh 2000/08/01 13:59:51 1.79
+++ autoheader.sh 2000/09/19 12:30:38
@@ -96,8 +96,8 @@
 
 # Parse command line.
 while test $# -gt 0 ; do
-  optarg=`expr "$1" : '--[^=]*=\(.*\)' \| \
-               "$1" : '-.\(.*\)'`
+  optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
+               "x$1" : 'x-.\(.*\)'`
   case $1 in
     --version | --vers* | -V )
        echo "$version" ; exit 0 ;;
Index: autoreconf.sh
===================================================================
RCS file: /cvs/autoconf/autoreconf.sh,v
retrieving revision 1.50
diff -u -r1.50 autoreconf.sh
--- autoreconf.sh 2000/08/09 09:56:30 1.50
+++ autoreconf.sh 2000/09/19 12:30:38
@@ -128,7 +128,8 @@
 
 # Parse command line.
 while test $# -gt 0; do
-  optarg=`expr "$1" : '-[^=]*=\(.*\)'`
+  optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
+               "x$1" : 'x-.\(.*\)'`
   case "$1" in
     --version | --vers* | -V )
        echo "$version" ; exit 0 ;;
@@ -150,22 +151,22 @@
        localdir=$1
        shift ;;
 
-    --macrodir=* )
-       autoconf_dir=$optarg
-       shift ;;
     --macrodir | -m )
        test $# = 1 && eval "$exit_missing_arg"
        shift
        autoconf_dir=$1
        shift ;;
-
-    --m4dir=* )
-       m4dir=$optarg
+    --macrodir=* | -m* )
+       autoconf_dir=$optarg
        shift ;;
+
     --m4dir | -M )
        test $# = 1 && eval "$exit_missing_arg"
        shift
        m4dir=$1
+       shift ;;
+    --m4dir=* | -M* )
+       m4dir=$optarg
        shift ;;
 
      --force | -f )
Index: autoupdate.sh
===================================================================
RCS file: /cvs/autoconf/autoupdate.sh,v
retrieving revision 1.29
diff -u -r1.29 autoupdate.sh
--- autoupdate.sh 2000/09/12 12:41:32 1.29
+++ autoupdate.sh 2000/09/19 12:30:38
@@ -110,7 +110,8 @@
 
 # Parse command line
 while test $# -gt 0 ; do
-  optarg=`expr "$1" : '-[^=]*=\(.*\)'`
+  optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \
+               "x$1" : 'x-.\(.*\)'`
   case $1 in
     --version | --vers* | -V )
        echo "$version" ; exit 0 ;;
@@ -123,32 +124,32 @@
        verbose=echo
        shift;;
 
-    --localdir=* | --l*=* )
-       localdir=`echo "$1" | sed 's/^[^=]*=//'`
-       shift ;;
     --localdir | --l* | -l )
        test $# = 1 && eval "$exit_missing_arg"
        shift
        localdir=$1
        shift ;;
-
-    --autoconf-dir=*)
-      autoconf_dir=$optarg
+    --localdir=* | --l*=* | -l* )
+       localdir=$optarg
        shift ;;
-    --autoconf-dir | -A* )
+
+    --autoconf-dir | -A )
        test $# = 1 && eval "$exit_missing_arg"
        shift
        autoconf_dir=$1
        shift ;;
-    --macrodir=* | --m*=* )
-       echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&1
-       autoconf_dir=$optarg
+    --autoconf-dir=* | -A* )
+      autoconf_dir=$optarg
        shift ;;
     --macrodir | --m* | -m )
        echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&1
        test $# = 1 && eval "$exit_missing_arg"
        shift
        autoconf_dir=$1
+       shift ;;
+    --macrodir=* | --m*=*  | -m*)
+       echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&1
+       autoconf_dir=$optarg
        shift ;;
 
     -- )


reply via email to

[Prev in Thread] Current Thread [Next in Thread]