shtool update to 1.6.2?

From: Date: Wed, 06 Nov 2002 14:36:50 +0000
Subject: shtool update to 1.6.2?
Groups: php.dev 
Request: Send a blank email to php-dev+get-90560@lists.php.net to get a copy of this message
Will we update shtool from 1.5.4 (our current version) to 1.6.2 (actual version)? I just tried it and it seems to work. But i would like to here other meanings before commiting. marcus ChangeLog Changes between 1.6.1 and 1.6.2 (12-Jul-2002 to 02-Nov-2002): *) Map "shtool install -d <dir> [...]" internally to "shtool mkdir
      -f -p -m 755 <dir> [...]" in order to support the BSD-style
      "install -d" variant.
      [Ralf S. Engelschall, Alan Eldridge <alane@geeksrus.net>]
*) Add -o|--owner and -g|--group options to "shtool mkdir".
      [Ralf S. Engelschall]
*) Fixed 'shtool scpp -f ...'. The arguments to option -f
      were not evaluated correctly.
      [Ralf S. Engelschall]
*) Support bold font on 'cygwin' terminals.
      [Marcus Boerger <marcus.boerger@t-online.de>]
*) Try the terminal 'init' sequence before 'reset' for bold mode
      restoring in order to make sure the terminal is not cleared.
      Additionally, fallback to a consistent no-bold mode.
      [Mirko Liss <mirko.liss@web.de>]
Changes between 1.6.0 and 1.6.1 (01-Feb-2002 to 12-Jul-2002): *) Removed not-existing --min-size option from the usage
      of "shtool rotate". The name is just --size.
      [Thomas Linden <tom@izb.net>]
*) Port to POSIX 1003.1-2001 (SUSv3) standard:
      sh.echo, sh.version: "head -1" -> "sed -e 'q'"
      sh.path: "sort -u | tail -1" -> "sort -r -u | sed -e q"
      sh.subst: diff -u1 -> diff -U1
      [Paul Eggert <eggert@twinsun.com>]
*) Fixed various typos in shtool.pod.
      [Ralf S. Engelschall, Liones <liones@myrealbox.com>]
Changes between 1.5.4 and 1.6.0 (14-Jun-2001 to 01-Feb-2002): *) Upgraded to GNU Autoconf 2.52 environment.
      [Ralf S. Engelschall]
*) Fixed contained RPM specification (shtool.spec)
      [Ralf S. Engelschall]
*) Added new command `shtool rotate [-v|--verbose] [-t|--trace]
      [-f|--force] [-n|--num-files <count>] [-s|--min-size <size>]
      [-c|--copy] [-r|--remove] [-a|--archive-dir <dir>] [-z|--compress
      [<tool>:]<level>] [-b|--background] [-d|--delay] [-p|--pad <len>]
      [-o|--owner <owner>] [-g|--group <group>] [-m|--mode <mode>]
      [-M|--migrate <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>]
      [<file> ...]'. This is a sophisticated command for rotating
      logfiles of daemons.
      [Ralf S. Engelschall]
*) Added GNU long-option support (`--xxxx').
      [Ralf S. Engelschall]
*) Cleaned up temporary file handling in `shtool path'.
      [Ralf S. Engelschall]
*) Added NEWS file to source tree to comply to GNU standards.
      [Ralf S. Engelschall]
*) Add new `shtool subst [-v] [-t] [-n] [-s] [-i] [-b<ext>]
      [-e<cmd>] [-f<cmd-file>] [<file>] [...]' command. This
      is a useful wrapper around sed(1).
      [Ralf S. Engelschall]
Diff: cvs -z3 -q diff shtool (in directory S:\php4-HEAD\build\) Index: shtool =================================================================== RCS file: /repository/php4/build/shtool,v retrieving revision 1.3 diff -u -r1.3 shtool
--- shtool      7 Mar 2002 14:17:56 -0000       1.3
+++ shtool      6 Nov 2002 13:57:36 -0000
@@ -1,13 +1,13 @@ #!/bin/sh ## ## GNU shtool -- The GNU Portable Shell Tool -## Copyright (c) 1994-2001 Ralf S. Engelschall <rse@engelschall.com> +## Copyright (c) 1994-2002 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: 1.5.4 (14-Jun-2001) -## Contents: 3/17 available modules +## Version: 1.6.2 (02-Nov-2002) +## Contents: 3/19 available modules ## ## @@ -50,7 +50,9 @@
 ##    mkln       Make link with calculation of relative paths
 ##    mkshadow   Make a shadow tree through symbolic links
 ##    fixperm    Fix file permissions inside a source tree
+##    rotate     Logfile rotation
 ##    tarball    Roll distribution tarballs
+##    subst      Apply sed(1) substitution operations
 ##    guessos    Simple operating system guesser
 ##    arx        Extended archive command
 ##    slo        Separate linker options by library class
