Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/acct/lastlogin.sh
          +++ new/usr/src/cmd/acct/lastlogin.sh
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17  # If applicable, add the following below this CDDL HEADER, with the
  18   18  # fields enclosed by brackets "[]" replaced with your own identifying
  19   19  # information: Portions Copyright [yyyy] [name of copyright owner]
  20   20  #
  21   21  # CDDL HEADER END
  22   22  #
  23   23  #       Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
  24   24  #         All Rights Reserved
  25   25  
  26   26  
  27      -#ident  "%Z%%M% %I%     %E% SMI"        /* SVr4.0 1.6   */
  28   27  #       "lastlogin - keep record of date each person last logged in"
  29   28  #       "bug - the date shown is usually 1 more than it should be "
  30   29  #       "       because lastlogin is run at 4am and checks the last"
  31   30  #       "       24 hrs worth of process accounting info (in pacct)"
  32   31  PATH=/usr/lib/acct:/usr/bin:/usr/sbin
  33   32  cd /var/adm/acct
  34   33  if test ! -r sum/loginlog; then
  35   34          nulladm sum/loginlog
  36   35  fi
  37   36  #       "cleanup loginlog - delete entries of those no longer in"
↓ open down ↓ 12 lines elided ↑ open up ↑
  50   49  #       "update loginlog"
  51   50  _d="`date +%y-%m-%d`"
  52   51  _day=`date +%m%d`
  53   52  #       "lines 1 and 2 - remove everything from the total"
  54   53  #       "acctng records with connect info except login"
  55   54  #       "name and adds the date"
  56   55  #       "line 3 - sorts in reverse order by login name; gets"
  57   56  #       "1st occurrence of each login name and resorts by date"
  58   57  acctmerg -a < nite/ctacct.$_day | \
  59   58  sed -e "s/^[^   ]*[     ]\([^   ]*\)[   ].*/$_d  \1/" | \
  60      -nawk    '/^00-00-00/ {
       59 +/usr/xpg4/bin/awk       '/^00-00-00/ {
  61   60                  $0 = "00" $0
  62   61          }
  63   62          /^[0-9][0-9]-/ {
  64   63                  d=substr($0,1,2);
  65   64                  if (d<=68) {
  66   65                          $0 = "20" $0
  67   66                  } else {
  68   67                          $0 = "19" $0
  69   68                  }
  70   69          }
  71   70          { print }' - sum/loginlog | \
  72   71  sort -r +1 | uniq +10 | sort | \
  73      -nawk    '/^[0-9][0-9][0-9][0-9]-/ {
       72 +/usr/xpg4/bin/awk       '/^[0-9][0-9][0-9][0-9]-/ {
  74   73          $0 = substr($0,3)
  75   74      }
  76   75      { print }' > sum/tmploginlog
  77   76  cp sum/tmploginlog sum/loginlog
  78   77  rm -f sum/tmploginlog
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX