Check-in Number:
|
3525 | |
Date: |
2003-Aug-13 16:20:34 (local)
2003-Aug-13 14:20:34 (UTC) |
User: | rse |
Branch: | |
Comment: |
Replace "[ x -o/-a x ]" constructs with "[ x ] ||/&& [ x ]"
and "egrep"/"fgrep" constructs with compatible "grep" or "case"
constructs. This way GNU shtool is now more POSIX 1003.1-2001
compliant.
Submitted by: Paul Eggert <eggert@twinsun.com> |
Tickets: |
|
Inspections: |
|
Files: |
ossp-pkg/shtool/ChangeLog
|
1.188
->
1.189
|
 
6 inserted, 0 deleted
|
ossp-pkg/shtool/THANKS
|
1.30
->
1.31
|
 
1 inserted, 0 deleted
|
ossp-pkg/shtool/sh.common
|
1.20
->
1.21
|
 
2 inserted, 2 deleted
|
ossp-pkg/shtool/sh.echo
|
1.35
->
1.36
|
 
19 inserted, 19 deleted
|
ossp-pkg/shtool/sh.install
|
1.28
->
1.29
|
 
1 inserted, 1 deleted
|
ossp-pkg/shtool/sh.mkdir
|
1.21
->
1.22
|
 
1 inserted, 1 deleted
|
ossp-pkg/shtool/sh.mkln
|
1.15
->
1.16
|
 
8 inserted, 3 deleted
|
ossp-pkg/shtool/sh.move
|
1.17
->
1.18
|
 
1 inserted, 1 deleted
|
ossp-pkg/shtool/sh.path
|
1.24
->
1.25
|
 
5 inserted, 5 deleted
|
ossp-pkg/shtool/sh.rotate
|
1.7
->
1.8
|
 
4 inserted, 4 deleted
|
ossp-pkg/shtool/sh.slo
|
1.21
->
1.22
|
 
9 inserted, 7 deleted
|
ossp-pkg/shtool/sh.subst
|
1.8
->
1.9
|
 
2 inserted, 2 deleted
|
ossp-pkg/shtool/sh.tarball
|
1.18
->
1.19
|
 
1 inserted, 1 deleted
|
ossp-pkg/shtool/shtoolize.in
|
1.30
->
1.31
|
 