@@ -65,8 +67,8 @@
     exit 1
fi if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
-    echo "This is GNU shtool, version 1.5.4 (14-Jun-2001)"
-    echo "Copyright (c) 1994-2001 Ralf S. Engelschall <rse@engelschall.com>"
+    echo "This is GNU shtool, version 1.6.2 (02-Nov-2002)"
+    echo "Copyright (c) 1994-2002 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>]]"
@@ -78,38 +80,63 @@
     echo '  -r, --recreate  recreate this shtool script via shtoolize'
     echo ''
     echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
-    echo '  echo     [-n] [-e] [<str> ...]'
-    echo '  install  [-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>]'
-    echo '           [-e<sed-cmd>] <file> [<file> ...] <path>'
-    echo '  mkdir    [-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]'
+    echo '  echo     [-n|--newline] [-e|--expand] [<str> ...]'
+    echo '  install  [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]'
+    echo '           [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>]'
+    echo '           [-o|--owner <owner>] [-g|--group <group>] [-e|--exec'
+    echo '           <sed-cmd>] <file> [<file> ...] <path>'
+    echo '  mkdir    [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode'
+    echo '           <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir>'
+    echo '           [<dir> ...]'
     echo ''
     echo 'Not available <cmd-name> (because module was not built-in):'
-    echo '  mdate    [-n] [-z] [-s] [-d] [-f<str>] [-o<spec>] <path>'
-    echo '  table    [-F<sep>] [-w<width>] [-c<cols>] [-s<strip>] <str><sep><str>...'
-    echo '  prop     [-p<str>]'
-    echo '  move     [-v] [-t] [-e] [-p] <src-file> <dst-file>'
-    echo '  mkln     [-t] [-f] [-s] <src-path> [<src-path> ...] <dst-path>'
-    echo '  mkshadow [-v] [-t] [-a] <src-dir> <dst-dir>'
-    echo '  fixperm  [-v] [-t] <path> [<path> ...]'
-    echo '  tarball  [-t] [-v] [-o<tarball>] [-c<prog>] [-d<dir>] [-u<user>]'
-    echo '           [-g<group>] [-e<pattern>] <path> [<path> ...]'
+    echo '  mdate    [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]'
+    echo '           [-f|--field-sep <str>] [-o|--order <spec>] <path>'
+    echo '  table    [-F|--field-sep <sep>] [-w|--width <width>] [-c|--columns'
+    echo '           <cols>] [-s|--strip <strip>] <str><sep><str>...'
+    echo '  prop     [-p|--prefix <str>]'
+    echo '  move     [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]'
+    echo '           <src-file> <dst-file>'
+    echo '  mkln     [-t|--trace] [-f|--force] [-s|--symbolic] <src-path>'
+    echo '           [<src-path> ...] <dst-path>'
+    echo '  mkshadow [-v|--verbose] [-t|--trace] [-a|--all] <src-dir> <dst-dir>'
+    echo '  fixperm  [-v|--verbose] [-t|--trace] <path> [<path> ...]'
+    echo '  rotate   [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files'
+    echo '           <count>] [-s|--size <size>] [-c|--copy] [-r|--remove]'
+    echo '           [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>]'
+    echo '           [-b|--background] [-d|--delay] [-p|--pad <len>] [-o|--owner'
+    echo '           <owner>] [-g|--group <group>] [-m|--mode <mode>] [-M|--migrate'
+    echo '           <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]'
+    echo '  tarball  [-t|--trace] [-v|--verbose] [-o|--output <tarball>]'
+    echo '           [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user'
+    echo '           <user>] [-g|--group <group>] [-e|--exclude <pattern>]'
+    echo '           <path> [<path> ...]'
+    echo '  subst    [-v|--verbose] [-t|--trace] [-n|--nop] [-s|--stealth]'
+    echo '           [-i|--interactive] [-b|--backup <ext>] [-e|--exec <cmd>]'
+    echo '           [-f|--file <cmd-file>] [<file>] [...]'
     echo '  guessos  '
