OSSP CVS Repository

ossp - Check-in [5958]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5958
Date: 2007-Jul-08 11:25:29 (local)
2007-Jul-08 09:25:29 (UTC)
User:rse
Branch:
Comment: upgrade shtool
Tickets:
Inspections:
Files:
ossp-pkg/iselect/etc/shtool      1.3 -> 1.4     98 inserted, 59 deleted

ossp-pkg/iselect/etc/shtool 1.3 -> 1.4

--- shtool       2005/10/05 18:04:52     1.3
+++ shtool       2007/07/08 09:25:29     1.4
@@ -1,12 +1,12 @@
 #!/bin/sh
 ##
 ##  GNU shtool -- The GNU Portable Shell Tool
-##  Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  See http://www.gnu.org/software/shtool/ for more information.
 ##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
 ##
-##  Version:  2.0.3 (02-Oct-2005)
+##  Version:  2.0.7 (19-May-2007)
 ##  Contents: all available modules
 ##
 
@@ -59,17 +59,42 @@
 ##    path       Deal with program paths
 ##
 
+#   maximum Bourne-Shell compatibility
+if [ ".$ZSH_VERSION" != . ] && (emulate sh) >/dev/null 2>&1; then
+    #   reconfigure zsh(1)
+    emulate sh
+    NULLCMD=:
+    alias -g '${1+"$@"}'='"$@"'
+elif [ ".$BASH_VERSION" != . ] && (set -o posix) >/dev/null 2>&1; then
+    #   reconfigure bash(1)
+    set -o posix
+fi
+
+#   maximum independence of NLS nuisances
+for var in \
+    LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+    LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+    LC_TELEPHONE LC_TIME
+do
+    if (set +x; test -z "`(eval $var=C; export $var) 2>&1`"); then
+        eval $var=C; export $var
+    else
+        unset $var
+    fi
+done
+
+#   initial command line handling
 if [ $# -eq 0 ]; then
     echo "$0:Error: invalid command line" 1>&2
     echo "$0:Hint:  run \`$0 -h' for usage" 1>&2
     exit 1
 fi
 if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
-    echo "This is GNU shtool, version 2.0.3 (02-Oct-2005)"
-    echo "Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>"
-    echo "Report bugs to <bug-shtool@gnu.org>"
+    echo "This is GNU shtool, version 2.0.7 (19-May-2007)"
+    echo 'Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>'
+    echo 'Report bugs to <bug-shtool@gnu.org>'
     echo ''
-    echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
+    echo 'Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]'
     echo ''
     echo 'Available global <options>:'
     echo '  -v, --version   display shtool version information'
@@ -132,7 +157,7 @@
     exit 0
 fi
 if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
-    echo "GNU shtool 2.0.3 (02-Oct-2005)"
+    echo "GNU shtool 2.0.7 (19-May-2007)"
     exit 0
 fi
 if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
@@ -314,7 +339,7 @@
         opt_d=""
         opt_u=""
         opt_g=""
-        opt_e="CVS,\\.cvsignore,\\.[oa]\$"
+        opt_e="CVS,\\.cvsignore,\\.svn,\\.[oa]\$"
         ;;
     subst )
         str_tool="subst"
@@ -622,7 +647,7 @@
 echo )
     ##
     ##  echo -- Print string with optional construct expansion
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     text="$*"
@@ -743,11 +768,14 @@
                         userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
                                 sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
                         if [ ".$userid" = . ]; then
-                            userid=`(ypcat passwd) 2>/dev/null |
-                                    grep "^${username}:" | \
-                                    sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
+                            userid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
+                                    sed -e 'q' | sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
                             if [ ".$userid" = . ]; then
-                                userid='?'
+                                userid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
+                                        sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
+                                if [ ".$userid" = . ]; then
+                                    userid='?'
+                                fi
                             fi
                         fi
                     fi
@@ -772,10 +800,14 @@
                     groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
                              sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
                     if [ ".$groupid" = . ]; then
-                        groupid=`(ypcat passwd) 2>/dev/null | grep "^${username}:" | \
-                                 sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+                        groupid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
+                                 sed -e 'q' | sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
                         if [ ".$groupid" = . ]; then
-                            groupid='?'
+                            groupid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
+                                     sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+                            if [ ".$groupid" = . ]; then
+                                groupid='?'
+                            fi
                         fi
                     fi
                 fi
