OSSP CVS Repository

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

Check-in Number: 501
Date: 2001-Jun-13 23:30:05 (local)
2001-Jun-13 21:30:05 (UTC)
User:rse
Branch:
Comment: *** empty log message ***
Tickets:
Inspections:
Files:
ossp-pkg/shtool/ChangeLog      1.152 -> 1.153     5 inserted, 1 deleted
ossp-pkg/shtool/sh.echo      1.25 -> 1.26     32 inserted, 1 deleted
ossp-pkg/shtool/shtool.pod      1.50 -> 1.51     11 inserted, 9 deleted

ossp-pkg/shtool/ChangeLog 1.152 -> 1.153

--- ChangeLog    2001/06/13 08:54:50     1.152
+++ ChangeLog    2001/06/13 21:30:05     1.153
@@ -9,7 +9,11 @@
 
  ChangeLog
  
- Changes between 1.5.3 and 1.5.4 (19-Apr-2001 to xx-May-2001):
+ Changes between 1.5.3 and 1.5.4 (19-Apr-2001 to xx-Jun-2001):
+
+   *) Added %g (current group name) and %G (current group id)
+      constructs to `shtool echo -e' command.
+      [Ralf S. Engelschall]
 
    *) Fixed example of `shtool move' in shtool.pod
       [Ralf S. Engelschall]


ossp-pkg/shtool/sh.echo 1.25 -> 1.26

--- sh.echo      2001/06/13 08:54:50     1.25
+++ sh.echo      2001/06/13 21:30:05     1.26
@@ -99,7 +99,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"
@@ -141,6 +141,35 @@
     fi
 fi
 
+#   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=''
@@ -220,6 +249,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" \


ossp-pkg/shtool/shtool.pod 1.50 -> 1.51

--- shtool.pod   2001/06/13 08:54:50     1.50
+++ shtool.pod   2001/06/13 21:30:05     1.51
@@ -294,15 +294,17 @@
 character (``C<\n>''). When option ``B<-n>'' is used this newline character is
 left out. 
 
-The I<str> can contain special ``B<%>I<x>'' constructs which which are
-expanded before the output is written if option ``B<-e>'' is used.
-Currently the following constructs are recognized: ``B<%B>'' for switching to
-terminal bold mode, ``B<%b>'' for switching terminal mode back to normal
-display mode, ``B<%u>'' for the current user name, ``B<%U>'' for the current
-user id (numerical), ``B<%h>'' for the current hostname, ``B<%d>'' for the
-current domain name, ``B<%D>'' for the current day of the month, ``B<%M>'' for
-the current month (numerical), ``B<%m>'' for the current month name and
-``B<%Y>'' for the current year.
+The I<str> can contain special ``B<%>I<x>'' constructs which which
+are expanded before the output is written if option ``B<-e>'' is
+used. Currently the following constructs are recognized: ``B<%B>''
+for switching to terminal bold mode, ``B<%b>'' for switching terminal
+mode back to normal display mode, ``B<%u>'' for the current user name,
+``B<%U>'' for the current user id (numerical), ``B<%g>'' for the current
+group name, ``B<%G>'' for the current group id (numerical), ``B<%h>''
+for the current hostname, ``B<%d>'' for the current domain name,
+``B<%D>'' for the current day of the month, ``B<%M>'' for the current
+month (numerical), ``B<%m>'' for the current month name and ``B<%Y>''
+for the current year.
 
 The trick of this command is that it provides a portable ``B<-n>'' option and
 hides the gory details needed to find out the environment details.

CVSTrac 2.0.1