OSSP CVS Repository

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

Check-in Number: 3780
Date: 2001-Jul-15 18:45:29 (local)
2001-Jul-15 16:45:29 (UTC)
User:rse
Branch:
Comment: *** empty log message ***
Tickets:
Inspections:
Files:
ossp-pkg/pth/shtool      1.50->removed

ossp-pkg/pth/shtool 1.50 -> 1.51

--- shtool       2001/04/21 19:08:10     1.50
+++ shtool       2001/07/15 16:45:29     1.51
@@ -6,7 +6,7 @@
 ##  See http://www.gnu.org/software/shtool/ for more information.
 ##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
 ##
-##  Version:  1.5.3 (19-Apr-2001)
+##  Version:  1.5.4 (14-Jun-2001)
 ##  Contents: 7/17 available modules
 ##
 
@@ -65,11 +65,11 @@
     exit 1
 fi
 if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
-    echo "This is GNU shtool, version 1.5.3 (19-Apr-2001)"
+    echo "This is GNU shtool, version 1.5.4 (14-Jun-2001)"
     echo "Copyright (c) 1994-2001 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'
@@ -105,7 +105,7 @@
     exit 0
 fi
 if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
-    echo "GNU shtool 1.5.3 (19-Apr-2001)"
+    echo "GNU shtool 1.5.4 (14-Jun-2001)"
     exit 0
 fi
 if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
@@ -404,7 +404,7 @@
     fi
     
     #   determine terminal bold sequence
-    term_bold='' 
+    term_bold=''
     term_norm=''
     if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
         case $TERM in
@@ -455,7 +455,7 @@
     
     #   determine user name
     username=''
-    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uU]'`" != . ]; then
+    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uUgG]'`" != . ]; then
         username="$LOGNAME"
         if [ ".$username" = . ]; then
             username="$USER"
@@ -497,8 +497,38 @@
         fi
     fi
     
-    #   determine host name
+    #   determine (primary) group id
+    groupid=''
+    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[gG]'`" != . ]; then
+        groupid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
+                 sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+        if [ ".$groupid" = . ]; then
+            groupid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \
+                     sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
+            if [ ".$groupid" = . ]; then
+                groupid='?'
+            fi
+        fi
+    fi
+    
+    #   determine (primary) group name
+    groupname=''
+    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%g'`" != . ]; then
+        groupname=`egrep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
+                   sed -e 's/:.*$//'`
+        if [ ".$groupname" = . ]; then
+            groupname=`(ypcat group) 2>/dev/null | \
+                       egrep "^[^:]*:[^:]*:${groupid}:" | \
+                       sed -e 's/:.*$//'`
+            if [ ".$groupname" = . ]; then
+                groupname='?'
+            fi
+        fi
+    fi
+    
+    #   determine host and domain name
     hostname=''
+    domainname=''
     if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
         hostname="`(uname -n) 2>/dev/null |\
                    awk '{ printf("%s", $1); }'`"
@@ -516,9 +546,6 @@
                 ;;
         esac
     fi
-    
-    #   determine domain name
-    domainname=''
     if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
         if [ ".$domainname" = . ]; then
             if [ -f /etc/resolv.conf ]; then
@@ -578,6 +605,8 @@
                   -e "s/%b/${term_norm}/g" \
                   -e "s/%u/${username}/g" \
                   -e "s/%U/${userid}/g" \
+                  -e "s/%g/${groupname}/g" \
+                  -e "s/%G/${groupid}/g" \
                   -e "s/%h/${hostname}/g" \
                   -e "s/%d/${domainname}/g" \
                   -e "s/%D/${time_day}/g" \
@@ -607,7 +636,7 @@
     ##  Originally written for shtool
     ##
     
-    #   determine source(s) and destination 
+    #   determine source(s) and destination
     argc=$#
     srcs=""
     while [ $# -gt 1 ]; do
@@ -1299,7 +1328,7 @@
             echo dummy | awk '{ printf("new version: "); }'
             read triple
             case $triple in
-                [0-9]*.[0-9]*[sabp.][0-9]* ) 
+                [0-9]*.[0-9]*[sabp.][0-9]* )
                     ;;
                 * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2
                     continue
@@ -1383,7 +1412,7 @@
                 exit 1
                 ;;
         esac
-    else 
+    else
         #   update the version file
     
         #   pre-generate various strings
@@ -1406,7 +1435,7 @@
         #   generate uppercase prefix
         prefixupper=`echo $prefix |\
                      tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-        
+    
         #   create the version file according the the selected language
         echo "new version: ${vLong}"
     

CVSTrac 2.0.1