-    echo '  arx      [-t] [-C<cmd>] <op> <archive> [<file> ...]'
-    echo '  slo      [-p<str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]'
-    echo '  scpp     [-v] [-p] [-f<filter>] [-o<ofile>] [-t<tfile>] [-M<mark>]'
-    echo '           [-D<dname>] [-C<cname>] <file> [<file> ...]'
-    echo '  version  [-l<lang>] [-n<name>] [-p<prefix>] [-s<version>] [-e]'
-    echo '           [-i<knob>] [-d<type>] <file>'
-    echo '  path     [-s] [-r] [-d] [-b] [-m] [-p<path>] <str> [<str> ...]'
+    echo '  arx      [-t|--trace] [-C|--command <cmd>] <op> <archive> [<file>'
+    echo '           ...]'
+    echo '  slo      [-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib>'
+    echo '           ...]'
+    echo '  scpp     [-v|--verbose] [-p|--preserve] [-f|--filter <filter>]'
+    echo '           [-o|--output <ofile>] [-t|--template <tfile>] [-M|--mark'
+    echo '           <mark>] [-D|--define <dname>] [-C|--class <cname>]'
+    echo '           <file> [<file> ...]'
+    echo '  version  [-l|--language <lang>] [-n|--name <name>] [-p|--prefix'
+    echo '           <prefix>] [-s|--set <version>] [-e|--edit] [-i|--increase'
+    echo '           <knob>] [-d|--display <type>] <file>'
+    echo '  path     [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]'
+    echo '           [-m|--magic] [-p|--path <path>] <str> [<str> ...]'
     echo ''
     exit 0
fi if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
-    echo "GNU shtool 1.5.4 (14-Jun-2001)"
+    echo "GNU shtool 1.6.2 (02-Nov-2002)"
     exit 0
fi if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
-    shtoolize -ofoo echo install mkdir
+    shtoolize -oshtool echo install mkdir
     exit 0
fi if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then @@ -139,19 +166,22 @@ case $tool in
     echo )
         str_tool="echo"
-        str_usage="[-n] [-e] [<str> ...]"
+        str_usage="[-n|--newline] [-e|--expand] [<str> ...]"
         arg_spec="0+"
         opt_spec="n.e."
+        opt_alias="n:newline,e:expand"
         opt_n=no
         opt_e=no
         ;;
     install )
         str_tool="install"
-        str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<sed-cmd>] <file> [<file> ...] <path>"
-        arg_spec="2+"
-        opt_spec="v.t.c.C.s.m:o:g:e+"
+        str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] [-e|--exec <sed-cmd>] <file> [<file> ...] <path>"
+        arg_spec="1+"
+        opt_spec="v.t.d.c.C.s.m:o:g:e+"
+ opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec"
         opt_v=no
         opt_t=no
+        opt_d=no
         opt_c=no
         opt_C=no
         opt_s=no
@@ -162,13 +192,16 @@
         ;;
     mkdir )
         str_tool="mkdir"
-        str_usage="[-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]"
+        str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir> [<dir> ...]"
         arg_spec="1+"
-        opt_spec="t.f.p.m:"
+        opt_spec="t.f.p.m:o:g:"
+        opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group"
         opt_t=no
         opt_f=no
         opt_p=no
         opt_m=""
+        opt_o=""
+        opt_g=""
         ;;
     -* )
         echo "$0:Error: unknown option \`$tool'" 2>&1
@@ -186,6 +219,11 @@ ## COMMON UTILITY CODE ## +# commonly used ASCII values
+ASC_TAB="      "
+ASC_NL=" +" + # determine name of tool if [ ".$tool" != . ]; then
     #   used inside shtool script
@@ -207,6 +245,10 @@ eval `echo h.$opt_spec |\
       sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
+# parse option alias string +eval `echo h:help,$opt_alias |\
+      tr 'x-' 'x_' | sed -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
+ # interate over argument line opt_PREV='' while [ $# -gt 0 ]; do @@ -227,6 +269,18 @@
     else
         #   split argument into option and argument
         case "$1" in
+            --[a-zA-Z0-9]*=*)
+                eval `echo "x$1" |\
+                      sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
+                opt_STR=echo $opt_OPT | tr 'x-' 'x_'
+                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
+                ;;
+            --[a-zA-Z0-9]*)
+                opt_OPT=echo "x$1" | cut -c4-
+                opt_STR=echo $opt_OPT | tr 'x-' 'x_'
+                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
+                opt_ARG=''
+                ;;
             -[a-zA-Z0-9]*)
                 eval `echo "x$1" |\
                       sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
@@ -266,17 +320,17 @@
             ;;
         '+' )
             #   option with argument (multiple occurances append)
-            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
+            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\""
             ;;
         * )
-            echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
+            echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2
             echo "$msgprefix:Hint:  run \$toolcmdhelp -h' or \man shtool' for details" 1>&2
             exit 1
             ;;
     esac
done if [ ".$opt_PREV" != . ]; then
-    echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
+    echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2
     echo "$msgprefix:Hint:  run \$toolcmdhelp -h' or \man shtool' for details" 1>&2
     exit 1
fi @@ -329,7 +383,7 @@ echo )
     ##
     ##  echo -- Print string with optional construct expansion
-    ##  Copyright (c) 1998-2001 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1998-2002 Ralf S. Engelschall <rse@engelschall.com>
     ##  Originally written for WML as buildinfo
     ##
@@ -362,7 +416,7 @@
                 term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
                 term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
                 ;;
-            vt100|vt100*)
+            vt100|vt100*|cygwin)
                 term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
                 term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
                 ;;