4 inserted, 4 deleted
|
|
ossp-pkg/shtool/ChangeLog 1.188 -> 1.189
--- ChangeLog 2003/06/03 08:28:19 1.188
+++ ChangeLog 2003/08/13 14:20:34 1.189
@@ -11,6 +11,12 @@
Changes between 1.6.2 and 2.0b0 (02-Nov-2002 to xx-May-2003):
+ *) Replace "[ x -o/-a x ]" constructs with "[ x ] ||/&& [ x ]"
+ and "egrep"/"fgrep" constructs with compatible "grep" or "case"
+ constructs. This way GNU shtool is now more POSIX 1003.1-2001
+ compliant.
+ [Paul Eggert <eggert@twinsun.com>]
+
*) Make sure "shtool install -e ..." does not fail with "permission
denied" on the internally created temporary files if the source
file is not writeable to the current user. This occurs because
|
|
ossp-pkg/shtool/THANKS 1.30 -> 1.31
--- THANKS 2003/05/09 09:51:19 1.30
+++ THANKS 2003/08/13 14:20:34 1.31
@@ -15,6 +15,7 @@
o Denis Barbier <barbier@imacs.polytechnique.fr>
o Marcus Boerger <marcus.boerger@t-online.de>
o Bill Campbell <bill@celestial.com>
+ o Paul Eggert <eggert@twinsun.com>
o Alan Eldridge <alane@geeksrus.net>
o Michael van Elst <mlelstv@serpens.de>
o Scott R. Every <scott@emji.net>
|
|
ossp-pkg/shtool/sh.common 1.20 -> 1.21
--- sh.common 2003/02/11 12:56:39 1.20
+++ sh.common 2003/08/13 14:20:34 1.21
@@ -101,8 +101,8 @@
# determine whether option needs an argument
eval "opt_MODE=\$opt_MODE_${opt_OPT}"
- if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
- if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
+ if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
+ if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
opt_PREV="$opt_OPT"
continue
fi
|
|
ossp-pkg/shtool/sh.echo 1.35 -> 1.36
--- sh.echo 2003/02/22 12:27:20 1.35
+++ sh.echo 2003/08/13 14:20:34 1.36
@@ -51,7 +51,7 @@
# determine terminal bold sequence
term_bold=''
term_norm=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then
case $TERM in
# for the most important terminal types we directly know the sequences
xterm|xterm*|vt220|vt220*)
@@ -87,13 +87,13 @@
break
fi
done
- if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
+ if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then
break;
fi
done
;;
esac
- if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
+ if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then
echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
term_bold=''
term_norm=''
@@ -102,7 +102,7 @@
# determine user name
username=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then
username="`(id -un) 2>/dev/null`"
if [ ".$username" = . ]; then
str="`(id) 2>/dev/null`"
@@ -131,7 +131,7 @@
# determine user id
userid=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then
userid="`(id -u) 2>/dev/null`"
if [ ".$userid" = . ]; then
userid="`(id -u ${username}) 2>/dev/null`"
@@ -144,11 +144,11 @@
userid=`(getent passwd ${username}) 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
- userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+ userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
userid=`(ypcat passwd) 2>/dev/null |
- egrep "^${username}:" | \
+ grep "^${username}:" | \
sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$userid" = . ]; then
userid='?'
@@ -162,7 +162,7 @@
# determine (primary) group id
groupid=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then
groupid="`(id -g ${username}) 2>/dev/null`"
if [ ".$groupid" = . ]; then
str="`(id) 2>/dev/null`"
@@ -173,10 +173,10 @@
groupid=`(getent passwd ${username}) 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
- groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+ groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
- groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+ groupid=`(ypcat passwd) 2>/dev/null | grep "^${username}:" | \
sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
if [ ".$groupid" = . ]; then
groupid='?'
@@ -189,7 +189,7 @@
# determine (primary) group name
groupname=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then
groupname="`(id -gn ${username}) 2>/dev/null`"
if [ ".$groupname" = . ]; then
str="`(id) 2>/dev/null`"
@@ -198,14 +198,14 @@
fi
if [ ".$groupname" = . ]; then
groupname=`(getent group) 2>/dev/null | \
- egrep "^[^:]*:[^:]*:${groupid}:" | \
+ grep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
- groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
+ groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
groupname=`(ypcat group) 2>/dev/null | \
- egrep "^[^:]*:[^:]*:${groupid}:" | \
+ grep "^[^:]*:[^:]*:${groupid}:" | \
sed -e 's/:.*$//'`
if [ ".$groupname" = . ]; then
groupname='?'
@@ -219,7 +219,7 @@
# determine host and domain name
hostname=''
domainname=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then
hostname="`(uname -n) 2>/dev/null |\
awk '{ printf("%s", $1); }'`"
if [ ".$hostname" = . ]; then
@@ -236,16 +236,16 @@
;;
esac
fi
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then
if [ ".$domainname" = . ]; then
if [ -f /etc/resolv.conf ]; then
- domainname="`egrep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
+ domainname="`grep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\
sed -e 's/.*domain//' \
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
-e 's/^\.//' -e 's/^/./' |\
awk '{ printf("%s", $1); }'`"
if [ ".$domainname" = . ]; then
- domainname="`egrep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
+ domainname="`grep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\
sed -e 's/.*search//' \
-e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
-e 's/ .*//' -e 's/ .*//' \
@@ -261,7 +261,7 @@
time_month=''
time_year=''
time_monthname=''
-if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
+if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then
time_day=`date '+%d'`
time_month=`date '+%m'`
time_year=`date '+%Y' 2>/dev/null`
|
|
ossp-pkg/shtool/sh.install 1.28 -> 1.29
--- sh.install 2003/06/03 08:28:19 1.28
+++ sh.install 2003/08/13 14:20:34 1.29
@@ -76,7 +76,7 @@
fi
# consistency check for destination
-if [ $argc -gt 2 -a $dstisdir = 0 ]; then
+if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then
echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
shtool_exit 1
fi
|
|
ossp-pkg/shtool/sh.mkdir 1.21 -> 1.22
--- sh.mkdir 2003/02/11 13:00:50 1.21
+++ sh.mkdir 2003/08/13 14:20:34 1.22
@@ -38,7 +38,7 @@
for p in ${1+"$@"}; do
# if the directory already exists...
if [ -d "$p" ]; then
- if [ ".$opt_f" = .no -a ".$opt_p" = .no ]; then
+ if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
echo "$msgprefix:Error: directory already exists: $p" 1>&2
errstatus=1
break
|
|
ossp-pkg/shtool/sh.mkln 1.15 -> 1.16
--- sh.mkln 2003/05/09 09:50:13 1.15
+++ sh.mkln 2003/08/13 14:20:34 1.16
@@ -109,12 +109,12 @@
# split away a common prefix
prefix=""
- if [ ".$srcdir" = ".$dstdir" -a ".$srcdir" != . ]; then
+ if [ ".$srcdir" = ".$dstdir" ] && [ ".$srcdir" != . ]; then
prefix="$srcdir/"
srcdir=""
dstdir=""
else
- while [ ".$srcdir" != . -a ".$dstdir" != . ]; do
+ while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do
presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'`
predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'`
if [ ".$presrc" != ".$predst" ]; then
@@ -132,7 +132,12 @@
# determine source prefix which is the reverse directory
# step-up corresponding to the destination directory
srcpre=""
- if [ $oneisabs = 0 ] || [ ".$prefix" != . -a ".$prefix" != ./ ]; then
+
+ isroot=0
+ if [ ".$prefix" = . ] || [ ".$prefix" = ./ ]; then
+ isroot=1
+ fi
+ if [ $oneisabs = 0 ] || [ $isroot = 0 ]; then
pl="$dstdir/"
OIFS="$IFS"; IFS='/'
for pe in $pl; do
|
|
ossp-pkg/shtool/sh.move 1.17 -> 1.18
--- sh.move 2003/02/11 13:00:50 1.17
+++ sh.move 2003/08/13 14:20:34 1.18
@@ -35,7 +35,7 @@
dst="$2"
# consistency checks
-if [ ".$src" = . -o ".$dst" = . ]; then
+if [ ".$src" = . ] || [ ".$dst" = . ]; then
echo "$msgprefix:Error: Invalid arguments" 1>&2
shtool_exit 1
fi
|
|
ossp-pkg/shtool/sh.path 1.24 -> 1.25
--- sh.path 2003/02/11 13:00:50 1.24
+++ sh.path 2003/08/13 14:20:34 1.25
@@ -80,7 +80,7 @@
# MAGIC SITUATION
# Perl Interpreter (perl)
-if [ ".$opt_m" = .yes -a ".$namelist" = .perl ]; then
+if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then
rm -f $tmpfile >/dev/null 2>&1
touch $tmpfile
found=0
@@ -89,7 +89,7 @@
dir=`echo $dir | sed -e 's;/*$;;'`
nc=99
for name in perl perl5 miniperl; do
- if [ $minusx "$dir/$name" -a ! -d "$dir/$name" ]; then
+ if [ $minusx "$dir/$name" ] && [ ! -d "$dir/$name" ]; then
perl="$dir/$name"
pv=`$perl -e 'printf("%.3f", $]);'`
echo "$pv:$pc:$nc:$perl" >>$tmpfile
@@ -111,7 +111,7 @@
# MAGIC SITUATION
# C pre-processor (cpp)
-if [ ".$opt_m" = .yes -a ".$namelist" = .cpp ]; then
+if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then
echo >$tmpfile.c "#include <assert.h>"
echo >>$tmpfile.c "Syntax Error"
# 1. try the standard cc -E approach
@@ -127,7 +127,7 @@
# 3. try a standalone cpp command in path and lib dirs
for path in $paths /lib /usr/lib /usr/local/lib; do
path=`echo $path | sed -e 's;/*$;;'`
- if [ $minusx "$path/cpp" -a ! -d "$path/cpp" ]; then
+ if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then
cpp="$path/cpp"
break
fi
@@ -157,7 +157,7 @@
# iterate over paths
for path in $paths; do
path=`echo $path | sed -e 's;/*$;;'`
- if [ $minusx "$path/$name" -a ! -d "$path/$name" ]; then
+ if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then
if [ ".$opt_s" != .yes ]; then
echo "$path/$name"
fi
|
|
ossp-pkg/shtool/sh.rotate 1.7 -> 1.8
--- sh.rotate 2003/04/29 08:01:01 1.7
+++ sh.rotate 2003/08/13 14:20:34 1.8
@@ -71,7 +71,7 @@
fi
# option -d/-z consistency
-if [ ".$opt_d" = .yes -a ".$opt_z" = . ]; then
+if [ ".$opt_d" = .yes ] && [ ".$opt_z" = . ]; then
echo "$msgprefix:Error: option -d requires option -z." 1>&2
shtool_exit 1
fi
@@ -125,7 +125,7 @@
-e 's/:/ /g'`"
for prg in bzip2 gzip compress; do
for path in $paths; do
- if [ $minusx "$path/$prg" -a ! -d "$path/$prg" ]; then
+ if [ $minusx "$path/$prg" ] && [ ! -d "$path/$prg" ]; then
comp_prg="$prg"
break
fi
@@ -234,7 +234,7 @@
m=$n
n=`expr $n - 1`
n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n`
- if [ $n -eq 0 -a ".$opt_d" = .yes ]; then
+ if [ $n -eq 0 ] && [ ".$opt_d" = .yes ]; then
# special case: first rotation file under delayed compression situation
if [ ! -f "${adir}/${file}.${n}" ]; then
continue
@@ -345,7 +345,7 @@
fi
# regular compression step
- if [ ".$opt_z" != . -a ".$opt_d" = .no ]; then
+ if [ ".$opt_z" != . ] && [ ".$opt_d" = .no ]; then
# compress file
if [ ".$opt_b" = .yes ]; then
if [ ".$opt_t" = .yes ]; then
|
|
ossp-pkg/shtool/sh.slo 1.21 -> 1.22
--- sh.slo 2003/04/29 08:01:01 1.21
+++ sh.slo 2003/08/13 14:20:34 1.22
@@ -43,7 +43,7 @@
optprev=''
fi
# remember options for arg if used stand-alone
- if [ ".$opt" = ".-L" -o ".$opt" = ".-l" ]; then
+ if [ ".$opt" = ".-L" ] || [ ".$opt" = ".-l" ]; then
optprev="$opt"
continue;
fi
@@ -122,9 +122,10 @@
if [ ".$found" = .yes ]; then
if [ ".$found_indefdir" != .yes ]; then
eval "dirlist=\"\${DIRS_${found_type}}:\""
- if [ ".`echo \"$dirlist\" | fgrep :$found_dir:`" = . ]; then
- eval "DIRS_${found_type}=\"\$DIRS_${found_type}:${found_dir}\""
- fi
+ case "$dirlist" in
+ *:$found_dir:* ) ;;
+ * ) eval "DIRS_${found_type}=\"\$DIRS_${found_type}:${found_dir}\"" ;;
+ esac
eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\""
else
eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\""
@@ -142,9 +143,10 @@
OIFS="$IFS"; IFS=':'
for dir in $DIRS; do
dirlist="${DIRS_OBJ}:${DIRS_PIC}:${DIRS_DSO}:"
- if [ ".`echo \"$dirlist\" | fgrep :$dir:`" = . ]; then
- DIRS_OBJ="$DIRS_OBJ:$dir"
- fi
+ case "$dirlist" in
+ *:$dir:* ) ;;
+ * ) DIRS_OBJ="$DIRS_OBJ:$dir" ;;
+ esac
done
IFS="$OIFS"
|
|
ossp-pkg/shtool/sh.subst 1.8 -> 1.9
--- sh.subst 2003/05/16 08:46:26 1.8
+++ sh.subst 2003/08/13 14:20:34 1.9
@@ -40,11 +40,11 @@
files="$*"
# parameter consistency check
-if [ $# -eq 0 -a ".$opt_b" != . ]; then
+if [ $# -eq 0 ] && [ ".$opt_b" != . ]; then
echo "$msgprefix:Error: option -b cannot be applied to stdin" 1>&2
shtool_exit 1
fi
-if [ $# -eq 0 -a ".$opt_s" = .yes ]; then
+if [ $# -eq 0 ] && [ ".$opt_s" = .yes ]; then
echo "$msgprefix:Error: option -s cannot be applied to stdin" 1>&2
shtool_exit 1
fi
|
|
ossp-pkg/shtool/sh.tarball 1.18 -> 1.19
--- sh.tarball 2003/02/11 13:00:50 1.18
+++ sh.tarball 2003/08/13 14:20:34 1.19
@@ -58,7 +58,7 @@
for tool in `echo $tools | sed -e 's/,/ /g'`; do
# iterate over paths
for path in $paths; do
- if [ $minusx "$path/$tool" -a ! -d "$path/$tool" ]; then
+ if [ $minusx "$path/$tool" ] && [ ! -d "$path/$tool" ]; then
eval "prg_${prg}=\"$path/$tool\""
break
fi
|
|
ossp-pkg/shtool/shtoolize.in 1.30 -> 1.31
--- shtoolize.in 2003/02/11 13:00:50 1.30
+++ shtoolize.in 2003/08/13 14:20:34 1.31
@@ -391,7 +391,7 @@
echo "\$0:Hint: run \\`\$0 -h' for usage" 1>&2
exit 1
fi
-if [ ".\$1" = ".-h" -o ".\$1" = ".--help" ]; then
+if [ ".\$1" = ".-h" ] || [ ".\$1" = ".--help" ]; then
echo "This is GNU shtool, version ${version}"
echo "Copyright (c) 1994-2003 Ralf S. Engelschall <rse\@engelschall.com>"
echo "Report bugs to <bug-shtool\@gnu.org>"
@@ -408,15 +408,15 @@
echo ''
exit 0
fi
-if [ ".\$1" = ".-v" -o ".\$1" = ."--version" ]; then
+if [ ".\$1" = ".-v" ] || [ ".\$1" = ".--version" ]; then
echo "GNU shtool ${version}"
exit 0
fi
-if [ ".\$1" = ".-r" -o ".\$1" = ."--recreate" ]; then
+if [ ".\$1" = ".-r" ] || [ ".\$1" = ".--recreate" ]; then
${recreate}
exit 0
fi
-if [ ".\$1" = ".-d" -o ".\$1" = ."--debug" ]; then
+if [ ".\$1" = ".-d" ] || [ ".\$1" = ".--debug" ]; then
shift
set -x
fi
|
|