diff options
author | Gaetan Nadon <memsize@videotron.ca> | 2012-01-15 16:57:08 -0500 |
---|---|---|
committer | Gaetan Nadon <memsize@videotron.ca> | 2012-01-18 19:51:05 -0500 |
commit | 6ec539d4bb660590bcff89e8f7c597737d55e763 (patch) | |
tree | 70f55156456981a2e0bb99c2e7af02bd5cd799a2 | |
parent | 20e557f9a073dfbffd06d7e76d1e33ecab221418 (diff) |
build.sh: replace expr substr function with colon operator
Not all "expr" implementations have a "substr" string argument.
"According to the POSIX standard, the use of string arguments length,
substr, index, or match produces undefined results."
http://www.freebsd.org/cgi/man.cgi?query=expr&apropos=0&sektion=0&manpath=
FreeBSD+9.0-RELEASE&arch=default&format=html
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-rwxr-xr-x | build.sh | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -80,12 +80,14 @@ setup_buildenv() { # Support previous usage of LIBDIR which was a subdir relative to PREFIX # We use EPREFIX as this is what PREFIX really meant at the time - if [ X"`expr substr $LIBDIR 1 1`" != X/ ]; then - echo "" - echo "Warning: this usage of \$LIBDIR is deprecated. Use a full path name." - echo "The supplied value \"$LIBDIR\" has been replaced with $EPREFIX/$LIBDIR." - echo "" - LIBDIR=$EPREFIX/$LIBDIR + if [ X"$LIBDIR" != X ]; then + if [ X"`expr $LIBDIR : "\(.\)"`" != X/ ]; then + echo "" + echo "Warning: this usage of \$LIBDIR is deprecated. Use a full path name." + echo "The supplied value \"$LIBDIR\" has been replaced with $EPREFIX/$LIBDIR." + echo "" + LIBDIR=$EPREFIX/$LIBDIR + fi fi # All directories variables must be full path names @@ -1055,7 +1057,7 @@ usage() { check_full_path () { path=$1 varname=$2 - if [ X"`expr substr $path 1 1`" != X/ ]; then + if [ X"`expr $path : "\(.\)"`" != X/ ]; then echo "The path \"$path\" supplied by \"$varname\" must be a full path name" echo "" usage |