[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] patch: configure: nonstandard use of `expr'
From: |
Juergen Lock |
Subject: |
Re: [Qemu-devel] patch: configure: nonstandard use of `expr' |
Date: |
Fri, 28 Apr 2006 00:50:52 +0200 (CEST) |
In article <address@hidden> you write:
>Juergen Lock wrote:
>> At least FreeBSD's expr(1) doesnt understand the syntax now used in
>> configure:
>>
>> Index: qemu/configure
>> @@ -157,7 +157,7 @@
>> fi
>>
>> for opt do
>> - optarg=`expr "$opt" : '[^=]*=\(.*\)'`
>> + optarg=`echo "$opt" |sed 's/^[^=]*=//'`
>> case "$opt" in
>> --help|-h) show_help=yes
>> ;;
>
>The GNU Autoconf manual, and its code, recommends something like this
>(note the "x" prefix):
>
> optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
>
>Your echo version suffers from non-portable results when opt matches "-n*",
>"-e*", "-E*", or something with a backslash in.
Oh, indeed. Better version:
Index: qemu/configure
@@ -157,7 +157,7 @@
fi
for opt do
- optarg=`expr "$opt" : '[^=]*=\(.*\)'`
+ optarg=`echo "x$opt" |sed 's/^[^=]*=//'`
case "$opt" in
--help|-h) show_help=yes
;;