Index: ossp-pkg/shtool/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v rcsdiff -q -kk '-r1.178' '-r1.179' -u '/v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/12/16 13:50:20 1.178 +++ ChangeLog 2003/02/11 12:56:39 1.179 @@ -9,7 +9,16 @@ ChangeLog - Changes between 1.6.2 and 1.6.3 (02-Nov-2002 to xx-Dec-2002): + Changes between 1.6.2 and 2.0.0 (02-Nov-2002 to xx-Feb-2003): + + *) Fixed error exit in all commands by introducing an "shtool_exit" + function (which correctly cleans up temporary files) and + replacing all "exit" calls with "shtool_exit". THIS THE FIRST + TIME INTRODUCED THE USAGE OF A SHELL FUNCTION TO THE SHTOOL CODE. + This is known to break on _very_ anchient and broken Bourne-Shell + implementations and is considered to be no longer a real problem + in the year 2003. Especially there is no alternative way anyway. + [Ralf S. Engelschall ] *) Fixed description of "shtool install -C" operation in manual page. [Stefan Seefeld ] Index: ossp-pkg/shtool/sh.arx RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.arx,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.arx,v' 2>/dev/null --- sh.arx 2001/12/31 15:06:04 1.17 +++ sh.arx 2003/02/11 12:56:39 1.18 @@ -41,7 +41,7 @@ for file in $files; do if [ ! -f $file ]; then echo "$msgprefix:Error: input file not found: $file" 1>&2 - exit 1 + shtool_exit 1 fi case $file in *.a ) @@ -67,7 +67,7 @@ (cd $tmpdir && eval $ar_prg x $from) if [ $? -ne 0 ]; then echo "$msgprefix:Error: member extraction failed for archive: $file" 1>&2 - exit 1 + shtool_exit 1 fi for member in - `eval $ar_prg t $file | sed -e '/_\.SYMDEF/d'`; do [ ".$member" = .- ] && continue @@ -88,7 +88,7 @@ eval $ar_prg $ar_cmd $archive $nfiles if [ $? -ne 0 ]; then echo "$msgprefix:Error: archive command failed" 1>&2 - exit $? + shtool_exit $? fi # cleanup and die gracefully Index: ossp-pkg/shtool/sh.common RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.common,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.common,v' 2>/dev/null --- sh.common 2001/09/23 10:58:10 1.19 +++ sh.common 2003/02/11 12:56:39 1.20 @@ -174,3 +174,12 @@ chmod 600 $tmpfile fi +# cleanup procedure +shtool_exit () { + rc="$1" + if [ ".$gen_tmpfile" = .yes ]; then + rm -f $tmpfile >/dev/null 2>&1 || true + fi + exit $rc +} + Index: ossp-pkg/shtool/sh.guessos RCS File: /v/ossp/cvs/ossp-pkg/shtool/Attic/sh.guessos,v rcsdiff -q -kk '-r1.22' '-r1.23' -u '/v/ossp/cvs/ossp-pkg/shtool/Attic/sh.guessos,v' 2>/dev/null --- sh.guessos 2002/09/04 09:58:42 1.22 +++ sh.guessos 2003/02/11 12:56:39 1.23 @@ -22,31 +22,31 @@ if [ "x$XREL" != "x" ]; then if [ -f /etc/kconfig ]; then case "$XREL" in - 4.0|4.1) echo "${MACHINE}-whatever-isc4"; exit 0 ;; + 4.0|4.1) echo "${MACHINE}-whatever-isc4"; shtool_exit 0 ;; esac else case "$XREL" in 3.2v4.2) - echo "whatever-whatever-sco3"; exit 0 + echo "whatever-whatever-sco3"; shtool_exit 0 ;; 3.2v5.0*) - echo "whatever-whatever-sco5"; exit 0 + echo "whatever-whatever-sco5"; shtool_exit 0 ;; 4.2MP) if [ "x$VERSION" = "x2.1.1" ]; then - echo "${MACHINE}-whatever-unixware211"; exit 0 + echo "${MACHINE}-whatever-unixware211"; shtool_exit 0 elif [ "x$VERSION" = "x2.1.2" ]; then - echo "${MACHINE}-whatever-unixware212"; exit 0 + echo "${MACHINE}-whatever-unixware212"; shtool_exit 0 else - echo "${MACHINE}-whatever-unixware2"; exit 0 + echo "${MACHINE}-whatever-unixware2"; shtool_exit 0 fi ;; 4.2) - echo "whatever-whatever-unixware1"; exit 0 + echo "whatever-whatever-unixware1"; shtool_exit 0 ;; 5) case "$VERSION" in - 7*) echo "${MACHINE}-whatever-unixware7"; exit 0 ;; + 7*) echo "${MACHINE}-whatever-unixware7"; shtool_exit 0 ;; esac ;; esac @@ -54,35 +54,35 @@ fi case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in MiNT:*) - echo "m68k-atari-mint"; exit 0 + echo "m68k-atari-mint"; shtool_exit 0 ;; A/UX:*) - echo "m68k-apple-aux3"; exit 0 + echo "m68k-apple-aux3"; shtool_exit 0 ;; AIX:*) MACH=`echo $MACHINE | sed -e 's;[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F];;'` - echo "${MACH}-ibm-aix${VERSION}.${RELEASE}"; exit 0 + echo "${MACH}-ibm-aix${VERSION}.${RELEASE}"; shtool_exit 0 ;; dgux:*) - echo "${MACHINE}-dg-dgux"; exit 0 + echo "${MACHINE}-dg-dgux"; shtool_exit 0 ;; HI-UX:*) - echo "${MACHINE}-hi-hiux"; exit 0 + echo "${MACHINE}-hi-hiux"; shtool_exit 0 ;; HP-UX:*) HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'` MACHINE=`echo ${MACHINE}|sed -e 's:/:_:'` - echo "${MACHINE}-hp-hpux${HPUXVER}"; exit 0 + echo "${MACHINE}-hp-hpux${HPUXVER}"; shtool_exit 0 ;; IRIX:*) if [ -f /usr/lib32/mips4/libm.so ]; then - echo "${MACHINE}/32-sgi-irix${RELEASE}"; exit 0 + echo "${MACHINE}/32-sgi-irix${RELEASE}"; shtool_exit 0 else - echo "${MACHINE}-sgi-irix${RELEASE}"; exit 0 + echo "${MACHINE}-sgi-irix${RELEASE}"; shtool_exit 0 fi ;; IRIX64:*) - echo "${MACHINE}/64-sgi-irix${RELEASE}"; exit 0 + echo "${MACHINE}/64-sgi-irix${RELEASE}"; shtool_exit 0 ;; Linux:*) V='whatever' @@ -93,19 +93,19 @@ case "$RELEASE" in [1-9].*) R=`echo $RELEASE | cut -c1` ;; esac - echo "${MACHINE}-${V}-linux-gnu${R}"; exit 0 + echo "${MACHINE}-${V}-linux-gnu${R}"; shtool_exit 0 ;; LynxOS:*) - echo "${MACHINE}-lynx-lynxos"; exit 0 + echo "${MACHINE}-lynx-lynxos"; shtool_exit 0 ;; BSD/386|BSD/OS:3.*) - echo "${MACHINE}-whatever-bsdi3"; exit 0 + echo "${MACHINE}-whatever-bsdi3"; shtool_exit 0 ;; BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*) - echo "i486-whatever-bsdi"; exit 0 + echo "i486-whatever-bsdi"; shtool_exit 0 ;; BSD/386:*|BSD/OS:*) - echo "${MACHINE}-whatever-bsdi"; exit 0 + echo "${MACHINE}-whatever-bsdi"; shtool_exit 0 ;; FreeBSD:*) VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'` @@ -122,20 +122,20 @@ case ${MACH} in i[0-9]86 ) ARCH="pc" ;; esac - echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0 + echo "${MACH}-${ARCH}-freebsd${VERS}"; shtool_exit 0 ;; NetBSD:*:*:*486*) - echo "i486-whatever-netbsd${RELEASE}"; exit 0 + echo "i486-whatever-netbsd${RELEASE}"; shtool_exit 0 ;; NetBSD:*) - echo "${MACHINE}-whatever-netbsd${RELEASE}"; exit 0 + echo "${MACHINE}-whatever-netbsd${RELEASE}"; shtool_exit 0 ;; OpenBSD:*) - echo "${MACHINE}-whatever-openbsd"; exit 0 + echo "${MACHINE}-whatever-openbsd"; shtool_exit 0 ;; OSF1:*:*:*alpha*) VERS=`echo $RELEASE | sed -e 's;^V;;'` - echo "${MACHINE}-dec-osf${VERS}"; exit 0 + echo "${MACHINE}-dec-osf${VERS}"; shtool_exit 0 ;; QNX:*) if [ "$VERSION" -gt 422 ]; then @@ -143,95 +143,95 @@ else echo "${MACHINE}-qssl-qnx" fi - exit 0 + shtool_exit 0 ;; Paragon*:*:*:*) - echo "i860-intel-osf1"; exit 0 + echo "i860-intel-osf1"; shtool_exit 0 ;; SunOS:5.*) VERSION=`echo $RELEASE | sed -e 's;^5\.;;'` - echo "${MACHINE}-sun-solaris2.${VERSION}"; exit 0 + echo "${MACHINE}-sun-solaris2.${VERSION}"; shtool_exit 0 ;; SunOS:*) - echo "${MACHINE}-sun-sunos4"; exit 0 + echo "${MACHINE}-sun-sunos4"; shtool_exit 0 ;; UNIX_System_V:4.*:*) - echo "${MACHINE}-whatever-sysv4"; exit 0 + echo "${MACHINE}-whatever-sysv4"; shtool_exit 0 ;; unix:3.0.9*:*:88k) - echo "${MACHINE}-encore-sysv4"; exit 0 + echo "${MACHINE}-encore-sysv4"; shtool_exit 0 ;; *:4*:R4*:m88k) - echo "${MACHINE}-whatever-sysv4"; exit 0 + echo "${MACHINE}-whatever-sysv4"; shtool_exit 0 ;; UnixWare:5:99*:*) # Gemini, beta release of next rev of unixware - echo "${MACHINE}-whatever-unixware212"; exit 0 + echo "${MACHINE}-whatever-unixware212"; shtool_exit 0 ;; DYNIX/ptx:4*:*) - echo "${MACHINE}-whatever-sysv4"; exit 0 + echo "${MACHINE}-whatever-sysv4"; shtool_exit 0 ;; *:4.0:3.0:[345][0-9]?? | *:4.0:3.0:3[34]??[/,]* | library:*) - echo "x86-ncr-sysv4"; exit 0 + echo "x86-ncr-sysv4"; shtool_exit 0 ;; ULTRIX:*) - echo "${MACHINE}-unknown-ultrix"; exit 0 + echo "${MACHINE}-unknown-ultrix"; shtool_exit 0 ;; SINIX-?:* | ReliantUNIX-?:*) - echo "${MACHINE}-siemens-sysv4"; exit 0 + echo "${MACHINE}-siemens-sysv4"; shtool_exit 0 ;; POSIX*BS2000) - echo "${MACHINE}-siemens-sysv4"; exit 0 + echo "${MACHINE}-siemens-sysv4"; shtool_exit 0 ;; machten:*) - echo "${MACHINE}-tenon-${SYSTEM}"; exit 0; + echo "${MACHINE}-tenon-${SYSTEM}"; shtool_exit 0; ;; ConvexOS:*:11.*:*) - echo "${MACHINE}-v11-${SYSTEM}"; exit 0; + echo "${MACHINE}-v11-${SYSTEM}"; shtool_exit 0; ;; UNIX_SV:*:*:maxion) - echo "${MACHINE}-ccur-sysv4"; exit 0; + echo "${MACHINE}-ccur-sysv4"; shtool_exit 0; ;; PowerMAX_OS:*:*:Night_Hawk) MACHINE=`uname -p` - echo "${MACHINE}-concurrent-powermax"; exit 0; + echo "${MACHINE}-concurrent-powermax"; shtool_exit 0; ;; UNIX_SV:*) if [ -d /usr/nec ];then - echo "mips-nec-sysv4"; exit 0; + echo "mips-nec-sysv4"; shtool_exit 0; fi ;; NonStop-UX:4.[02]*:[BC]*:*) - echo "${MACHINE}-tandem-sysv4"; exit 0; + echo "${MACHINE}-tandem-sysv4"; shtool_exit 0; ;; Rhapsody:*:*:*) case "${MACHINE}" in "Power Macintosh") MACHINE=powerpc ;; esac - echo "${MACHINE}-apple-rhapsody${RELEASE}"; exit 0 + echo "${MACHINE}-apple-rhapsody${RELEASE}"; shtool_exit 0 ;; Darwin:*:*:*) MACHINE=`uname -p` - echo "${MACHINE}-apple-darwin${RELEASE}"; exit 0 + echo "${MACHINE}-apple-darwin${RELEASE}"; shtool_exit 0 ;; "Mac OS":*:*:*) MACHINE=`uname -p` - echo "${MACHINE}-apple-macos${RELEASE}"; exit 0 + echo "${MACHINE}-apple-macos${RELEASE}"; shtool_exit 0 ;; "RISC iX":*) - echo "arm-whatever-riscix"; exit 0; + echo "arm-whatever-riscix"; shtool_exit 0; ;; *:4.0:2:*) - echo "whatever-unisys-sysv4"; exit 0; + echo "whatever-unisys-sysv4"; shtool_exit 0; ;; *:*:dcosx:NILE*) - echo "pyramid-pyramid-svr4"; exit 0; + echo "pyramid-pyramid-svr4"; shtool_exit 0; ;; *:*:*:"DRS 6000") - echo "drs6000-whatever-whatever"; exit 0; + echo "drs6000-whatever-whatever"; shtool_exit 0; ;; AmigaOS:*:*:* ) - echo "${MACHINE}-whatever-${SYSTEM}${RELEASE}"; exit 0 + echo "${MACHINE}-whatever-${SYSTEM}${RELEASE}"; shtool_exit 0 ;; esac @@ -248,7 +248,7 @@ fi NEXTREL="`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`" NEXTARCH=`arch` - echo "${NEXTARCH}-next-${NEXTOS}${NEXTREL}" ; exit 0 + echo "${NEXTARCH}-next-${NEXTOS}${NEXTREL}" ; shtool_exit 0 ;; esac Index: ossp-pkg/shtool/sh.install RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.install,v rcsdiff -q -kk '-r1.25' '-r1.26' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.install,v' 2>/dev/null --- sh.install 2002/11/02 12:46:19 1.25 +++ sh.install 2003/02/11 12:56:39 1.26 @@ -54,9 +54,9 @@ cmd="$cmd -t" fi for dir in "$@"; do - eval "$cmd $dir" || exit $? + eval "$cmd $dir" || shtool_exit $? done - exit 0 + shtool_exit 0 fi # determine source(s) and destination @@ -78,7 +78,7 @@ # consistency check for destination if [ $argc -gt 2 -a $dstisdir = 0 ]; then echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2 - exit 1 + shtool_exit 1 fi # iterate over all source(s) @@ -120,12 +120,12 @@ if [ ".$opt_t" = .yes ]; then echo "cp $src $dsttmp" 1>&2 fi - cp $src $dsttmp || exit $? + cp $src $dsttmp || shtool_exit $? else if [ ".$opt_t" = .yes ]; then echo "mv $src $dsttmp" 1>&2 fi - mv $src $dsttmp || exit $? + mv $src $dsttmp || shtool_exit $? fi # adjust the target file @@ -137,32 +137,32 @@ sed="$sed -e '$e'" done cp $dsttmp $dsttmp.old - eval "$sed <$dsttmp.old >$dsttmp" || exit $? + eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $? rm -f $dsttmp.old fi if [ ".$opt_s" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "strip $dsttmp" 1>&2 fi - strip $dsttmp || exit $? + strip $dsttmp || shtool_exit $? fi if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o $dsttmp" 1>&2 fi - chown $opt_o $dsttmp || exit $? + chown $opt_o $dsttmp || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g $dsttmp" 1>&2 fi - chgrp $opt_g $dsttmp || exit $? + chgrp $opt_g $dsttmp || shtool_exit $? fi if [ ".$opt_m" != ".-" ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $dsttmp" 1>&2 fi - chmod $opt_m $dsttmp || exit $? + chmod $opt_m $dsttmp || shtool_exit $? fi # determine whether to do a quick install Index: ossp-pkg/shtool/sh.mdate RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mdate,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mdate,v' 2>/dev/null --- sh.mdate 2001/09/23 10:58:10 1.11 +++ sh.mdate 2003/02/11 12:56:40 1.12 @@ -39,12 +39,12 @@ [dmy][dmy][dmy] ) ;; * ) echo "$msgprefix:Error: invalid argument to option \`-o': $opt_o" 1>&2 - exit 1 + shtool_exit 1 ;; esac if [ ! -r "$fod" ]; then echo "$msgprefix:Error: file or directory not found: $fod" 1>&2 - exit 1 + shtool_exit 1 fi # prevent "date" giving response in another language Index: ossp-pkg/shtool/sh.mkdir RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkdir,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkdir,v' 2>/dev/null --- sh.mkdir 2002/11/02 12:35:56 1.19 +++ sh.mkdir 2003/02/11 12:56:40 1.20 @@ -112,5 +112,5 @@ done fi done -exit $errstatus +shtool_exit $errstatus Index: ossp-pkg/shtool/sh.mkln RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkln,v rcsdiff -q -kk '-r1.12' '-r1.13' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkln,v' 2>/dev/null --- sh.mkln 2001/12/31 15:06:04 1.12 +++ sh.mkln 2003/02/11 12:56:40 1.13 @@ -40,7 +40,7 @@ if [ ! -d $dst ]; then if [ $args -gt 2 ]; then echo "$msgprefix:Error: multiple sources not allowed when target isn't a directory" 1>&2 - exit 1 + shtool_exit 1 fi fi @@ -87,7 +87,7 @@ if [ ".$dstdir" != . ]; then if [ ! -d $dstdir ]; then echo "$msgprefix:Error: destination directory not found: $dstdir" 1>&2 - exit 1 + shtool_exit 1 fi fi Index: ossp-pkg/shtool/sh.mkshadow RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkshadow,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkshadow,v' 2>/dev/null --- sh.mkshadow 2001/12/31 15:06:04 1.20 +++ sh.mkshadow 2003/02/11 12:56:40 1.21 @@ -37,7 +37,7 @@ # check whether source exists if [ ! -d $src ]; then echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2 - exit 1 + shtool_exit 1 fi # determine if one of the paths is an absolute path, Index: ossp-pkg/shtool/sh.move RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.move,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.move,v' 2>/dev/null --- sh.move 2001/12/31 15:06:04 1.15 +++ sh.move 2003/02/11 12:56:40 1.16 @@ -37,11 +37,11 @@ # consistency checks if [ ".$src" = . -o ".$dst" = . ]; then echo "$msgprefix:Error: Invalid arguments" 1>&2 - exit 1 + shtool_exit 1 fi if [ ".$src" = ".$dst" ]; then echo "$msgprefix:Error: Source and destination files are the same" 1>&2 - exit 1 + shtool_exit 1 fi expsrc="$src" if [ ".$opt_e" = .yes ]; then @@ -50,20 +50,20 @@ if [ ".$opt_e" = .yes ]; then if [ ".`echo "$src" | sed -e 's;^.*\\*.*$;;'`" = ".$src" ]; then echo "$msgprefix:Error: Source doesn't contain wildcard ('*'): $dst" 1>&2 - exit 1 + shtool_exit 1 fi if [ ".`echo "$dst" | sed -e 's;^.*%[1-9].*$;;'`" = ".$dst" ]; then echo "$msgprefix:Error: Destination doesn't contain substitution ('%N'): $dst" 1>&2 - exit 1 + shtool_exit 1 fi if [ ".$expsrc" = ".$src" ]; then echo "$msgprefix:Error: Sources not found or no asterisk : $src" 1>&2 - exit 1 + shtool_exit 1 fi else if [ ! -r "$src" ]; then echo "$msgprefix:Error: Source not found: $src" 1>&2 - exit 1 + shtool_exit 1 fi fi @@ -113,5 +113,5 @@ break; fi done -exit $errorstatus +shtool_exit $errorstatus Index: ossp-pkg/shtool/sh.path RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.path,v rcsdiff -q -kk '-r1.22' '-r1.23' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.path,v' 2>/dev/null --- sh.path 2002/02/23 09:18:03 1.22 +++ sh.path 2003/02/11 12:56:40 1.23 @@ -62,7 +62,7 @@ done fi echo $rp | sed -e 's:/$::' - exit 0 + shtool_exit 0 fi # SPECIAL REQUEST @@ -70,12 +70,12 @@ if [ ".$opt_d" = .yes ]; then echo "$namelist" |\ sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' - exit 0 + shtool_exit 0 fi if [ ".$opt_b" = .yes ]; then echo "$namelist" |\ sed -e 's;.*/\([^/]*\)$;\1;' - exit 0 + shtool_exit 0 fi # MAGIC SITUATION @@ -103,10 +103,10 @@ perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`" rm -f $tmpfile >/dev/null 2>&1 echo "$perl" - exit 0 + shtool_exit 0 fi rm -f $tmpfile >/dev/null 2>&1 - exit 1 + shtool_exit 1 fi # MAGIC SITUATION @@ -146,9 +146,9 @@ rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1 if [ ".$cpp" != . ]; then echo "$cpp" - exit 0 + shtool_exit 0 fi - exit 1 + shtool_exit 1 fi # STANDARD SITUATION @@ -161,9 +161,9 @@ if [ ".$opt_s" != .yes ]; then echo "$path/$name" fi - exit 0 + shtool_exit 0 fi done done -exit 1 +shtool_exit 1 Index: ossp-pkg/shtool/sh.rotate RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.rotate,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.rotate,v' 2>/dev/null --- sh.rotate 2002/07/11 17:23:25 1.3 +++ sh.rotate 2003/02/11 12:56:40 1.4 @@ -48,7 +48,7 @@ # make sure we have at least one file to rotate if [ ".$opt_n" = .0 ]; then echo "$msgprefix:Error: invalid argument \`$opt_n' to option -n." 1>&2 - exit 1 + shtool_exit 1 fi # canonicalize -s option argument @@ -66,14 +66,14 @@ opt_s=`expr $opt_s \* 1073741824` # 1024*1024*1024 else echo "$msgprefix:Error: invalid argument \`$opt_s' to option -s." 1>&2 - exit 1 + shtool_exit 1 fi fi # option -d/-z consistency if [ ".$opt_d" = .yes -a ".$opt_z" = . ]; then echo "$msgprefix:Error: option -d requires option -z." 1>&2 - exit 1 + shtool_exit 1 fi # make sure target directory exists @@ -81,14 +81,14 @@ if [ ! -d $opt_a ]; then if [ ".$opt_f" = .no ]; then echo "$msgprefix:Error: archive directory \`$opt_a' does not exist." 1>&2 - exit 1 + shtool_exit 1 fi - mkdir $opt_a || exit $? + mkdir $opt_a || shtool_exit $? chmod 755 $opt_a fi if [ ! -w $opt_a ]; then echo "$msgprefix:Error: archive directory \`$opt_a' not writable." 1>&2 - exit 1 + shtool_exit 1 fi fi @@ -106,7 +106,7 @@ [0-9] ) ;; * ) echo "$msgprefix:Error: invalid compression level \`$comp_lvl'" 1>&2 - exit 1 + shtool_exit 1 ;; esac @@ -136,7 +136,7 @@ done if [ ".$comp_prg" = . ]; then echo "$msgprefix:Error: no suitable compression tool found in \$PATH" 1>&2 - exit 1 + shtool_exit 1 fi fi @@ -147,7 +147,7 @@ */gzip | gzip ) comp_ext="gz" comp_lvl="-$comp_lvl" ;; */compress | compress ) comp_ext="Z"; comp_lvl="" ;; * ) echo "$msgprefix:Error: tool \`$comp_prg' is not a known compression tool" 1>&2 - exit 1 + shtool_exit 1 ;; esac comp_suf=".$comp_ext" @@ -161,7 +161,7 @@ continue fi echo "$msgprefix:Error: logfile \`$file' not found" 1>&2 - exit 1 + shtool_exit 1 fi # determine log directory (where original logfile is placed) @@ -206,7 +206,7 @@ echo "$opt_P" fi eval $opt_P - [ $? -ne 0 ] && exit $? + [ $? -ne 0 ] && shtool_exit $? fi # kick away out-rotated logfile @@ -219,13 +219,13 @@ echo "$opt_M ${adir}/${file}.${n}${comp_suf}" fi eval "$opt_M ${adir}/${file}.${n}${comp_suf}" - [ $? -ne 0 ] && exit $? + [ $? -ne 0 ] && shtool_exit $? fi # finally get rid of the out-rotated logfile if [ ".$opt_t" = .yes ]; then echo "rm -f ${adir}/${file}.${n}${comp_suf}" fi - rm -f ${adir}/${file}.${n}${comp_suf} || exit $? + rm -f ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi # rotate already archived logfiles @@ -244,14 +244,14 @@ if [ ".$opt_t" = .yes ]; then echo "mv ${adir}/${file}.${n} ${adir}/${file}.${m}" fi - mv ${adir}/${file}.${n} ${adir}/${file}.${m} || exit $? + mv ${adir}/${file}.${n} ${adir}/${file}.${m} || shtool_exit $? if [ ".$opt_t" = .yes ]; then echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${m} >${adir}/${file}.${m}${comp_suf}; rm -f ${adir}/${file}.${m}) &" fi ( ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${m} \ - >${adir}/${file}.${m}${comp_suf} || exit $? - rm -f ${adir}/${file}.${m} || exit $? + >${adir}/${file}.${m}${comp_suf} || shtool_exit $? + rm -f ${adir}/${file}.${m} || shtool_exit $? ) /dev/null 2>&1 & else if [ ".$opt_t" = .yes ]; then @@ -259,11 +259,11 @@ fi ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${n} \ - >${adir}/${file}.${m}${comp_suf} || exit $? + >${adir}/${file}.${m}${comp_suf} || shtool_exit $? if [ ".$opt_t" = .yes ]; then echo "rm -f ${adir}/${file}.${n}" fi - rm -f ${adir}/${file}.${n} || exit $? + rm -f ${adir}/${file}.${n} || shtool_exit $? fi # fix file attributes @@ -271,19 +271,19 @@ if [ ".$opt_t" = .yes ]; then echo "chown $opt_o ${adir}/${file}.${m}${comp_suf}" fi - chown $opt_o ${adir}/${file}.${m}${comp_suf} || exit $? + chown $opt_o ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g ${adir}/${file}.${m}${comp_suf}" fi - chgrp $opt_g ${adir}/${file}.${m}${comp_suf} || exit $? + chgrp $opt_g ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m ${adir}/${file}.${m}${comp_suf}" fi - chmod $opt_m ${adir}/${file}.${m}${comp_suf} || exit $? + chmod $opt_m ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi else # standard case: second and following rotation file @@ -293,7 +293,7 @@ if [ ".$opt_t" = .yes ]; then echo "mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf}" fi - mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf} || exit $? + mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf} || shtool_exit $? fi done @@ -303,42 +303,42 @@ if [ ".$opt_t" = .yes ]; then echo "cp -p ${ldir}/${file} ${adir}/${file}.${n}" fi - cp -p ${ldir}/${file} ${adir}/${file}.${n} || exit $? + cp -p ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $? if [ ".$opt_r" = .no ]; then if [ ".$opt_t" = .yes ]; then echo "cp /dev/null ${ldir}/${file}" fi - cp /dev/null ${ldir}/${file} || exit $? + cp /dev/null ${ldir}/${file} || shtool_exit $? fi else # approach: move[+touch] if [ ".$opt_t" = .yes ]; then echo "mv ${ldir}/${file} ${adir}/${file}.${n}" fi - mv ${ldir}/${file} ${adir}/${file}.${n} || exit $? + mv ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $? if [ ".$opt_r" = .no ]; then if [ ".$opt_t" = .yes ]; then echo "touch ${ldir}/${file}" fi - touch ${ldir}/${file} || exit $? + touch ${ldir}/${file} || shtool_exit $? # fix file attributes if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o ${ldir}/${file}" fi - chown $opt_o ${ldir}/${file} || exit $? + chown $opt_o ${ldir}/${file} || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g ${ldir}/${file}" fi - chgrp $opt_g ${ldir}/${file} || exit $? + chgrp $opt_g ${ldir}/${file} || shtool_exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m ${ldir}/${file}" fi - chmod $opt_m ${ldir}/${file} || exit $? + chmod $opt_m ${ldir}/${file} || shtool_exit $? fi fi fi @@ -352,8 +352,8 @@ fi ( ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${n} \ - >${adir}/${file}.${n}${comp_suf} || exit $? - rm -f ${adir}/${file}.${n} || exit $? + >${adir}/${file}.${n}${comp_suf} || shtool_exit $? + rm -f ${adir}/${file}.${n} || shtool_exit $? ) /dev/null 2>&1 & else if [ ".$opt_t" = .yes ]; then @@ -361,11 +361,11 @@ fi ${comp_prg} ${comp_lvl} \ <${adir}/${file}.${n} \ - >${adir}/${file}.${n}${comp_suf} || exit $? + >${adir}/${file}.${n}${comp_suf} || shtool_exit $? if [ ".$opt_t" = .yes ]; then echo "rm -f ${opt_a}${file}.${n}" fi - rm -f ${adir}/${file}.${n} || exit $? + rm -f ${adir}/${file}.${n} || shtool_exit $? fi # fix file attributes @@ -373,19 +373,19 @@ if [ ".$opt_t" = .yes ]; then echo "chown $opt_o ${adir}/${file}.${n}${comp_suf}" fi - chown $opt_o ${adir}/${file}.${n}${comp_suf} || exit $? + chown $opt_o ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g ${adir}/${file}.${n}${comp_suf}" fi - chgrp $opt_g ${adir}/${file}.${n}${comp_suf} || exit $? + chgrp $opt_g ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m ${adir}/${file}.${n}${comp_suf}" fi - chmod $opt_m ${adir}/${file}.${n}${comp_suf} || exit $? + chmod $opt_m ${adir}/${file}.${n}${comp_suf} || shtool_exit $? fi fi @@ -395,7 +395,7 @@ echo "$opt_E" fi eval $opt_E - [ $? -ne 0 ] && exit $? + [ $? -ne 0 ] && shtool_exit $? fi done Index: ossp-pkg/shtool/sh.scpp RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.scpp,v rcsdiff -q -kk '-r1.22' '-r1.23' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.scpp,v' 2>/dev/null --- sh.scpp 2002/11/02 12:14:10 1.22 +++ sh.scpp 2003/02/11 12:56:40 1.23 @@ -58,7 +58,7 @@ done if [ ".$awk" = . ]; then echo "$msgprefix:Error: cannot find a reasonable Awk" 1>&2 - exit 1 + shtool_exit 1 fi # parse source file(s) Index: ossp-pkg/shtool/sh.subst RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.subst,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.subst,v' 2>/dev/null --- sh.subst 2002/02/23 09:18:03 1.5 +++ sh.subst 2003/02/11 12:56:40 1.6 @@ -42,11 +42,11 @@ # parameter consistency check if [ $# -eq 0 -a ".$opt_b" != . ]; then echo "$msgprefix:Error: option -b cannot be applied to stdin" 1>&2 - exit 1 + shtool_exit 1 fi if [ $# -eq 0 -a ".$opt_s" = .yes ]; then echo "$msgprefix:Error: option -s cannot be applied to stdin" 1>&2 - exit 1 + shtool_exit 1 fi # build underlying sed(1) command @@ -60,12 +60,12 @@ elif [ ".$opt_f" != . ]; then if [ ! -f $opt_f ]; then echo "$msgprefix:Error: command file \`$opt_f' not found or not a regular file" 1>&2 - exit 1 + shtool_exit 1 fi sedcmd="$sedcmd -f '$opt_f'" else echo "$msgprefix:Error: either -e option(s) or -f option required" 1>&2 - exit 1 + shtool_exit 1 fi # determine extension for original file Index: ossp-pkg/shtool/sh.table RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.table,v rcsdiff -q -kk '-r1.16' '-r1.17' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.table,v' 2>/dev/null --- sh.table 2001/12/31 15:06:04 1.16 +++ sh.table 2003/02/11 12:56:40 1.17 @@ -33,11 +33,11 @@ if [ $opt_c -gt 4 ]; then echo "$msgprefix:Error: Invalid number of colums (1..4 allowed only)" 1>&2 - exit 1 + shtool_exit 1 fi case "x$opt_F" in x? ) ;; - * ) echo "$msgprefix:Error: Invalid separator (one char allowed only)" 1>&2; exit 1 ;; + * ) echo "$msgprefix:Error: Invalid separator (one char allowed only)" 1>&2; shtool_exit 1 ;; esac # split the list into a table Index: ossp-pkg/shtool/sh.tarball RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.tarball,v rcsdiff -q -kk '-r1.16' '-r1.17' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.tarball,v' 2>/dev/null --- sh.tarball 2001/12/31 15:06:04 1.16 +++ sh.tarball 2003/02/11 12:56:40 1.17 @@ -149,7 +149,7 @@ if [ ".$opt_t" = .yes ]; then echo "mkdir $tmpdir/$tarname" 1>&2 fi - mkdir $tmpdir/$tarname || exit 1 + mkdir $tmpdir/$tarname || shtool_exit 1 if [ ".$opt_t" = .yes ]; then echo "cat $tmpfile.lst | xargs $prg_tar cf - | (cd $tmpdir/$tarname && $prg_tar xf -)" 1>&2 fi Index: ossp-pkg/shtool/sh.version RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.version,v rcsdiff -q -kk '-r1.32' '-r1.33' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.version,v' 2>/dev/null --- sh.version 2002/02/23 09:18:03 1.32 +++ sh.version 2003/02/11 12:56:40 1.33 @@ -46,7 +46,7 @@ # use given triple if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2 - exit 1 + shtool_exit 1 fi eval `echo $triple |\ sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\ @@ -79,7 +79,7 @@ l ) lev=`expr $lev + 1` ;; * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2 - exit 1 + shtool_exit 1 ;; esac tim=calc @@ -173,7 +173,7 @@ echo "${hex}" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2 - exit 1 + shtool_exit 1 ;; esac else @@ -299,7 +299,7 @@ echo >>$file "" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2 - exit 1 + shtool_exit 1 ;; esac fi Index: ossp-pkg/shtool/shtoolize.in RCS File: /v/ossp/cvs/ossp-pkg/shtool/shtoolize.in,v rcsdiff -q -kk '-r1.28' '-r1.29' -u '/v/ossp/cvs/ossp-pkg/shtool/shtoolize.in,v' 2>/dev/null --- shtoolize.in 2001/12/31 15:10:59 1.28 +++ shtoolize.in 2003/02/11 12:56:40 1.29 @@ -511,9 +511,8 @@ print OUT <<"EOT"; esac -exit 0 +shtool_exit 0 -##EOF## EOT close(OUT); chmod(0755, $opt_o);