@@ -800,11 +832,16 @@
                     groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
                                sed -e 's/:.*$//'`
                     if [ ".$groupname" = . ]; then
-                        groupname=`(ypcat group) 2>/dev/null | \
-                                   grep "^[^:]*:[^:]*:${groupid}:" | \
+                        groupname=`(ypcat group; niscat group) 2>/dev/null | \
+                                   sed -e 'q' | grep "^[^:]*:[^:]*:${groupid}:" | \
                                    sed -e 's/:.*$//'`
                         if [ ".$groupname" = . ]; then
-                            groupname='?'
+                            groupname=`(nidump group .) 2>/dev/null | \
+                                       grep "^[^:]*:[^:]*:${groupid}:" | \
+                                       sed -e 's/:.*$//'`
+                            if [ ".$groupname" = . ]; then
+                                groupname='?'
+                            fi
                         fi
                     fi
                 fi
@@ -921,7 +958,7 @@
     ##
     ##  mdate -- Pretty-print modification time of a file or dir
     ##  Copyright (c) 1995-1997 Free Software Foundation, Inc.
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     fod="$1"
@@ -937,11 +974,6 @@
         shtool_exit 1
     fi
 
-    #   prevent "date" giving response in another language
-    LANG=C;    export LANG
-    LC_ALL=C;  export LC_ALL
-    LC_TIME=C; export LC_TIME
-
     #   GNU ls changes its time format in response to the TIME_STYLE
     #   variable. Since we cannot assume "unset" works, revert this
     #   variable to its documented default.
@@ -1054,7 +1086,7 @@
 table )
     ##
     ##  table -- Pretty-print a field-separated list as a table
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     if [ $opt_c -gt 4 ]; then
@@ -1119,7 +1151,7 @@
 prop )
     ##
     ##  prop -- Display progress with a running propeller
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     perl=''
@@ -1165,7 +1197,7 @@
 move )
     ##
     ##  move -- Move files with simultaneous substitution
-    ##  Copyright (c) 1999-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     src="$1"
@@ -1257,7 +1289,7 @@
 install )
     ##
     ##  install -- Install a program, script or datafile
-    ##  Copyright (c) 1997-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1997-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     #   special case: "shtool install -d <dir> [...]" internally
@@ -1343,12 +1375,12 @@
             if [ ".$opt_t" = .yes ]; then
                 echo "cp $src $dsttmp" 1>&2
             fi
-            cp $src $dsttmp || shtool_exit $?
+            cp "$src" "$dsttmp" || shtool_exit $?
         else
             if [ ".$opt_t" = .yes ]; then
                 echo "mv $src $dsttmp" 1>&2
             fi
-            mv $src $dsttmp || shtool_exit $?
+            mv "$src" "$dsttmp" || shtool_exit $?
         fi
 
         #   adjust the target file
@@ -1359,7 +1391,7 @@
             do
                 sed="$sed -e '$e'"
             done
-            cp $dsttmp $dsttmp.old
+            cp "$dsttmp" "$dsttmp.old"
             chmod u+w $dsttmp
             eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $?
             rm -f $dsttmp.old
@@ -1394,7 +1426,7 @@
         quick=no
         if [ ".$opt_C" = .yes ]; then
             if [ -r $dst ]; then
-                if cmp -s $src $dst; then
+                if cmp -s "$src" "$dst"; then
                     quick=yes
                 fi
             fi
@@ -1420,7 +1452,7 @@
 mkdir )
     ##
     ##  mkdir -- Make one or more directories
-    ##  Copyright (c) 1996-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1996-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     errstatus=0
@@ -1508,7 +1540,7 @@
 mkln )
     ##
     ##  mkln -- Make link with calculation of relative paths
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     #   determine source(s) and destination
@@ -1613,12 +1645,17 @@
         #   determine source prefix which is the reverse directory
         #   step-up corresponding to the destination directory
         srcpre=""
-
-        isroot=0
-        if [ ".$prefix" = . ] || [ ".$prefix" = ./ ]; then
-            isroot=1
-        fi
-        if [ $oneisabs = 0 ] || [ $isroot = 0 ]; then
+        allow_relative_srcpre=no
+        if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then
+            allow_relative_srcpre=yes
+        fi  
+        if [ $oneisabs = 0 ]; then
+            allow_relative_srcpre=yes
+        fi  
+        if [ ".$opt_s" != .yes ]; then
+            allow_relative_srcpre=no
+        fi  
+        if [ ".$allow_relative_srcpre" = .yes ]; then
             pl="$dstdir/"
             OIFS="$IFS"; IFS='/'
             for pe in $pl; do
