home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / ease-3.5 / src / ease.sh next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1991-05-16  |  3.6 KB  |  116 lines

  1. #! /bin/sh
  2. #
  3. #  ease - front end for the ease translator (et).
  4. #
  5. #  This sh script simplifies the task of calling "et" with the proper flags.
  6. #
  7. #  It also defines a VERSION macro, known to cpp when preprocessing the
  8. #  input to et.  This allows you to automatically embed the RCS version
  9. #  number of your config file into the generated sendmail.cf. 
  10. #
  11. #  For example, if your ease input file contains the RCS version string
  12. #    $Revision: 1.7 $
  13. #  and the lines
  14. #    define ("Received:",
  15. #        "by ${m_oname} (${VERSION})"
  16. #        ifset (m_shostname, " from ${m_shostname} ") "for ${m_ruser}"
  17. #  then your sendmail.cf will define the "Received:" header line so that
  18. #  it contains the RCS version number of the ease input file.  This version
  19. #  number will ultimately be stamped into the header of every message which
  20. #  flows though this sendmail, thus allowing you to see at a glance whether
  21. #  some problem was due to an out-of-date sendmail.cf.
  22. #
  23. #  At our site, the "Received:" header lines thus have the following form:
  24. #
  25. #    Received: by isis.tc.fluke.COM (version 2.46)
  26. #        from argv.tc.fluke.COM for jeff
  27. #        id AA10285; Wed, 21 Feb 90 17:28:43 PST
  28. #    Received: by argv.tc.fluke.COM (version 2.46)
  29. #        for jeff@isis
  30. #        id AA06739; Wed, 21 Feb 90 17:28:39 PST
  31. #
  32. #  This makes it a little easier to track down problems in networks comprising
  33. #  dozens or hundreds of machines.
  34. #
  35. # $Source: /home/kreskin/u0/barnett/Src/ease/src/RCS/ease.sh,v $
  36. # $Locker:  $
  37. #
  38. # $Revision: 1.7 $
  39. # Check-in $Date: 1991/05/16 10:45:25 $
  40. # $State: Exp $
  41. #
  42. # $Author: barnett $
  43. #
  44. # $Log: ease.sh,v $
  45. # Revision 1.7  1991/05/16  10:45:25  barnett
  46. # Better support for System V machines
  47. # Support for machines with read only text segments
  48. #
  49. # Revision 1.6  1990/05/07  11:15:04  jeff
  50. # Add support for the "-q" flag added to ease.
  51. #
  52. # Version 1.5  90/02/22  15:51:12  jeff
  53. # Improved the comments in preparation for netwide release.
  54. # Version 1.4  88/11/18  11:24:12  jeff
  55. # RCS mangled the previous change; try it again.  (It saw something that
  56. # looked like a keyword to it, so it expanded the token.  Yuck.)
  57. # Version 1.3  88/11/18  11:20:52  jeff
  58. # Change the VERSION macro from the date to the RCS revision of the
  59. # config.ease file.
  60. # Version 1.2  87/04/13  16:56:29  jeff
  61. # Change argument parsing to accomodate the new -C flag.
  62. # Version 1.1  87/04/08  12:20:58  jeff
  63. # Initial version
  64. #
  65. # @(#)FLUKE source file: $Header: /home/kreskin/u0/barnett/Src/ease/src/RCS/ease.sh,v 1.7 1991/05/16 10:45:25 barnett Exp $
  66.  
  67. PATH=.:/bin:/usr/bin:/usr/ucb:/usr/local/bin
  68. export PATH
  69.  
  70. echo    "#"
  71. echo    "#   Compiled via: $0 $*"
  72. echo    "# From directory: `pwd`"
  73. echo    "#           Date: `date`"
  74. echo    "#"
  75. echo    "# This file was produced by the \"ease\" translator."
  76. echo    "# You probably shouldn't edit it, since changes will be lost"
  77. echo    "# the next time that ease is run.  Instead, edit the source file"
  78. echo    "# located in the directory named above."
  79. echo    "#"
  80.  
  81. cppflags=
  82. etflags='-q'
  83. CPP='cc -E'
  84.  
  85.  
  86. for i in ${1+"$@"} ;do
  87.     case "$1" in
  88.     '')    break;;
  89.     -C)    etflags="${etflags-} $1";;
  90.     -D*)    cppflags="$cppflags $1";;
  91.     *)    file="$1";;
  92.     esac
  93.     shift
  94. done
  95.  
  96. #
  97. #  Extract the RCS "Revision" string from the ease input file, and
  98. #  use it to define the VERSION symbol to cpp.
  99. #
  100. #  If you maintain your ease input file with SCCS, the appropriate change
  101. #  should be simple.
  102. #
  103. Rev=`fgrep 'Revision:' $file | sed -e 's/^.*Revision:[     ]*\([^     ]*\).*/\1/'`
  104.  
  105. # The sed commands delete empty comment lines and those preprocessor output
  106. # lines which indicate the linenumber and filename.
  107. $CPP -DVERSION=\"version\ $Rev\" $cppflags $file |
  108.     et $etflags |
  109.     sed -e '/^# *$/d' \
  110.     -e '/^#[     ]*[0123456789][0123456789]*[     ]*".*"[     ]*$/d'
  111.