@@ -380,7 +434,7 @@
                                 fi
                             done
                             if [ ".$term_bold" != . ]; then
-                                for seq in sgr0 me rmso reset; do # 'reset' is last
+                                for seq in sgr0 me rmso init reset; do # 'reset' is last
                                     norm="$dir/$tool $seq 2>/dev/null"
                                     if [ ".$norm" != . ]; then
                                         term_norm="$norm"
@@ -399,6 +453,8 @@
         esac
         if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
             echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
+            term_bold=''
+            term_norm=''
         fi
     fi
@@ -498,13 +554,13 @@
     if [ ".$opt_e" = .yes -a ".echo $text | egrep '%d'" != . ]; then
         if [ ".$domainname" = . ]; then
             if [ -f /etc/resolv.conf ]; then
-                domainname="`egrep '^[         ]*domain' /etc/resolv.conf | head -1 |\
+                domainname="`egrep '^[         ]*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 | head -1 |\
+                    domainname="`egrep '^[     ]*search' /etc/resolv.conf | sed -e 'q' |\
                                  sed -e 's/.*search//' \
                                      -e 's/^[  ]*//' -e 's/^ *//' -e 's/^      *//' \
                                      -e 's/ .*//' -e 's/       .*//' \
@@ -581,10 +637,32 @@ install )
     ##
     ##  install -- Install a program, script or datafile
-    ##  Copyright (c) 1997-2001 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1997-2002 Ralf S. Engelschall <rse@engelschall.com>
     ##  Originally written for shtool
     ##
+    #   special case: "shtool install -d <dir> [...]" internally
+    #   maps to "shtool mkdir -f -p -m 755 <dir> [...]"
+    if [ "$opt_d" = yes ]; then
+        cmd="$0 mkdir -f -p -m 755"
+        if [ ".$opt_o" != . ]; then
+            cmd="$cmd -o '$opt_o'"
+        fi
+        if [ ".$opt_g" != . ]; then
+            cmd="$cmd -g '$opt_g'"
+        fi
+        if [ ".$opt_v" = .yes ]; then
+            cmd="$cmd -v"
+        fi
+        if [ ".$opt_t" = .yes ]; then
+            cmd="$cmd -t"
+        fi
+        for dir in "$@"; do
+            eval "$cmd $dir" || exit $?
+        done
+        exit 0
+    fi
+
     #   determine source(s) and destination
     argc=$#
     srcs=""
@@ -657,7 +735,9 @@
         #   adjust the target file
         if [ ".$opt_e" != . ]; then
             sed='sed'
-            for e in $opt_e; do
+            OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS"
+            for e
+            do
                 sed="$sed -e '$e'"
             done
             cp $dsttmp $dsttmp.old
@@ -718,7 +798,7 @@ mkdir )
     ##
     ##  mkdir -- Make one or more directories
-    ##  Copyright (c) 1996-2001 Ralf S. Engelschall <rse@engelschall.com>
+    ##  Copyright (c) 1996-2002 Ralf S. Engelschall <rse@engelschall.com>
     ##  Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
     ##  Cleaned up and enhanced for shtool
     ##
@@ -741,6 +821,18 @@
                 echo "mkdir $p" 1>&2
             fi
             mkdir $p || errstatus=$?
+            if [ ".$opt_o" != . ]; then
+                if [ ".$opt_t" = .yes ]; then
+                    echo "chown $opt_o $p" 1>&2
+                fi
+                chown $opt_o $p || errstatus=$?
+            fi
+            if [ ".$opt_g" != . ]; then
+                if [ ".$opt_t" = .yes ]; then
+                    echo "chgrp $opt_g $p" 1>&2
+                fi
+                chgrp $opt_g $p || errstatus=$?
+            fi
             if [ ".$opt_m" != . ]; then
                 if [ ".$opt_t" = .yes ]; then
                     echo "chmod $opt_m $p" 1>&2
@@ -766,6 +858,18 @@
                         echo "mkdir $pathcomp" 1>&2
                     fi
                     mkdir $pathcomp || errstatus=$?
+                    if [ ".$opt_o" != . ]; then
+                        if [ ".$opt_t" = .yes ]; then
+                            echo "chown $opt_o $pathcomp" 1>&2
+                        fi
+                        chown $opt_o $pathcomp || errstatus=$?
+                    fi
+                    if [ ".$opt_g" != . ]; then
+                        if [ ".$opt_t" = .yes ]; then
+                            echo "chgrp $opt_g $pathcomp" 1>&2
+                        fi
+                        chgrp $opt_g $pathcomp || errstatus=$?
+                    fi
                     if [ ".$opt_m" != . ]; then
                         if [ ".$opt_t" = .yes ]; then
                             echo "chmod $opt_m $pathcomp" 1>&2


« previous php.dev (#90560) next »