@@ -1659,7 +1696,7 @@
 mkshadow )
     ##
     ##  mkshadow -- Make a shadow tree through symbolic links
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     #   source and destination directory
@@ -1777,7 +1814,7 @@
 fixperm )
     ##
     ##  fixperm -- Fix file permissions inside a source tree
-    ##  Copyright (c) 1996-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1996-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     paths="$*"
@@ -1834,7 +1871,7 @@
 rotate )
     ##
     ##  rotate -- Logfile rotation
-    ##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     #   make sure we have at least one file to rotate
@@ -2198,7 +2235,7 @@
 tarball )
     ##
     ##  tarball -- Roll distribution tarballs
-    ##  Copyright (c) 1999-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     srcs="$*"
@@ -2362,7 +2399,7 @@
 subst )
     ##
     ##  subst -- Apply sed(1) substitution operations
-    ##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 2001-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     #   remember optional list of file(s)
@@ -2523,7 +2560,7 @@
 platform )
     ##
     ##  platform -- Platform Identification Utility
-    ##  Copyright (c) 2003-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 2003-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     #   option post-processing
@@ -2751,12 +2788,17 @@
             #   determine architecture
             AT="${UNAME_MACHINE}"
             case "${AT}" in
-                i86pc ) AT="iX86" ;;
+                i86pc )
+                    AT="iX86"
+                    case "`(/bin/isainfo -k) 2>&1`" in
+                        amd64 ) AT="AMD64" ;;
+                    esac
+                    ;;
             esac
             AP="${AT}"
             case "${AP}" in
                 sun4[cdm] ) AP="SPARC32" ;;
-                sun4u     ) AP="SPARC64" ;;
+                sun4[uv]  ) AP="SPARC64" ;;
                 sun4*     ) AP="SPARC"   ;;
             esac
             AC="${AP}"
@@ -3071,7 +3113,7 @@
 arx )
     ##
     ##  arx -- Extended archive command
-    ##  Copyright (c) 1999-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     ar_prg="$opt_C"
@@ -3150,7 +3192,7 @@
 slo )
     ##
     ##  slo -- Separate linker options by library class
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     DIFS="$IFS"
@@ -3309,7 +3351,7 @@
 scpp )
     ##
     ##  scpp -- Sharing C Pre-Processor
-    ##  Copyright (c) 1999-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1999-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     srcs="$*"
@@ -3529,7 +3571,7 @@
 version )
     ##
     ##  version -- Maintain a version information file
-    ##  Copyright (c) 1994-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1994-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     file="$1"
@@ -3686,17 +3728,14 @@
         vGNU="${name} ${triple} (${tim})"
         vWeb="${name}/${triple}"
         vSCCS="@(#)${name} ${triple} (${tim})"
-        vRCS="\$Id: shtool,v 1.3 2005/10/05 18:04:52 rse Exp ${name} ${triple} (${tim}) \$"
+        vRCS="\$Id: shtool,v 1.4 2007/07/08 09:25:29 rse Exp ${name} ${triple} (${tim}) \$"
 
         #   determine string out of filename
         #   (do NOT try to optimize this in any way because of portability)
-        filestr=`echo $file |\
-                 tr 'abcdefghijklmnopqrstuvwxyz./%+' \
-                    'ABCDEFGHIJKLMNOPQRSTUVWXYZ____' | sed -e 's/-/_/g'`
+        filestr=`util_upper "$file" | tr './%+' '____' | sed -e 's/-/_/g'`
 
         #   generate uppercase prefix
-        prefixupper=`echo $prefix |\
-                     tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+        prefixupper=`util_upper "$prefix"`
 
         #   create the version file according the the selected language
         echo "new version: ${vLong}"
@@ -3824,7 +3863,7 @@
 path )
     ##
     ##  path -- Deal with program paths
-    ##  Copyright (c) 1998-2005 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2007 Ralf S. Engelschall <rse@engelschall.com>
     ##
 
     namelist="$*"

CVSTrac 2.0.1