home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / contrib / smail / smail-3.1 / smail-3 / smail-3.1.28 / src / bump_cnt.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1992-07-11  |  1KB  |  35 lines

  1. #!/bin/sh
  2. # @(#)src/bump_cnt.sh    1.3 7/11/92 11:53:29
  3.  
  4. #    Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
  5. #    Copyright (C) 1992  Ronald S. Karr
  6. # See the file COPYING, distributed with smail, for restriction
  7. # and warranty information.
  8.  
  9. # incremement the compile counter and set the compilation date
  10. if [ ! -f ldinfo.c ]; then
  11.     compile_num=0
  12. else
  13.     compile_num=`sed -n 's/^int compile_num = \(.*\);/\1/p' < ldinfo.c`
  14.     if [ ! "$compile_num" ]; then compile_num=0; fi
  15. fi
  16. compile_num=`expr $compile_num + 1`
  17. compile_date=`date |
  18.           awk '{ print $3 "-" $2 "-" substr($6,3) }' |
  19.           tr '[A-Z]' '[a-z]'`
  20. cat > ldinfo.c <<EOF
  21. /*
  22.  * This file defines the number of compiles since the first time this
  23.  * file was created when compiling smail.  This information is used in
  24.  * expand.c to define the values for \$compile_num and \$compile_date.
  25.  * To reset the compilation count, simply remove ldinfo.c.
  26.  */
  27. int compile_num = $compile_num;
  28. char *compile_date = "$compile_date";
  29. EOF
  30.  
  31. echo "Compile #$compile_num on $compile_date"
  32.  
  33. exit 0
  34.