home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2844 < prev    next >
Internet Message Format  |  1991-02-23  |  51KB

  1. From: barnett@grymoire.crd.ge.com (Bruce Barnett)
  2. Newsgroups: alt.sources
  3. Subject: Ease 3.0: High Level Language for Sendmail  (Part 2 of 6)
  4. Message-ID: <BARNETT.91Feb23021436@grymoire.crd.ge.com>
  5. Date: 23 Feb 91 07:14:36 GMT
  6.  
  7. #! /bin/sh
  8. # This is a shell archive.  Remove anything before this line, then unpack
  9. # it by saving it into a file and typing "sh file".  To overwrite existing
  10. # files, type "sh file -c".  You can also feed this as standard input via
  11. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  12. # will see the following message at the end:
  13. #        "End of archive 2 (of 6)."
  14. # Contents:  doc/cfc.man src/Makefile src/errors.c src/idman.c
  15. #   src/lexan.patch src/main.c src/symtab.c test/test.mc
  16. # Wrapped by barnett@grymoire on Sat Feb 23 01:13:52 1991
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. if test -f doc/cfc.man -a "${1}" != "-c" ; then 
  19.   echo shar: Will not over-write existing file \"doc/cfc.man\"
  20. else
  21. echo shar: Extracting \"doc/cfc.man\" \(5708 characters\)
  22. sed "s/^X//" >doc/cfc.man <<'END_OF_doc/cfc.man'
  23. X...
  24. X... $Header: /home/kreskin/u0/barnett/Src/Ease/ease/doc/RCS/cfc.man,v 1.2 1990/04/04 15:42:51 jeff Exp barnett $
  25. X... 
  26. X... $Log: cfc.man,v $
  27. X... Revision 1.2  1990/04/04  15:42:51  jeff
  28. X... Reformatted somewhat for readability.  Added some bugs
  29. X... described by Bruce Barnett.
  30. X...
  31. X... Version 1.1  90/04/04  14:57:38  jeff
  32. X... Initial version
  33. X... 
  34. X... Revision 2.0  88/06/15  15:17:36  arnold
  35. X... Baseline release for net posting. ADR.
  36. X... 
  37. X... Revision 1.3  88/01/21  16:23:21  arnold
  38. X... Some typo fixes.
  39. X... 
  40. X... Revision 1.2  87/04/08  10:21:47  arnold
  41. X... Small bug fixes, compatibility option added, also warnings for
  42. X... unrecognized flags and options. ADR.
  43. X... 
  44. X... Revision 1.1  87/02/16  15:25:32  arnold
  45. X... Initial revision
  46. X... 
  47. X...
  48. X.TH CFC local
  49. X.SH NAME
  50. Xcfc \- Sendmail cf file compiler
  51. X.SH SYNOPSIS
  52. X.B cfc
  53. X[
  54. X.B \-s
  55. X] [
  56. X.B \-i
  57. X] [
  58. X.B \-d
  59. X] [
  60. X.B \-c
  61. X] [
  62. X.B \-u
  63. X] [
  64. X.B \-C \fICLASSES\fP
  65. X] <
  66. X.I sendmail.cf-file
  67. X>
  68. X.I ease-source-file
  69. X.SH DESCRIPTION
  70. X.I Cfc
  71. Xis a filter that reads a raw
  72. X.IR sendmail (8)
  73. Xconfiguration file on its standard input, and produces almost useable
  74. X.IR ease (1)
  75. Xsource on its standard output.
  76. X.P
  77. XIt is designed as a conversion tool, to translate an existing
  78. X.B sendmail.cf
  79. Xfile into
  80. X.I ease
  81. Xwith the idea that all future work will be done in
  82. X.IR ease .
  83. X.P
  84. X.I Cfc
  85. Xpasses all comments through to the output, and converts all predefined
  86. X.I sendmail
  87. Xmacros, options, option values, and mailer flags into the names used by
  88. X.IR ease .
  89. X.P
  90. XIt is suggested you use
  91. X.I cfc
  92. Xto convert a 
  93. X.I sendmail.cf
  94. Xfile into 
  95. X.I ease
  96. Xformat, and then convert the
  97. X.I ease
  98. Xfile back into
  99. X.I sendmail
  100. Xformat.
  101. XYou may have to experiment with the right options and the right combinations
  102. Xbefore
  103. X.I ease
  104. Xwill generate an output file with no errors.
  105. XThen use the
  106. X.I cfdiff
  107. Xscript to compare the original
  108. X.I sendmail.cf
  109. Xfile to the output of
  110. X.IR ease .
  111. XYou should see some differences in formatting, as some 
  112. X.I sendmail
  113. Xlines can be on one or two lines, and some options have more than one form.
  114. XOnce it is determined that these are the only difference, you should feel
  115. Xvery comfortable using 
  116. X.I ease
  117. Xas a high level langauge for 
  118. X.I sendmail 
  119. Xfiles.
  120. XIf you are unable to make the two files identical, you may need to modify the 
  121. X.I ease
  122. Xinput file so the output is correct.
  123. XIf necessary, you can use the
  124. X.IR asm ()
  125. Xfunction in
  126. X.I ease
  127. Xto pass the characters, unchanged, to the output.
  128. X.P
  129. X.I Cfc
  130. Xisn't perfect. 
  131. XYou may wish to modify the 
  132. X.I ease
  133. Xfile for cosmetic reasons:
  134. X.IP
  135. X.I Cfc
  136. Xintroduces tabs on its own, as well as often passing through tabs
  137. Xfrom the
  138. X.I sendmail
  139. Xinput.
  140. XIt will also print a header for each different type of line, e.g. if the
  141. Xinput had seven
  142. X.B O
  143. X(option) lines, there will be seven option blocks.
  144. XThese are usually succesive, and can therefore be merged.
  145. X.IP
  146. XMove some comments.
  147. XThe block close on rulesets often comes after the comments that
  148. Xprecede the next ruleset or mailer specification.
  149. X
  150. X.RE
  151. X.P
  152. XIn short,
  153. X.I cfc
  154. Xdoes over 99% of the tedious work of translating a
  155. X.B sendmail.cf
  156. Xinto
  157. X.I ease
  158. Xformat.
  159. XSuprisingly, the combination of
  160. X.I cfc
  161. Xand
  162. X.I ease
  163. Xcan find bugs in a current
  164. X.B sendmail.cf
  165. Xfile!
  166. X.P
  167. X.I Cfc
  168. Xtakes five options.
  169. X.RS
  170. X.TP
  171. X.B \-c
  172. XIndicates that
  173. X.I cfc
  174. Xshould run in 4.2BSD compatibility mode.
  175. XIn this case, options and mailer flags which are new in the 4.3BSD
  176. Xversion of
  177. X.I sendmail
  178. Xwill not be recognized.
  179. X.TP
  180. X.B \-u
  181. X.I Cfc
  182. Xwill warn about the use of any undocumented options or mailer flags in
  183. Xthe 4.3BSD
  184. X.IR sendmail .
  185. XThe correct
  186. X.I ease
  187. Xoutput will still be produced.
  188. X.TP
  189. X.B \-s
  190. X.I Cfc
  191. Xwill assume the input file is for Sun's sendmail.
  192. XIt will produce a ruleset definition for rule number 30, which Sun uses
  193. Xin their standard configuration file, and older implementations
  194. Xcomplain about. It also adds some declarations that match Sun's
  195. Xadditions to sendmail, so errors won't occur.
  196. X.TP
  197. X.B \-d
  198. X.I Cfc
  199. Xwill cause some definitions to be added that will convert the Ultrix
  200. X.i sendmail.cf
  201. Xfile with fewer errors.
  202. X.TP
  203. X.B \-i
  204. X.I Cfc
  205. Xwill add some declarations that the IDA version of 
  206. X.I sendmail
  207. Xlikes to see.
  208. X.TP
  209. X.B \-C
  210. X<LETTER><LETTER>...
  211. X.I Cfc
  212. Xwill add an additional header of the form
  213. X.I any_in_<LETTER>
  214. Xand
  215. X.I any_not_in_<LETTER>
  216. Xwhere
  217. X.I <LETTER>
  218. Xis a single character that specifes a class used in the sendmail file,
  219. Xbut not defined.
  220. XThis prevents 
  221. X.I ease
  222. Xfrom complaining about undefined classes.
  223. X.RE
  224. X.P
  225. XWith the right compination of options and class definitions, it is
  226. Xeasy to convert a 
  227. X.I sendmail
  228. Xfile into 
  229. X.I ease ,
  230. Xedit the file, and run 
  231. X.I ease
  232. Xon the file, and install the output.
  233. X.\" .SH FILES
  234. X.SH SEE ALSO
  235. X.I "Sendmail Installation and Operation Guide"
  236. Xby Eric Allman
  237. X(SMM:7 in the 4.3 BSD UNIX System Manager's Manual),
  238. X.I "Ease: A Configuration Language for Sendmail"
  239. Xby James S. Schoner, amended by Jeff P. Stearns, Arnold D. Robbins, and Bruce G. Barnett.
  240. X.IR sendmail (8),
  241. X.IR ease (1).
  242. X.SH DIAGNOSTICS
  243. X``\c
  244. X.IR Routine :
  245. Xmalformed input line
  246. X.IR line :
  247. Xfatal error''
  248. Xfor input it doesn't understand.
  249. X.I Routine
  250. Xis the name of the routine in
  251. X.I cfc
  252. Xwhich choked, and
  253. X.I line
  254. Xis the line number in the input.
  255. X.SH BUGS
  256. XOnly recognizes continuation lines (lines that begin with a \s-1TAB\s+1)
  257. Xfor header (H) and mailer (M) definitions.
  258. X.P
  259. XShould read from files on the command line, instead of being a pure filter.
  260. X.P
  261. XShould be a two pass program, and learn the classes which need
  262. Xdefining automatically. The
  263. X.B \-C
  264. Xoption is really a kludge.
  265. X.PP
  266. XIn some cases, you can use the
  267. X\fIasm(".......")\fP
  268. Xcommand to work around problems.
  269. X.SH AUTHOR
  270. X.nf
  271. XArnold Robbins
  272. XEmory University Computing Center
  273. Xarnold@emory.edu
  274. X
  275. XModifications by Bruce G. Barnett
  276. XGeneral Electric, Corporate Research and Development
  277. Xbarnett@crdgw1.ge.com
  278. X
  279. X.fi
  280. END_OF_doc/cfc.man
  281. if test 5708 -ne `wc -c <doc/cfc.man`; then
  282.     echo shar: \"doc/cfc.man\" unpacked with wrong size!
  283. fi
  284. # end of overwriting check
  285. fi
  286. if test -f src/Makefile -a "${1}" != "-c" ; then 
  287.   echo shar: Will not over-write existing file \"src/Makefile\"
  288. else
  289. echo shar: Extracting \"src/Makefile\" \(3877 characters\)
  290. sed "s/^X//" >src/Makefile <<'END_OF_src/Makefile'
  291. X# Makefile for Ease Translator (et).
  292. X#
  293. X#    $Header: /home/kreskin/u0/barnett/Src/Ease/ease/src/RCS/Makefile,v 2.1 1990/01/30 13:54:13 jeff Exp barnett $
  294. X#
  295. X#    $Log: Makefile,v $
  296. X# Revision 2.1  1990/01/30  13:54:13  jeff
  297. X# Updated for release 2.1 Aplha.
  298. X#
  299. X# Revision 2.0  88/06/15  14:47:35  root
  300. X# Baseline release for net posting. ADR.
  301. X# 
  302. X#
  303. X#    James S. Schoner, Purdue University Computing Center,
  304. X#              West Lafayette, Indiana  47907
  305. X#
  306. X#    Copyright (c) 1985 by Purdue Research Foundation
  307. X#
  308. X#    All rights reserved.
  309. X#
  310. X
  311. XINCLUDE =
  312. X
  313. X# where to install the binaries
  314. XBINDIR          =    ../bin
  315. X
  316. XOWNER = root
  317. XGROUP = staff
  318. XMODE = 755
  319. X#INSTALL = install -c -m ${MODE} -o ${OWNER} -g ${GROUP}
  320. XINSTALL=cp
  321. X# define this for grammar debugging
  322. X#DEFS =-DYYDEBUG
  323. XDEFS =
  324. X# I had strange errors happen when I use SunOS Optimizer.....
  325. X# In particular, with SunOS 4.0.3, Sparc, and -O (-O2)....
  326. X# Maybe you better not use -O with SunOS
  327. XCFLAGS = -g  ${DEFS} ${INCLUDE}
  328. X#CFLAGS = -O ${DEFS} ${INCLUDE}
  329. X
  330. XLP = lpr
  331. XLPFLAGS = -J"Ease Source"
  332. X
  333. XHDR = symtab.h
  334. XSRC = main.c emitcf.c errors.c idman.c strops.c symtab.c fixstrings.c
  335. XLST = Makefile lexan.l parser.y ${HDR} ${SRC}
  336. XDEP = parser.c lexan.c ${SRC}
  337. XOBJ = parser.o lexan.o main.o emitcf.o errors.o idman.o strops.o symtab.o \
  338. X    fixstrings.o
  339. XCFILES= $(SRC) $(DEP)
  340. X
  341. Xall: et
  342. X
  343. Xet: ${OBJ}
  344. X    cc ${CFLAGS} -o et ${OBJ} -ll
  345. X
  346. Xclean: FRC
  347. X    rm -f et *.o lexan.c parser.c y.output yacc.acts yacc.tmp \
  348. X          lexdefs.h y.tab.h errs Makefile.bak y.output y.tab.c y.tok.h
  349. X
  350. Xdepend:
  351. X    ${CC} -M ${CFLAGS} ${CFILES} | \
  352. X    sed -e ':loop' \
  353. X        -e 's/\.\.\/[^ /]*\/\.\./../' \
  354. X        -e 't loop' | \
  355. X    awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
  356. X        else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
  357. X               else rec = rec " " $$2 } } ; \
  358. X          END { print rec } ' > makedep
  359. X    echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
  360. X    echo '$$r makedep' >>eddep
  361. X    echo 'w' >>eddep
  362. X    cp Makefile Makefile.bak
  363. X    ex - Makefile < eddep
  364. X    rm eddep makedep
  365. X
  366. Xinstall: et FRC
  367. X    ${INSTALL} et ${BINDIR}
  368. X    ${INSTALL} ease.sh ${BINDIR}/ease
  369. X
  370. X
  371. Xlint:   ${DEP} symtab.h FRC
  372. X    lint -hxn ${DEP}
  373. X
  374. Xprint:  ${LST} FRC
  375. X    @pr -f ${LST} | ${LP} ${LPFLAGS}
  376. X
  377. Xspotless: clean FRC
  378. X    rcsclean ${LST}
  379. X
  380. Xy.tab.h parser.c: parser.y
  381. X    @rm -f parser.c
  382. X    yacc -v -d parser.y
  383. X    sed 's/=yylex/=yyyylex/' < y.tab.c >parser.c
  384. X
  385. X# the following dummy rule is because of the results of 'make depend'
  386. X# However, under SunOS Make - it complains. You may have to comment it out
  387. X./lexdefs.h:    lexdefs.h
  388. X
  389. Xlexdefs.h:    y.tab.h
  390. X    -(cmp -s y.tab.h lexdefs.h || cp y.tab.h lexdefs.h)
  391. X
  392. Xlexan.c: lexan.l
  393. X
  394. Xparser.o: y.tok.h
  395. Xy.tok.h:    y.tab.h
  396. X    grep '^#.*define' y.tab.h |\
  397. X    sed 's/^# define \([^ ]*\) [^ ]*$$/    "\1",/' >y.tok.h
  398. X
  399. X${HDR} ${SRC} lexan.l parser.y:
  400. X    co $@
  401. X
  402. XFRC:
  403. X
  404. X# DO NOT DELETE THIS LINE -- make depend uses it
  405. X
  406. Xmain.o: main.c ./fixstrings.h /usr/include/stdio.h
  407. Xemitcf.o: emitcf.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  408. Xerrors.o: errors.c /usr/include/stdio.h ./fixstrings.h
  409. Xidman.o: idman.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  410. Xstrops.o: strops.c ./fixstrings.h /usr/include/stdio.h /usr/include/strings.h
  411. Xstrops.o: ./symtab.h
  412. Xsymtab.o: symtab.c ./fixstrings.h /usr/include/stdio.h /usr/include/ctype.h
  413. Xsymtab.o: ./symtab.h
  414. Xfixstrings.o: fixstrings.c /usr/include/strings.h
  415. Xparser.o: parser.c ./fixstrings.h /usr/include/stdio.h ./symtab.h
  416. Xlexan.o: lexan.c /usr/include/stdio.h ./fixstrings.h ./symtab.h ./lexdefs.h
  417. Xmain.o: main.c ./fixstrings.h /usr/include/stdio.h
  418. Xemitcf.o: emitcf.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  419. Xerrors.o: errors.c /usr/include/stdio.h ./fixstrings.h
  420. Xidman.o: idman.c /usr/include/stdio.h ./symtab.h ./fixstrings.h
  421. Xstrops.o: strops.c ./fixstrings.h /usr/include/stdio.h /usr/include/strings.h
  422. Xstrops.o: ./symtab.h
  423. Xsymtab.o: symtab.c ./fixstrings.h /usr/include/stdio.h /usr/include/ctype.h
  424. Xsymtab.o: ./symtab.h
  425. Xfixstrings.o: fixstrings.c /usr/include/strings.h
  426. END_OF_src/Makefile
  427. if test 3877 -ne `wc -c <src/Makefile`; then
  428.     echo shar: \"src/Makefile\" unpacked with wrong size!
  429. fi
  430. # end of overwriting check
  431. fi
  432. if test -f src/errors.c -a "${1}" != "-c" ; then 
  433.   echo shar: Will not over-write existing file \"src/errors.c\"
  434. else
  435. echo shar: Extracting \"src/errors.c\" \(4962 characters\)
  436. sed "s/^X//" >src/errors.c <<'END_OF_src/errors.c'
  437. X#ifdef FLUKE
  438. X# ifndef LINT
  439. X    static char RCSid[] = "@(#)FLUKE  $Header: /isis/usr2/share/src/local/tc/ease/src/RCS/errors.c,v 2.1 90/01/30 14:17:29 jeff Exp $";
  440. X# endif LINT
  441. X#endif FLUKE
  442. X
  443. X/*
  444. X *      errors.c   -- Contains error initialization and reporting routines.
  445. X *
  446. X *      author     -- James S. Schoner, Purdue University Computing Center,
  447. X *                        West Lafayette, Indiana  47907
  448. X *
  449. X *      date       -- July 9, 1985
  450. X *
  451. X *    Copyright (c) 1985 by Purdue Research Foundation
  452. X *
  453. X *    All rights reserved.
  454. X *
  455. X * $Log:    /isis/usr2/share/src/local/tc/ease/src/RCS/errors.c,v $
  456. X * Version 2.1  90/01/30  14:17:29  jeff
  457. X * Bruce Barnett - extensions for SunOS/Ultrix.
  458. X * 
  459. X * Revision 2.0  88/06/15  14:41:10  root
  460. X * Baseline release for net posting. ADR.
  461. X */
  462. X
  463. X#include <stdio.h>
  464. X#include "fixstrings.h"
  465. X#include <ctype.h>
  466. Xextern int  ErrorCount;     /* error count                   */
  467. Xextern char FNbuf[];     /* input file name              */
  468. Xextern int  Lcount;     /* line count                    */
  469. XFILE *DIAGf = {stderr};  /* file for diagnostic output */
  470. Xextern char yytext[];    /* current token */
  471. Xextern int yyleng;    /* and it's length */
  472. Xextern int    yylineno;    /* current input line number */
  473. Xextern char *infile;        /* input file name */
  474. Xstatic char *source;
  475. X
  476. X/*
  477. X * yywhere() -- input position for yyparse()
  478. X * from Schreiner and Friedman's book on compiler construction
  479. X */
  480. Xvoid
  481. Xyywhere()     /* position stamp */
  482. X{
  483. X    char    colon = 0;    /* flag */
  484. X    if (source && *source && strcmp(source,"\"\"")) {
  485. X    char    *cp = source;
  486. X    int    len = strlen(source);
  487. X    
  488. X    if (*cp == '"')
  489. X      ++cp, len -= 2;
  490. X    if (strlen(cp, "./", 2) == 0)
  491. X      cp += 2, len -= 2;
  492. X    if (len > 0 )
  493. X      fprintf(DIAGf, "\"%.*s\"", len, cp);
  494. X    colon = 1;
  495. X    }     else if (infile && strcmp(infile,"-")) {
  496. X      fprintf(DIAGf, "\"%s\"",infile);
  497. X      colon = 1;
  498. X      }
  499. X    if (yylineno > 0 ) {
  500. X    if (colon)
  501. X      fputs(", ",DIAGf);
  502. X    fprintf(DIAGf, "line %d",
  503. X        yylineno - (*yytext == '\n' || ! *yytext));
  504. X    colon = 1;
  505. X/*    if ((yylineno - (*yytext == '\n' || ! *yytext)) != Lcount)
  506. X      fprintf(DIAGf, "?%d:?", Lcount); */
  507. X    }
  508. X    if (*yytext) {
  509. X    register int i;
  510. X    for (i=0;i<20;++i)
  511. X      if (!yytext[i] || yytext[i] == '\n')
  512. X        break;
  513. X    if (i) {
  514. X        if (colon)
  515. X          putc(' ',DIAGf);
  516. X        fprintf(DIAGf, "near \"%.*s\"",i,yytext);
  517. X        colon = 1;
  518. X    }
  519. X    }
  520. X    if (colon)
  521. X      fputs(": ",DIAGf);
  522. X}
  523. X
  524. X
  525. X/*
  526. X *    yymark - keep track of source file and line number 
  527. X */
  528. X
  529. Xvoid
  530. Xyymark()    /* retreive from '# digit text' */
  531. X{
  532. X    if (source)
  533. X      cfree(source); 
  534. X    source = (char *) calloc(yyleng,sizeof(char));
  535. X    if (source) {
  536. X      sscanf(yytext, "# %d%s",&yylineno, source);
  537. X/*      fprintf(stderr,"source = '%s' on %s",source,yytext); */
  538. X      Lcount = yylineno;
  539. X      if (strcmp(source,"\"\""))
  540. X    strcpy(FNbuf,source);
  541. X      else if ( infile && strcmp(infile,"-"))
  542. X    sprintf(FNbuf,"\"%s\"",infile);
  543. X/*      fprintf(stderr,"FNbuf = '%s', infile = '%s'\n",FNbuf,infile); */
  544. X           
  545. X  }
  546. X}
  547. X
  548. X
  549. X
  550. X/*
  551. X *    yyerror () -- Prints source file name (FNbuf), line number (Lcount),
  552. X *              and error message (sbErr) for each invokation.
  553. X *              it also prints out a message where the error is.
  554. X *
  555. X */
  556. Xvoid
  557. Xyyerror (sbErr)
  558. Xchar *sbErr;
  559. X{
  560. X    extern int yynerrs;
  561. X    ++ErrorCount;
  562. X    yywhere();
  563. X/*    fprintf(DIAGf, " %s\t[error %d]\n", sbErr, ErrorCount); */
  564. X    fprintf(DIAGf, " %s\n", sbErr);
  565. X/* yynerrs is the number of yacc errors, ErrorCount is larger */
  566. X}
  567. X
  568. X
  569. X
  570. X/*
  571. X *    ErrorReport () -- Prints source file name (FNbuf), line number (Lcount),
  572. X *              and error message (sbErr) for each invokation.
  573. X *
  574. X */
  575. Xvoid
  576. XErrorReport (sbErr)
  577. Xchar *sbErr;
  578. X{
  579. X/*    fprintf (DIAGf, "%s, line %d: %s", FNbuf, Lcount, sbErr);
  580. X    ErrorCount++; */
  581. X    yyerror(sbErr);
  582. X}
  583. X
  584. X
  585. X/*
  586. X *    FatalError () -- Translator fatal error routine which prints 
  587. X *             error message (sbErr) and an argument (sbArg).
  588. X *
  589. X */
  590. Xvoid
  591. XFatalError (sbErr, sbArg)
  592. Xchar *sbErr,
  593. X     *sbArg;
  594. X{
  595. X    fprintf (DIAGf, "%s, line %d: Fatal Error In Translator: %s %s\n", 
  596. X         FNbuf, Lcount, sbErr, sbArg); 
  597. X    exit (1);
  598. X}
  599. X
  600. X
  601. X/*
  602. X *    PrintError () -- Prints source file name (FNbuf), line number
  603. X *             (cline), error message (sbErr), and argument
  604. X *             (sbArg) for each invokation.
  605. X *
  606. X */
  607. Xvoid
  608. XPrintError (sbErr, sbArg)
  609. Xchar *sbErr;
  610. Xchar *sbArg;
  611. X{
  612. X    char    Ebuffer[1000];
  613. X    sprintf(Ebuffer,sbErr,sbArg);
  614. X    yyerror(Ebuffer);
  615. X/*    fprintf (DIAGf, "%s, line %d: %s %s.\n", FNbuf, Lcount, sbErr, sbArg);
  616. X    ErrorCount++; */
  617. X}
  618. X
  619. X
  620. X/*
  621. X *    PrintWarning () -- Prints a warning message with source file
  622. X *               name (FNbuf), line number (Lcount), warning
  623. X *               (sbWarn), and a possible identifier (sbID).
  624. X *
  625. X */
  626. Xvoid
  627. XPrintWarning (sbWarn, sbID)
  628. Xchar *sbWarn;
  629. Xchar *sbID;
  630. X{
  631. X/*    fprintf (DIAGf, "%s, line %d: Warning: ", FNbuf, Lcount); */
  632. X        yywhere();
  633. X    fprintf(DIAGf,"Warning: ");
  634. X    if (sbID != NULL)
  635. X        fprintf (DIAGf, sbWarn, sbID);
  636. X    else
  637. X        fprintf (DIAGf, sbWarn);
  638. X}
  639. X
  640. X
  641. X/*
  642. X *    InitError () -- Initialize line count (Lcount) to one and error count
  643. X *                (ErrorCount) to zero.
  644. X *
  645. X */
  646. Xvoid
  647. XInitError ()
  648. X{
  649. X    Lcount     = 1;
  650. X    ErrorCount = 0;
  651. X}
  652. END_OF_src/errors.c
  653. if test 4962 -ne `wc -c <src/errors.c`; then
  654.     echo shar: \"src/errors.c\" unpacked with wrong size!
  655. fi
  656. # end of overwriting check
  657. fi
  658. if test -f src/idman.c -a "${1}" != "-c" ; then 
  659.   echo shar: Will not over-write existing file \"src/idman.c\"
  660. else
  661. echo shar: Extracting \"src/idman.c\" \(6609 characters\)
  662. sed "s/^X//" >src/idman.c <<'END_OF_src/idman.c'
  663. X#ifdef FLUKE
  664. X# ifndef LINT
  665. X    static char RCSid[] = "@(#)FLUKE  $Header: /tmp_mnt/home/kreskin/u0/barnett/Src/Ease/ease/src/RCS/idman.c,v 3.0 1991/02/22 18:50:27 barnett Exp $";
  666. X# endif LINT
  667. X#endif FLUKE
  668. X
  669. X/*
  670. X *      idman.c    -- Contains routines for manipulating identifiers and their
  671. X *           symbolic associations.
  672. X *
  673. X *      author    -- James S. Schoner, Purdue University Computing Center,
  674. X *                     West Lafayette, Indiana  47907
  675. X *
  676. X *      date    -- July 9, 1985
  677. X *
  678. X *    Copyright (c) 1985 by Purdue Research Foundation
  679. X *
  680. X *    All rights reserved.
  681. X *
  682. X * $Log: idman.c,v $
  683. X * Revision 3.0  1991/02/22  18:50:27  barnett
  684. X * Added support for HP/UX and IDA sendmail.
  685. X *
  686. X * Revision 2.1  1990/01/30  14:33:52  jeff
  687. X * Bruce Barnett - changed UniqMac.
  688. X *
  689. X * Revision 2.0  88/06/15  14:42:14  root
  690. X * Baseline release for net posting. ADR.
  691. X */
  692. X
  693. X#include <stdio.h>
  694. X#include <ctype.h>
  695. X#include "symtab.h"
  696. X#include "fixstrings.h"
  697. X
  698. Xextern struct he *LookupSymbol ();
  699. Xextern void      FatalError (),
  700. X          ErrorReport (),
  701. X          PrintWarning (),
  702. X          PrintError ();
  703. X
  704. X
  705. Xchar    IDused[] = "                          "; /* 26 blanks */
  706. X/*
  707. X *    UniqMac () -- Assigns and returns a unique one-character macro
  708. X *              name (upper-case) for an Ease macro name.
  709. X *
  710. X *    Bruce Barnett:
  711. X *    Special enhancement - if idval is a single character,
  712. X *    and the corresponding letter has not been assigned,
  713. X *    Make the idc character the same as the macro name 
  714. X *
  715. X *    This makes it nice to test cfc/ease completeness.
  716. X *    Also makes reading the ease output easier.
  717. X *
  718. X */
  719. Xchar
  720. XUniqMac (phe)
  721. Xstruct he *phe;        /* symbol table entry for Ease macro */
  722. X{
  723. X    short i;
  724. X
  725. X    if ((strlen(phe->psb) == 1) && 
  726. X    isupper(*(phe->psb)) &&
  727. X    IDused[*(phe->psb) - 'A'] == ' ' ) {
  728. X    IDused[*(phe->psb) - 'A'] = (phe->idval.idc) = *(phe->psb);
  729. X    } else {
  730. X    for (i=0;i<26 && IDused[i] != ' ';i++) 
  731. X      ;    /* find first unused letter */
  732. X    if (i==26) FatalError ("Too many macro names (26 max)", (char *) NULL);
  733. X    IDused[i] = 
  734. X      (phe->idval.idc) = 
  735. X        'A' + i;
  736. X    }
  737. X    return (phe->idval.idc);
  738. X}
  739. X
  740. X
  741. X/*
  742. X *    BindID () -- Binds either a ruleset or precedence identifier (phe) to
  743. X *              an integer (vid).  The id type distinction is passed in
  744. X *             the parameter idt.
  745. X *
  746. X */
  747. Xvoid
  748. XBindID (phe, vid, idt)
  749. Xregister struct he *phe;    /* symbol table entry for an identifier    */
  750. Xint vid;            /* value of the identifier           */
  751. Xunsigned idt;            /* identifier type (ruleset or precedence) */
  752. X{
  753. X    if (ISTYPED(phe->idtype)) {    /* should be undefined */
  754. X        PrintWarning ("Redeclaration of %s.\n", phe->psb);
  755. X        phe->idtype = ID_UNTYPED;
  756. X    }
  757. X    phe->idtype |= idt;        /* make defined           */
  758. X    if (ISRULESET(phe->idtype)) {
  759. X        if (vid > VALRSNMAX) {
  760. X            ErrorReport ("Ruleset number too large.\n");
  761. X            return;
  762. X        } else if (vid < 0) {
  763. X            ErrorReport ("Ruleset number must be non-negative.\n");
  764. X            return;
  765. X        }
  766. X        sprintf (phe->idval.rsn, "%d", vid);
  767. X    } else 
  768. X        phe->idval.prec = vid;
  769. X}
  770. X
  771. X
  772. X/*
  773. X *    CheckRS () -- Checks validity of a ruleset identifier (phe) and 
  774. X *              returns the ruleset string to which the identifier
  775. X *              is bound.  If the ruleset identifier is invalid, the
  776. X *              null string is returned.
  777. X *
  778. X */
  779. Xchar *
  780. XCheckRS (phe)
  781. Xstruct he *phe;        /* symbol table entry for ruleset identifier */
  782. X{
  783. X    if (!ISRULESET(phe->idtype)) {
  784. X        if (!ISTYPED(phe->idtype))
  785. X            PrintError ("Ruleset identifier not bound to a number: %s", phe->psb);
  786. X        else
  787. X            PrintError ("Identifier not of ruleset type: %s", phe->psb);
  788. X        return (NULL);
  789. X    } else
  790. X        return (phe->idval.rsn);
  791. X}
  792. X
  793. X
  794. X/*
  795. X *    MakeMac () -- Declare a macro name (pmac) as a class and/or macro type 
  796. X *              (targtype) and return the unique cf character assigned 
  797. X *              to it.
  798. X *
  799. X */
  800. Xchar
  801. XMakeMac (pmac, targtype)
  802. Xregister struct he *pmac;    /* symbol table entry for macro identifier */
  803. Xunsigned targtype;        /* target declaration type for the macro   */
  804. X{
  805. X    /*
  806. X     *    An Ease macro may be declared as both a singular macro and
  807. X     *    a class macro.
  808. X     *
  809. X     */
  810. X    if (ISMACRO(pmac->idtype) || ISCLASS(pmac->idtype)) {
  811. X        pmac->idtype |= targtype;
  812. X        return (pmac->idval.idc);
  813. X    }
  814. X    if (ISTYPED(pmac->idtype)) {    /* not a macro or class id */
  815. X        PrintError ("Redeclaring or using as macro or class: %s", pmac->psb);
  816. X        return ('\0');
  817. X    }
  818. X    pmac->idtype |= targtype;    /* previously untyped; declare here */
  819. X    return (UniqMac (pmac));
  820. X}
  821. X    
  822. X
  823. X/*
  824. X *    GetField () -- Returns a field type string given a field 
  825. X *               identifier (fid).
  826. X *
  827. X */
  828. Xchar *
  829. XGetField (fid)
  830. Xregister struct he *fid;    /* field identifier */
  831. X{
  832. X    if (!ISFIELD(fid->idtype)) {
  833. X        PrintError ("Field type not defined for %s", fid->psb);
  834. X        return (NULL);
  835. X    } else 
  836. X        return (fid->idval.fstring);
  837. X}
  838. X
  839. X
  840. X/*
  841. X *    CheckMailer () -- Declares a mailer identifier (mid) as type mailer,
  842. X *              checking that the identifier was not previously 
  843. X *              declared a different type. 
  844. X *
  845. X */
  846. Xchar *
  847. XCheckMailer (mid)
  848. Xregister struct he *mid;
  849. X{
  850. X    if (ISTYPED (mid->idtype) && !ISMAILER (mid->idtype)) {
  851. X        PrintError ("Redeclaration as mailer: %s", mid->psb);
  852. X        return (NULL);
  853. X    }
  854. X    mid->idtype |= ID_MAILER;
  855. X    return (mid->psb);
  856. X}
  857. X
  858. X
  859. X/*
  860. X *    AssignType () -- Assigns to each field identifier in fidlist the
  861. X *             type (in string form) fidtype.  This is accomplished
  862. X *             by making each field identifier symbol table entry
  863. X *             "point" to the type found in fidtype.
  864. X *
  865. X */
  866. Xvoid
  867. XAssignType (fidlist, fidtype)
  868. Xregister char *fidlist;        /* field identifier list, blank separated */
  869. Xchar *fidtype;            /* field identifier type string          */
  870. X{
  871. X    register struct he *fid;    /* pointer to a field identifier  */
  872. X    char *fres;            /* field type result string      */
  873. X    register char *srch;        /* fidlist search pointer      */
  874. X    char  sep;            /* fidlist separator character    */
  875. X
  876. X    fres = (char *) malloc (strlen (fidtype) + 1);
  877. X    if (fres == NULL)
  878. X        FatalError ("System out of string space in AssignType ()", (char *) NULL);
  879. X    strcpy (fres, fidtype);        /* make clean copy of string type */
  880. X
  881. X    /*
  882. X     *    Search for all field identifiers and make the type assignment. 
  883. X      *
  884. X     */
  885. X    srch = fidlist;
  886. X    while (*srch != '\0') {
  887. X        while ((*++srch != ' ') && (*srch != '\0'))
  888. X            /* null */ ;
  889. X        if (*fidlist != '\0') {                /* found a field id       */
  890. X            sep = *srch;
  891. X            *srch = '\0';
  892. X            fid = LookupSymbol (fidlist);    /* get symbol table entry */
  893. X            if (ISFIELD(fid->idtype)) {
  894. X                if (strcmp (fid->idval.fstring, fres))
  895. X                    PrintWarning ("Redefinition of field type for %s.\n", fid->psb);
  896. X            } else if (ISTYPED(fid->idtype)) {
  897. X                PrintError ("Redeclaration of identifier as a field: %s", fid->psb);
  898. X                return;
  899. X            }
  900. X            fid->idtype |= ID_FIELD;    /* type the identifier    */
  901. X            fid->idval.fstring = fres;    /* type the field      */
  902. X            if ((*srch = sep) != '\0')
  903. X                fidlist = ++srch;
  904. X        }
  905. X    }
  906. X}
  907. END_OF_src/idman.c
  908. if test 6609 -ne `wc -c <src/idman.c`; then
  909.     echo shar: \"src/idman.c\" unpacked with wrong size!
  910. fi
  911. # end of overwriting check
  912. fi
  913. if test -f src/lexan.patch -a "${1}" != "-c" ; then 
  914.   echo shar: Will not over-write existing file \"src/lexan.patch\"
  915. else
  916. echo shar: Extracting \"src/lexan.patch\" \(5320 characters\)
  917. sed "s/^X//" >src/lexan.patch <<'END_OF_src/lexan.patch'
  918. X*** /home/kreskin/u0/barnett/Src/ease/src/lexan.l    Wed Mar  1 15:43:53 1989
  919. X--- lexan.l    Mon May  7 14:12:53 1990
  920. X***************
  921. X*** 59,78 ****
  922. X      static char linbuf[BUFSIZ], *pc = linbuf;
  923. X      char c;
  924. X  
  925. X- 
  926. X- 
  927. X- 
  928. X- 
  929. X      /* initialize buffer: first call only */
  930. X      if (*pc == '\0' && pc == linbuf) {
  931. X          if (fgets(linbuf, BUFSIZ, yyin)==NULL)
  932. X              return EOF;
  933. X!                 if (linbuf[0] == '#' )
  934. X!                     fprintf(yyout, "%s", linbuf);  /* echo input as comment */
  935. X!                 else
  936. X!                     fprintf(yyout, "# %s", linbuf);  /* echo input as comment */
  937. X! 
  938. X      }
  939. X      c = *pc++;
  940. X      if (c == '\n') {
  941. X          pc = linbuf;
  942. X--- 68,82 ----
  943. X      static char linbuf[BUFSIZ], *pc = linbuf;
  944. X      char c;
  945. X  
  946. X      /* initialize buffer: first call only */
  947. X      if (*pc == '\0' && pc == linbuf) {
  948. X          if (fgets(linbuf, BUFSIZ, yyin)==NULL)
  949. X              return EOF;
  950. X!         /* echo input as comment */
  951. X!         if (EchoInputAsComments) {
  952. X!             fprintf(yyout, "%s%s", (linbuf[0] == '#' ? "" : "# "), linbuf);
  953. X          }
  954. X+     }
  955. X      c = *pc++;
  956. X      if (c == '\n') {
  957. X          pc = linbuf;
  958. X***************
  959. X*** 79,90 ****
  960. X          if (fgets(linbuf, BUFSIZ, yyin) == NULL)
  961. X              *pc = EOF;
  962. X          else
  963. X!             /* echo input as comment except cpp comments */
  964. X!                     if (linbuf[0] == '#' )
  965. X!                         fprintf(yyout, "%s", linbuf);  /* echo input as comment */
  966. X!                     else
  967. X!                         fprintf(yyout, "# %s", linbuf);  /* echo input as comment */
  968. X      }
  969. X      return c;
  970. X  }
  971. X  
  972. X--- 83,94 ----
  973. X          if (fgets(linbuf, BUFSIZ, yyin) == NULL)
  974. X              *pc = EOF;
  975. X          else
  976. X!             /* echo input as comment (except cpp comments) */
  977. X!             if (EchoInputAsComments) {
  978. X!                 fprintf(yyout, "%s%s",
  979. X!                 (linbuf[0] == '#' ? "" : "# "), linbuf);
  980. X              }
  981. X+     }
  982. X      return c;
  983. X  }
  984. X  
  985. X***************
  986. X*** 103,109 ****
  987. X      { "Path",        MPATH },
  988. X      { "Recipient",        MRECIPIENT },
  989. X      { "Sender",        MSENDER },
  990. X-     { "asm",        ASM },
  991. X      { "bind",        BIND },
  992. X      { "canon",        CANON },
  993. X      { "class",        CLASS },
  994. X--- 107,112 ----
  995. X***************
  996. X*** 112,121 ****
  997. X      { "d_interactive",    DOPTI },
  998. X      { "d_queue",        DOPTQ },
  999. X      { "define",        DEFINE },
  1000. X-     { "eval",        EVAL },
  1001. X      { "f_addrw",        CCFLAG },
  1002. X      { "f_arpa",        AAFLAG },
  1003. X-     { "f_bsmtp",        BBFLAG },    /* IDA */
  1004. X      { "f_date",        DDFLAG },
  1005. X      { "f_dot",        XXFLAG },
  1006. X      { "f_escape",        EEFLAG },
  1007. X--- 115,122 ----
  1008. X***************
  1009. X*** 125,136 ****
  1010. X      { "f_full",        XFLAG },
  1011. X      { "f_llimit",        LLFLAG },
  1012. X      { "f_locm",        LFLAG },
  1013. X-     { "f_mail11",        HHFLAG },
  1014. X      { "f_mesg",        MMFLAG },
  1015. X      { "f_mult",        MFLAG },
  1016. X      { "f_noreset",        SSFLAG },
  1017. X      { "f_noufrom",        NFLAG },
  1018. X-     { "f_relativize",    VVFLAG },
  1019. X      { "f_retsmtp",        PFLAG },
  1020. X      { "f_return",        PPFLAG },
  1021. X      { "f_rfrom",        RFLAG },
  1022. X--- 126,135 ----
  1023. X***************
  1024. X*** 159,171 ****
  1025. X      { "match",        MATCH },
  1026. X      { "next",        NEXT },
  1027. X      { "o_alias",        AAOPT },
  1028. X-     { "o_aliasfile",    YYOPT },
  1029. X      { "o_bsub",        BBOPT },
  1030. X      { "o_checkpoint",    CCOPT },
  1031. X      { "o_delivery",        DOPT },
  1032. X      { "o_dmuid",        UOPT },
  1033. X      { "o_dnet",        NNOPT },
  1034. X-     { "o_envelope",        SLOPT },
  1035. X      { "o_ewait",        AOPT },
  1036. X      { "o_flog",        SSOPT },
  1037. X      { "o_fsmtp",        HHOPT },
  1038. X--- 158,168 ----
  1039. X***************
  1040. X*** 174,183 ****
  1041. X      { "o_hformat",        OOPT },
  1042. X      { "o_loadnc",        XXOPT },
  1043. X      { "o_loadq",        XOPT },
  1044. X-     { "o_maxempty",        BOPT },
  1045. X-     { "o_maxhops",        HOPT },
  1046. X      { "o_newproc",        YYOPT },
  1047. X-     { "o_nfs",        RROPT },    /* SunOS 4.0 */
  1048. X      { "o_pmaster",        PPOPT },
  1049. X      { "o_prifactor",    ZOPT },
  1050. X      { "o_qdir",        QQOPT },
  1051. X--- 171,177 ----
  1052. X***************
  1053. X*** 200,209 ****
  1054. X      { "o_wizpass",        WWOPT },
  1055. X      { "options",        OPTIONS },
  1056. X      { "precedence",        PRECEDENCE },
  1057. X-     { "quote",        QUOTE },
  1058. X      { "readclass",        READCLASS },
  1059. X      { "resolve",        RESOLVE },
  1060. X-     { "resolved",        RESOLVED },
  1061. X      { "retry",        RETRY },
  1062. X      { "return",        RETURN },
  1063. X      { "ruleset",        RULESET },
  1064. X--- 194,201 ----
  1065. X***************
  1066. X*** 210,218 ****
  1067. X      { "trusted",        TRUSTED },
  1068. X      { "user",        USER },
  1069. X      { "while",        IF },
  1070. X-     { "ypalias",        YPALIAS },
  1071. X-     { "ypmap",        YPMAP },
  1072. X-     { "yppasswd",        YPPASSWD },
  1073. X  };
  1074. X  %}
  1075. X  
  1076. X--- 202,207 ----
  1077. X***************
  1078. X*** 221,231 ****
  1079. X  
  1080. X  [ \t\f]+            ;     /* discard whitepsace  */
  1081. X  [\n]                Lcount++;
  1082. X! ^\#[ \t]*[0-9]+[ \t]*\".*\"[ \t]*.*[\n]    {
  1083. X! /*                    sscanf (yytext, "%*c%d%s", &Lcount, FNbuf); */
  1084. X!                             yymark();
  1085. X                      }
  1086. X! [A-Za-z_][A-Za-z0-9_-]*        {
  1087. X                  register int l, h, m, r, c;
  1088. X  
  1089. X                  l = 0;
  1090. X--- 210,219 ----
  1091. X  
  1092. X  [ \t\f]+            ;     /* discard whitepsace  */
  1093. X  [\n]                Lcount++;
  1094. X! ^\#[ \t]*[0-9]+[ \t]*\".*\"[ \t]*[\n]    {
  1095. X!                     sscanf (yytext, "%*c%d%s", &Lcount, FNbuf);
  1096. X                      }
  1097. X! [A-Za-z][A-Za-z0-9_-]*        {
  1098. X                  register int l, h, m, r, c;
  1099. X  
  1100. X                  l = 0;
  1101. X***************
  1102. X*** 292,305 ****
  1103. X                          INch = input ();
  1104. X                  }
  1105. X                  }
  1106. X- "/"                return (SLASH);
  1107. X  [\\]?.                {
  1108. X                  if (RMatch) {    /* in rulesets, return literal character */
  1109. X                      yylval.ival = (yytext[0] == '\\') ? yytext[1] : yytext[0];
  1110. X                      return (SEPCHAR);
  1111. X- 
  1112. X                  } else {
  1113. X!                     PrintError ("Illegal delimiter character: (octal code) \\%03o", *yytext);
  1114. X                  }
  1115. X                  }
  1116. X  %%
  1117. X--- 280,292 ----
  1118. X                          INch = input ();
  1119. X                  }
  1120. X                  }
  1121. X  [\\]?.                {
  1122. X                  if (RMatch) {    /* in rulesets, return literal character */
  1123. X                      yylval.ival = (yytext[0] == '\\') ? yytext[1] : yytext[0];
  1124. X                      return (SEPCHAR);
  1125. X                  } else {
  1126. X!                     ErrorReport ("Illegal delimiter character");
  1127. X!                     printf (": (octal code) \\%03o\n", *yytext);
  1128. X                  }
  1129. X                  }
  1130. X  %%
  1131. END_OF_src/lexan.patch
  1132. if test 5320 -ne `wc -c <src/lexan.patch`; then
  1133.     echo shar: \"src/lexan.patch\" unpacked with wrong size!
  1134. fi
  1135. # end of overwriting check
  1136. fi
  1137. if test -f src/main.c -a "${1}" != "-c" ; then 
  1138.   echo shar: Will not over-write existing file \"src/main.c\"
  1139. else
  1140. echo shar: Extracting \"src/main.c\" \(7308 characters\)
  1141. sed "s/^X//" >src/main.c <<'END_OF_src/main.c'
  1142. X#ifdef FLUKE
  1143. X# ifndef LINT
  1144. X    static char RCSid[] = "@(#)FLUKE  $Header: /isis/usr2/share/src/local/tc/ease/src/RCS/main.c,v 2.2 90/05/07 11:14:02 jeff Exp $";
  1145. X# endif LINT
  1146. X#endif FLUKE
  1147. X
  1148. X/*
  1149. X *      main.c     -- Main procedure for Ease Translator.
  1150. X *
  1151. X *      author     -- James S. Schoner, Purdue University Computing Center
  1152. X *                        West Lafayette, Indiana  47907
  1153. X *
  1154. X *      date       -- July 9, 1985
  1155. X *
  1156. X *    Copyright (c) 1985 by Purdue Research Foundation
  1157. X *
  1158. X *    All rights reserved.
  1159. X *
  1160. X * $Log:    /isis/usr2/share/src/local/tc/ease/src/RCS/main.c,v $
  1161. X * Version 2.2  90/05/07  11:14:02  jeff
  1162. X * Add support for the "-q" flag which controls whether input lines
  1163. X * are passed through as comments in the output stream.
  1164. X * 
  1165. X * Version 2.1  90/01/30  15:37:16  jeff
  1166. X * Filter input file through cpp before processing it.
  1167. X * 
  1168. X * Revision 2.0  88/06/15  14:42:41  root
  1169. X * Baseline release for net posting. ADR.
  1170. X * 
  1171. X */
  1172. X
  1173. X
  1174. X#ifndef CPP    /* filename of preprocessor */
  1175. X#    define CPP    "/lib/cpp"
  1176. X#endif    CPP
  1177. X
  1178. X#ifndef CPPARGS        /* valid arguments  of preprocessor */
  1179. X#ifdef sun        /* Sun's cpp has more options - I guess */
  1180. X#    define CPPARGS    "BCHpPRTDIUY"
  1181. X#else
  1182. X#    define CPPARGS    "CDEIPU"
  1183. X#endif sun
  1184. X#endif    CPP
  1185. X
  1186. X#include "fixstrings.h"
  1187. X#include <stdio.h>
  1188. X#include <ctype.h>
  1189. X
  1190. Xextern FILE *DIAGf;            /* diagnostic file */
  1191. Xchar *infile = 0;            /* input file name */
  1192. Xchar *outfile = 0;            /* output file name */
  1193. Xextern void InitError (), 
  1194. X        InitSymbolTable (),
  1195. X        DefScan (),
  1196. X        FatalError (),
  1197. X            PreLoad ();
  1198. X
  1199. Xint EchoInputAsComments = 1;        /* should input lines be echoed
  1200. X                     * as comments?
  1201. X                     */
  1202. Xint ErrorCount;                /* translation error count */
  1203. Xvoid GetArgs ();            /* gets arguments to "et"  */
  1204. X
  1205. X#ifdef YYDEBUG
  1206. Xextern int yydebug;
  1207. X#else
  1208. Xstatic int yydebug;
  1209. X#endif
  1210. X
  1211. X/*
  1212. X *    main () -- Main procedure for the Ease Translator et.  If no files are 
  1213. X *                  given as arguments to et, stdin is translated and written to 
  1214. X *               stdout.  If one file is given, it is translated and written 
  1215. X *               to stdout.  If two files are given, the first is translated
  1216. X *               and written to the second.  If the first filename is "-",
  1217. X *               standard input is assumed.  A translation is performed on 
  1218. X *               valid Ease input only, producing a regular sendmail 
  1219. X *           configuration file. 
  1220. X *
  1221. X */
  1222. Xvoid
  1223. Xmain (argc, argv)
  1224. Xint argc;        /* argument count for "et"  */
  1225. Xchar *argv[];        /* argument vector for "et" */
  1226. X{
  1227. X    InitError ();            /* initialize error conditions */
  1228. X    InitSymbolTable ();        /* initialize the symbol table */
  1229. X    PreLoad ();            /* preload special identifiers */
  1230. X    GetArgs (argc, argv);        /* set up argument files       */
  1231. X    (void) yyparse ();        /* perform translation           */
  1232. X    if (fflush (stdout) == EOF)
  1233. X        FatalError ("Cannot flush output stream/file", (char *) NULL);
  1234. X    DefScan ();                /* warn about undefined idents */
  1235. X    if (ErrorCount)
  1236. X        fprintf (DIAGf, "\n\n*** %d error(s) detected.\n", ErrorCount);
  1237. X    exit (ErrorCount);
  1238. X}
  1239. X
  1240. X
  1241. X/*
  1242. X *    GetArgs () -- Processes arguments to the Ease translator "et".  The
  1243. X *              arguments are files (margv) which may replace either/both
  1244. X *              of the files standard input and standard output.  The 
  1245. X *              following cases are possible:
  1246. X *            
  1247. X *              -- et f.e f.cf
  1248. X *                Translate Ease file f.e and write result
  1249. X *                to f.cf.
  1250. X *
  1251. X *              -- et f.e
  1252. X *                Translate Ease file f.e and write result to
  1253. X *                standard output.
  1254. X *
  1255. X *              -- et - f.cf
  1256. X *                Translate standard input and write result to
  1257. X *                f.cf.
  1258. X *
  1259. X *              -- et
  1260. X *                Translate standard input and write result to
  1261. X *                standard output.
  1262. X *
  1263. X *              et also accepts arguments. These include the /lib/cpp arguments
  1264. X *              and the -d argument for debugging grammars.
  1265. X *
  1266. X *              Finally, a message indicating the volatility of the 
  1267. X *              Ease output is written.
  1268. X *
  1269. X */
  1270. Xvoid
  1271. XGetArgs (margc, margv)
  1272. Xregister int   margc;        /* argument count  */
  1273. Xregister char **margv;        /* argument vector */
  1274. X{
  1275. X     register char  **argp;
  1276. X     int    cppflags = 0;
  1277. X     int    otherflags = 0;
  1278. X     int arg;
  1279. X     for (arg = 1; arg < margc; ++arg) {        /* scan arguments */
  1280. X     if (margv[arg][0] == '-') {        /* a flag?*/
  1281. X         if (isalpha(margv[arg][1])) {    /* yes - a flag */
  1282. X         if (index(CPPARGS,margv[arg][1])) ++cppflags;    /* one belonging to the CPP */
  1283. X         else if (margv[arg][1] == 'd' ) yydebug = 1;
  1284. X         else if (margv[arg][1] == 'q' ) EchoInputAsComments = 0;
  1285. X         else ++otherflags;
  1286. X         } else if (! margv[arg][1]) {     /* this argument is just a '-' */
  1287. X         if ( (arg - yydebug - cppflags - otherflags) == 1 )
  1288. X           infile = margv[arg];    
  1289. X         else if ( (arg - yydebug - cppflags - otherflags) == 2 )
  1290. X           outfile = margv[arg];
  1291. X         else
  1292. X           FatalError ("Usage: et [-%s] [infile [outfile]]", CPPARGS);
  1293. X         } else {
  1294. X         FatalError ("Usage: et [-%s] [infile [outfile]]", CPPARGS);
  1295. X         } /* end if a -argument */
  1296. X     } else {    /* a filename - i guess */
  1297. X         if ( (arg - yydebug - cppflags - otherflags) == 1 )
  1298. X           infile = margv[arg];    
  1299. X         else if ( (arg - yydebug - cppflags - otherflags) == 2 )
  1300. X           outfile = margv[arg];
  1301. X         else
  1302. X           FatalError ("Usage: et [-d] [-q] [-%s] [infile [outfile]]", CPPARGS);
  1303. X     } /* end if a filename argument */
  1304. X     }    /* done with parsing all of the arguments */
  1305. X     if (otherflags)
  1306. X       FatalError ("Usage: et [-%s] [infile [outfile]]", CPPARGS);
  1307. X     if (infile && strcmp(infile,"-") )
  1308. X       if (freopen (infile, "r", stdin) == NULL)
  1309. X     FatalError ("Cannot open input stream/file:", infile);
  1310. X     if (outfile && strcmp(outfile,"-") )
  1311. X       if (freopen (outfile, "w", stdout) == NULL)
  1312. X     FatalError ("Cannot open output stream/file:", outfile);
  1313. X     if (cppflags && cpp(margc,margv))
  1314. X     FatalError ("Cannot open preprocessor", CPP);
  1315. X    printf ("###################################################\n");
  1316. X    printf ("##                                               ##\n");
  1317. X    printf ("##  WARNING: THIS FILE IS THE OUTPUT OF THE      ##\n");
  1318. X    printf ("##           `EASE' PRECOMPILER FOR SENDMAIL     ##\n");
  1319. X    printf ("##           CONFIGURATION FILES.                ##\n");
  1320. X    printf ("##                                               ##\n");
  1321. X    printf ("##           MAKE MODIFICATIONS TO THE SOURCE    ##\n");
  1322. X    printf ("##           FILE ONLY.  CHANGES MADE DIRECTLY   ##\n");
  1323. X    printf ("##           TO THIS FILE WILL DISAPPEAR THE     ##\n");
  1324. X    printf ("##           NEXT TIME THAT EASE IS RUN.         ##\n");
  1325. X    printf ("##                                               ##\n");
  1326. X    printf ("###################################################\n");
  1327. X}
  1328. X
  1329. X/* cpp preprocessor code
  1330. X * copied from Schreiner and Friedman's book:
  1331. X * Introduction to Compiler Construction with Unix
  1332. X *
  1333. X * Bruce Barnett
  1334. X */
  1335. X
  1336. Xint cpp(argc,argv)
  1337. X     int argc;
  1338. X     char **argv;
  1339. X{
  1340. X    char **argp, *cmd;
  1341. X    extern FILE *yyin;    /* for lex input */
  1342. X    extern FILE *popen();
  1343. X    int i;
  1344. X
  1345. X    for (i = 0, argp = argv; *++argp; )
  1346. X      if (**argp == '-' &&
  1347. X      index(CPPARGS, (*argp)[1]))
  1348. X    i+=strlen(*argp) + 1;
  1349. X    if ( ! (cmd = (char *) calloc(i + sizeof CPP, sizeof(char))))
  1350. X      return -1;    /* no room */
  1351. X    (void *) strcpy(cmd,CPP);
  1352. X    for (argp = argv; *++argp; )
  1353. X      if (**argp == '-' &&
  1354. X      index(CPPARGS, (*argp)[1]))
  1355. X    strcat(cmd, " "), strcat(cmd, *argp);
  1356. X    if (yyin = popen(cmd,"r"))
  1357. X      i = 0;    /* all's well */
  1358. X    else
  1359. X      i = -1;    /* no preprocessor */
  1360. X    cfree(cmd);
  1361. X    return i;
  1362. X}
  1363. END_OF_src/main.c
  1364. if test 7308 -ne `wc -c <src/main.c`; then
  1365.     echo shar: \"src/main.c\" unpacked with wrong size!
  1366. fi
  1367. # end of overwriting check
  1368. fi
  1369. if test -f src/symtab.c -a "${1}" != "-c" ; then 
  1370.   echo shar: Will not over-write existing file \"src/symtab.c\"
  1371. else
  1372. echo shar: Extracting \"src/symtab.c\" \(6485 characters\)
  1373. sed "s/^X//" >src/symtab.c <<'END_OF_src/symtab.c'
  1374. X#ifdef FLUKE
  1375. X# ifndef LINT
  1376. X    static char RCSid[] = "@(#)FLUKE  $Header: /tmp_mnt/home/kreskin/u0/barnett/Src/Ease/ease/src/RCS/symtab.c,v 3.0 1991/02/22 18:50:27 barnett Exp $";
  1377. X# endif LINT
  1378. X#endif FLUKE
  1379. X
  1380. X/*
  1381. X *      symtab.c   -- Contains Ease Translator symbol table routines.
  1382. X *
  1383. X *      author     -- James S. Schoner, Purdue University Computing Center,
  1384. X *                        West Lafayette, Indiana  47907
  1385. X *
  1386. X *      date       -- July 9, 1985
  1387. X *
  1388. X *    Copyright (c) 1985 by Purdue Research Foundation
  1389. X *
  1390. X *    All rights reserved.
  1391. X *
  1392. X * $Log: symtab.c,v $
  1393. X * Revision 3.0  1991/02/22  18:50:27  barnett
  1394. X * Added support for HP/UX and IDA sendmail.
  1395. X *
  1396. X * Revision 2.1  1990/01/30  15:55:54  jeff
  1397. X * SunOS/Ultrix/Ida additions Jan 25 1988 Bruce Barnett
  1398. X *
  1399. X * Revision 2.0  88/06/15  14:43:04  root
  1400. X * Baseline release for net posting. ADR.
  1401. X */
  1402. X
  1403. X#include "fixstrings.h"
  1404. X#include <stdio.h>
  1405. X#include <ctype.h>
  1406. X#include "symtab.h"
  1407. X
  1408. X#define ERRORMAILER "error"        /* predefined error mailer name */
  1409. X
  1410. Xextern void FatalError (),
  1411. X        PrintWarning ();
  1412. X
  1413. Xstruct he *LookupSymbol ();
  1414. X
  1415. Xstruct Defmac {                /* predefined macro struct def  */
  1416. X    char *macname;
  1417. X    char  macrep;
  1418. X};
  1419. X
  1420. Xstatic struct he *SymTab[SST];        /* hash table base array        */
  1421. Xstatic struct Defmac MacDefs[] = {    /* predefined macros            */
  1422. X            {"m_smtp",    'e'},
  1423. X            {"m_oname",    'j'},
  1424. X            {"m_uucpname",    'k'}, /* IDA */
  1425. X            {"m_ufrom",    'l'},
  1426. X            {"m_daemon",    'n'},
  1427. X            {"m_domain",    'm'},    /* SunOS */
  1428. X            {"m_addrops",    'o'},
  1429. X            {"m_defaddr",    'q'},
  1430. X            {"m_sitename",    'w'},
  1431. X            {"m_odate",    'a'},
  1432. X            {"m_adate",    'b'},
  1433. X            {"m_hops",    'c'},
  1434. X            {"m_udate",    'd'},
  1435. X            {"m_saddr",    'f'},
  1436. X            {"m_sreladdr",    'g'},
  1437. X            {"m_rhost",    'h'},
  1438. X            {"m_qid",    'i'},
  1439. X            {"m_pid",    'p'},
  1440. X            {"m_protocol",    'r'},
  1441. X            {"m_shostname", 's'},
  1442. X            {"m_ctime",    't'},
  1443. X            {"m_ruser",    'u'},
  1444. X            {"m_version",    'v'},
  1445. X            {"m_sname",    'x'},
  1446. X            {"m_stty",    'y'},
  1447. X            {"m_rhdir",    'z'},
  1448. X            {"sentinel",    '\0'}
  1449. X};
  1450. X
  1451. X/* FLUKE jps 28-apr-86 - Install some wired-in class names */
  1452. Xstatic struct Defmac ClassDefs[] = {    /* predefined classes */
  1453. X            {"c_myname",    'w'},
  1454. X            {"c_mydomain",    'm'},
  1455. X            {"class_sentinel",    '\0'}
  1456. X};
  1457. X
  1458. X/*
  1459. X *    DefScan () -- Scan symbol table to find macros, classes, mailers, 
  1460. X *              and rulesets which have been referenced or declared, but
  1461. X *              not defined.  A warning is printed for each such 
  1462. X *              occurence.  This routine is usually called at the end
  1463. X *              of a successful Ease translation.
  1464. X *
  1465. X */
  1466. Xvoid
  1467. XDefScan ()
  1468. X{
  1469. X    register int stindex;        /* symbol table hash index   */
  1470. X    register struct he *hcsearch;    /* hash chain search pointer */
  1471. X
  1472. X    for (stindex = 0; stindex < SST; stindex++) {
  1473. X        if ((hcsearch = SymTab[stindex]) != NULL)
  1474. X            while (hcsearch != NULL) {
  1475. X                if ((ISMACRO(hcsearch->idtype) && 
  1476. X                     isupper(hcsearch->idval.idc)) &&
  1477. X                     !ISMACRO(hcsearch->idd))
  1478. X                    PrintWarning ("Macro not defined: %s\n", hcsearch->psb);
  1479. X#ifdef notdef
  1480. X                if (ISCLASS(hcsearch->idtype) && !ISCLASS(hcsearch->idd))
  1481. X#else
  1482. X                /* FLUKE jps 28-apr-86 */
  1483. X                /* print warnings for UPPER CASE names only */
  1484. X                if (ISCLASS(hcsearch->idtype) &&
  1485. X                    isupper(hcsearch->idval.idc) &&
  1486. X                    !ISCLASS(hcsearch->idd))
  1487. X#endif
  1488. X                    PrintWarning ("Class not defined: %s\n", hcsearch->psb);
  1489. X                if (ISMAILER(hcsearch->idtype) && !ISMAILER(hcsearch->idd))
  1490. X                    PrintWarning ("Mailer not defined: %s\n", hcsearch->psb);
  1491. X                if (ISRULESET(hcsearch->idtype) && !ISRULESET(hcsearch->idd))
  1492. X                    PrintWarning ("Ruleset not defined: %s\n", hcsearch->psb);
  1493. X                hcsearch = hcsearch->phe;
  1494. X            }
  1495. X    }
  1496. X}
  1497. X                     
  1498. X
  1499. X/*
  1500. X *    InitSymbolTable () -- Invoked by main () to initialize the symbol table.
  1501. X *
  1502. X */
  1503. Xvoid
  1504. XInitSymbolTable ()
  1505. X{
  1506. X    int i;
  1507. X
  1508. X    for (i = 0; i < SST; i++)        /* initialize base array */
  1509. X        SymTab[i] = NULL;
  1510. X}
  1511. X
  1512. X
  1513. X/*
  1514. X *    PreLoad () -- Invoked by main () to preload special macro names 
  1515. X *              and mailer declarations.
  1516. X *
  1517. X */
  1518. Xvoid
  1519. XPreLoad ()
  1520. X{
  1521. X    struct Defmac *macptr;
  1522. X    struct he     *symptr;
  1523. X
  1524. X    /* preload special (lower-case) macros */
  1525. X    for (macptr = &MacDefs[0]; (*macptr).macrep != '\0'; macptr++) {
  1526. X        symptr = LookupSymbol ((*macptr).macname);
  1527. X        symptr->idtype |= ID_MACRO;
  1528. X        symptr->idval.idc = (*macptr).macrep;
  1529. X    }
  1530. X
  1531. X    /* preload special (lower-case) classes */
  1532. X    for (macptr = &ClassDefs[0]; (*macptr).macrep != '\0'; macptr++) {
  1533. X        symptr = LookupSymbol ((*macptr).macname);
  1534. X        symptr->idtype |= ID_CLASS;
  1535. X        symptr->idval.idc = (*macptr).macrep;
  1536. X    }
  1537. X
  1538. X    /* preload error mailer declaration */
  1539. X    symptr = LookupSymbol (ERRORMAILER);
  1540. X    symptr->idtype |= ID_MAILER;
  1541. X    symptr->idd |= ID_MAILER;
  1542. X}
  1543. X    
  1544. X
  1545. X/*
  1546. X *    LookupSymbol () -- Returns a pointer to the hash entry already 
  1547. X *               existing, or newly created, which corresponds 
  1548. X *               to string sb.
  1549. X *
  1550. X */
  1551. Xstruct he *
  1552. XLookupSymbol (sb)
  1553. Xchar sb[];            /* string buffer containing identifier */
  1554. X{
  1555. X    struct he *phe;        /* hash entry search pointer  */
  1556. X    int      hc;        /* hash code of sb identifier */
  1557. X    extern char *malloc ();
  1558. X
  1559. X    phe = SymTab[hc = HashCode (sb)];
  1560. X    while (phe != NULL)            /* find hash entry for sb */
  1561. X        if (!strcmp (phe->psb, sb))
  1562. X            return (phe);
  1563. X        else
  1564. X            phe = phe->phe;
  1565. X    /* make new symbol table entry */
  1566. X    if ((phe = (struct he *) malloc (sizeof (struct he))) == NULL)
  1567. X        FatalError ("System out of space in LookupSymbol ()", (char *) NULL);
  1568. X    if ((phe->psb = (char *) malloc (strlen (sb) + 1)) == NULL)
  1569. X        FatalError ("System out of space in LookupSymbol ()", (char *) NULL);
  1570. X    strcpy (phe->psb, sb);
  1571. X    phe->idval.idc = '\0';
  1572. X    phe->idtype = ID_UNTYPED;
  1573. X    phe->idd = ID_UNTYPED;
  1574. X    phe->phe = SymTab[hc];
  1575. X    return (SymTab[hc] = phe);
  1576. X}
  1577. X
  1578. X
  1579. X/*
  1580. X *    RemoveSymbol () -- Removes the symbol table entry phe from the 
  1581. X *               symbol table.
  1582. X *
  1583. X */
  1584. Xvoid
  1585. XRemoveSymbol (phe)
  1586. Xstruct he *phe;       /* pointer to hash entry to be removed from symbol table */
  1587. X{
  1588. X    int hc;               /* hash code of entry phe       */
  1589. X    struct he *sphe;    /* search pointer for entry phe */
  1590. X
  1591. X    if (phe == NULL)
  1592. X        return;
  1593. X    else {            /* search and remove entry phe  */
  1594. X        sphe = SymTab[hc = HashCode (phe->psb)];
  1595. X        free (phe->psb);
  1596. X        if (sphe == phe)
  1597. X            SymTab[hc] = phe->phe;
  1598. X        else
  1599. X            while (sphe != NULL)
  1600. X                if (sphe->phe == phe) {
  1601. X                    sphe->phe = phe->phe;
  1602. X                    return;
  1603. X                } else
  1604. X                    sphe = sphe->phe;
  1605. X    }
  1606. X}
  1607. X
  1608. X
  1609. X/*
  1610. X *    HashCode () -- Returns the hash code of the string in sb by adding 
  1611. X *               the character values and applying mod by the hash 
  1612. X *               table size.
  1613. X *
  1614. X */
  1615. Xint
  1616. XHashCode (sb)
  1617. Xchar sb[];
  1618. X{
  1619. X    int ccSum = 0;            /* sum of char values in string sb */
  1620. X    int i;
  1621. X
  1622. X    for (i = 0; sb[i]; i++)        /* add char codes for sb chars     */
  1623. X        ccSum += sb[i];
  1624. X    return (ccSum % SST);        /* return sum mod table size       */
  1625. X}
  1626. END_OF_src/symtab.c
  1627. if test 6485 -ne `wc -c <src/symtab.c`; then
  1628.     echo shar: \"src/symtab.c\" unpacked with wrong size!
  1629. fi
  1630. # end of overwriting check
  1631. fi
  1632. if test -f test/test.mc -a "${1}" != "-c" ; then 
  1633.   echo shar: Will not over-write existing file \"test/test.mc\"
  1634. else
  1635. echo shar: Extracting \"test/test.mc\" \(4506 characters\)
  1636. sed "s/^X//" >test/test.mc <<'END_OF_test/test.mc'
  1637. X/*
  1638. X * Sendmail configuration file for test rulesets
  1639. X *
  1640. X * Simon Kenyon November 20th, 1986
  1641. X */
  1642. X
  1643. Xbind
  1644. X    EnvelopeTo         = ruleset  0;
  1645. X    From            = ruleset  1;
  1646. X    HeaderTo        = ruleset  2;
  1647. X    Canonicalize        = ruleset  3;
  1648. X    Externalize        = ruleset  4;
  1649. X
  1650. X    LocalHeaderFrom        = ruleset 10;
  1651. X    UucpHeaderFrom        = ruleset 11;
  1652. X
  1653. X    LocalHeaderTo        = ruleset 20;
  1654. X    UucpHeaderTo        = ruleset 21;
  1655. X
  1656. Xmacro
  1657. X    Domain        = "my_domain";
  1658. X    Version        = "ruleset tester V1.0";
  1659. X
  1660. X    m_sitename    = "whatever";
  1661. X    m_oname        = "${m_sitename}.${Domain}";
  1662. X    m_daemon    = "MAILER-DAEMON";
  1663. X    /*m_ufrom        = "From ${m_sreladdr}  ${m_udate} remote from ${m_sitename}";*/
  1664. X    m_ufrom        = "From ${m_sreladdr}  ${m_udate}";
  1665. X    m_addrops    = ".:%@!^=/[]{}";
  1666. X    m_defaddr    = concat (
  1667. X                ifset (m_sname, "${m_sname}    <${m_sreladdr}>",
  1668. X                        "${m_sreladdr}"),
  1669. X                ""
  1670. X              );
  1671. X    m_smtp        = "${m_oname} Sendmail ${m_version}/${Version} ready at ${m_adate}";
  1672. X
  1673. Xoptions
  1674. X    o_alias        = "/usr/lib/aliases";
  1675. X    o_delivery    = d_background;
  1676. X    o_dmuid        = "1";
  1677. X    o_flog        = "/usr/lib/sendmail.st";
  1678. X    o_fsmtp        = "/usr/lib/sendmail.hf";
  1679. X    o_gid        = "1";
  1680. X    o_hformat    = "";
  1681. X    o_qdir        = "/usr/spool/mqueue";
  1682. X    o_qtimeout    = "3d";
  1683. X    o_safe        = "";
  1684. X    o_slog        = "9";
  1685. X    o_timezone    = "WET";
  1686. X    o_tmode        = "0644";
  1687. X    o_tread        = "r2h";
  1688. X    o_wizpass    = "*";
  1689. X
  1690. Xprecedence
  1691. X    first-class        =    0;
  1692. X    special-delivery    =  100;
  1693. X    junk            = -100;
  1694. X
  1695. Xtrusted
  1696. X    {root, daemon, uucp, network};
  1697. X    {simon};
  1698. X
  1699. Xheader
  1700. X    define ("a:", "The origination date in Arpanet format = ${m_odate}");
  1701. X    define ("b:", "The current date in Arpanet format = ${m_adate}");
  1702. X    define ("c:", "The hop count = ${m_hops}");
  1703. X    define ("d:", "The date in UNIX (ctime) format = ${m_udate}");
  1704. X    define ("e:", "The SMTP entry message = ${m_smtp}");
  1705. X    define ("f:", "The sender (from) address = ${m_saddr}");
  1706. X    define ("g:", "The sender address relative to the recipient = ${m_sreladdr}");
  1707. X    define ("h:", "The recipient host = ${m_rhost}");
  1708. X    define ("i:", "The queue id = ${m_qid}");
  1709. X    define ("j:", "The official domain name for this site = ${m_oname}");
  1710. X    define ("l:", "The format of the UNIX from line = ${m_ufrom}");
  1711. X    define ("n:", "The name of the daemon (for error messages) = ${m_daemon}");
  1712. X    define ("o:", "The set of operators in addresses = ${m_addrops}");
  1713. X    define ("p:", "Sendmail's pid = ${m_pid}");
  1714. X    define ("q:", "The default format of sender address = ${m_defaddr}");
  1715. X    define ("r:", "Protocol used = ${m_protocol}");
  1716. X    define ("s:", "Sender's host name = ${m_shostname}");
  1717. X    define ("t:", "A numeric representation of the current time = ${m_ctime}");
  1718. X    define ("u:", "The recipient user = ${m_ruser}");
  1719. X    define ("v:", "The version number of sendmail = ${m_version}");
  1720. X    define ("w:", "The hostname of this site = ${m_sitename}");
  1721. X    define ("x:", "The full name of the sender = ${m_sname}");
  1722. X    define ("y:", "The id of the sender's tty = ${m_stty}");
  1723. X    define ("z:", "The home directory of the recipient = ${m_rhdir}");
  1724. X
  1725. Xfield
  1726. X    path        : match (1*);
  1727. X
  1728. Xruleset Canonicalize {
  1729. X    if (path)
  1730. X        next ("{3}" $1);
  1731. X}
  1732. X
  1733. Xruleset EnvelopeTo {
  1734. X    if (path @ path)
  1735. X        resolve (mailer (uucp),
  1736. X             host ("{0_uucp}" $2),
  1737. X             user ("{0_uucp}" $1));
  1738. X    if (path ! path)
  1739. X        resolve (mailer (uucp),
  1740. X             host ("{0_uucp}" $1),
  1741. X             user ("{0_uucp}" $2));
  1742. X    if (path)
  1743. X        resolve (mailer (local),
  1744. X             user ("{0_local}" $1));
  1745. X}
  1746. X
  1747. Xruleset From {
  1748. X    if (path)
  1749. X        return ("{1}" $1);
  1750. X}
  1751. X
  1752. Xruleset HeaderTo {
  1753. X    if (path)
  1754. X        return ("{2}" $1);
  1755. X}
  1756. X
  1757. Xruleset Externalize {
  1758. X    if (path)
  1759. X        return ("{4}" $1);
  1760. X}
  1761. X
  1762. Xruleset LocalHeaderFrom {
  1763. X    if (path)
  1764. X        return ("{S_local}" $1);
  1765. X}
  1766. X
  1767. Xruleset LocalHeaderTo {
  1768. X    if (path)
  1769. X        return ("{R_local}" $1);
  1770. X}
  1771. X
  1772. Xruleset UucpHeaderFrom {
  1773. X    if (path)
  1774. X        return ("{S_uucp}" $1);
  1775. X}
  1776. X
  1777. Xruleset UucpHeaderTo {
  1778. X    if (path)
  1779. X        return ("{R_uucp}" $1);
  1780. X}
  1781. X
  1782. Xmailer
  1783. X    local {
  1784. X        Path        = "/usr/src/local/EUnet/ease/test/args",
  1785. X        Flags        = {f_date,
  1786. X                   f_from,
  1787. X                   f_locm,
  1788. X                   f_mesg,
  1789. X                   f_mult,
  1790. X                   f_noufrom,
  1791. X                   f_rfrom,
  1792. X                   f_strip},
  1793. X        Sender        = LocalHeaderFrom,
  1794. X        Recipient     = LocalHeaderTo,
  1795. X        Argv        = "args mail -d ${m_ruser}"
  1796. X    };
  1797. X    prog {
  1798. X        Path        = "/usr/src/local/EUnet/ease/test/args",
  1799. X        Flags        = {f_date,
  1800. X                   f_expensive,
  1801. X                   f_from,
  1802. X                   f_locm,
  1803. X                   f_mesg,
  1804. X                   f_noufrom,
  1805. X                   f_strip},
  1806. X        Sender        = LocalHeaderFrom,
  1807. X        Recipient     = LocalHeaderTo,
  1808. X        Argv        = "args sh -c ${m_ruser}"
  1809. X    };
  1810. X    uucp {
  1811. X        Path        = "/usr/src/local/EUnet/ease/test/args",
  1812. X        Flags        = {f_date,
  1813. X                   f_from,
  1814. X                   f_mesg,
  1815. X                   f_strip,
  1816. X                   f_ufrom,
  1817. X                   f_upperh,
  1818. X                   f_upperu},
  1819. X        Sender        = UucpHeaderFrom,
  1820. X        Recipient     = UucpHeaderTo,
  1821. X        Maxsize        = "65535",
  1822. X        Argv        = "args uumail -h -oc -gA -f${m_sreladdr} ${m_rhost}!${m_ruser}"
  1823. X    };
  1824. END_OF_test/test.mc
  1825. if test 4506 -ne `wc -c <test/test.mc`; then
  1826.     echo shar: \"test/test.mc\" unpacked with wrong size!
  1827. fi
  1828. # end of overwriting check
  1829. fi
  1830. echo shar: End of archive 2 \(of 6\).
  1831. cp /dev/null ark2isdone
  1832. MISSING=""
  1833. for I in 1 2 3 4 5 6 ; do
  1834.     if test ! -f ark${I}isdone ; then
  1835.     MISSING="${MISSING} ${I}"
  1836.     fi
  1837. done
  1838. if test "${MISSING}" = "" ; then
  1839.     echo You have unpacked all 6 archives.
  1840.     rm -f ark[1-9]isdone
  1841. else
  1842.     echo You still need to unpack the following archives:
  1843.     echo "        " ${MISSING}
  1844. fi
  1845. ##  End of shell archive.
  1846. exit 0
  1847. --
  1848. Bruce G. Barnett    barnett@crd.ge.com    uunet!crdgw1!barnett
  1849.