Subject: v13i029: Patches to EASE sendmail.cf language Newsgroups: comp.sources.unix Sender: sources Approved: rsalz@uunet.UU.NET Submitted-by: "Arnold D. Robbins" Posting-number: Volume 13, Issue 29 Archive-name: ease.pch [ Ease is a language developed at Purdue that is a more friendly way of writing sendmail.cf files. A description was published in the Usenix newsletter ;login: and the source was published in Volume 10 of this newsgroup back in July1987 or so. --r$ ] Rich, Enclosed please find a set of context diffs to 'ease'. These are relative to your most recent posting of ease, in July of this year. The README.new at the front describes the new features; there weren't a huge number of changes, but they make a difference in usability. I hope the ease user community finds these helpful. Arnold Robbins ARPA, CSNET: arnold@emory.ARPA BITNET: arnold@emory UUCP: { decvax, gatech, }!emory!arnold DOMAIN: arnold@emory.edu (soon) #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # README.new # doc.diffs # src.diffs # local.shar export PATH; PATH=/bin:$PATH echo shar: extracting "'README.new'" '(1849 characters)' if test -f 'README.new' then echo shar: will not over-write existing file "'README.new'" else cat << \Howard_The_Duck > 'README.new' README.new - Wed Dec 23 12:16:22 EST 1987 There are four files in this shar archive. README.new -- this file doc.diffs -- diffs to the ease documentation local.shar -- shell scripts and man page for running cpp and ease. src.diffs -- diffs to the ease source This posting provides a number of enhancements to the 'ease' language for writing sendmail configuration files. The diffs are relative to the last posting of ease to comp.sources.unix. They are set up in such a fashion that if used with the 'patch' utility, the several totally new files will be created automatically. The enhancements provided and their authors are as follows: From Stephen Schaefer at BGSU: + Ease will now echo its input to its output as sendmail comments. A simple sed script can recover either the original ease or just the sendmail configuration. From Jeff Stearns at John Fluke Manufacturing Company: + Additions to the syntax to support Sun sendmail extensions. + Fixes to string handling routines to avoid null pointer dereferencing problems. + Improved flexibility in the handling of header definition lines. + Pre-defining the class 'c_myname' for class 'w'. + Miscellanious small bug fixes. From Arnold Robbins at Emory University: + Support for new options and mailer flags in the 4.3 sendmail. + Addition of the keyword "while", equivalent to "if". + Modified the "canon" facility to accept more useful arguments. + Grammar fixes to the Fluke changes to remove reduce/reduce conflicts. + Miscellanious small bug fixes. The new features and changes have all been documented in the ease manual. In addition. local.shar contains 'sh' and 'ksh' scripts for collecting input and output files, and cpp options, and putting it all together to run ease, as well as a simple man page. Arnold Robbins Emory University Computing Center Howard_The_Duck fi # end of overwriting check echo shar: extracting "'doc.diffs'" '(13697 characters)' if test -f 'doc.diffs' then echo shar: will not over-write existing file "'doc.diffs'" else cat << \Howard_The_Duck > 'doc.diffs' diff -cr doc/Makefile /usr/src/local/local.bin/ease/doc/Makefile *** doc/Makefile Thu Aug 13 12:07:05 1987 --- /usr/src/local/local.bin/ease/doc/Makefile Wed Dec 23 11:30:35 1987 *************** *** 1,10 **** # # Makefile for Ease document. # # James S. Schoner # Purdue University Computing Center # ! all: cover mainbody apen1 apen2 apen3 cover: FRC troff -ms cover --- 1,21 ---- # + # $Header: Makefile,v 1.2 87/12/23 11:30:27 root Locked $ + # + # $Log: Makefile,v $ + # Revision 1.2 87/12/23 11:30:27 root + # Added new appendix. ADR. + # + # Revision 1.1 87/12/23 10:40:45 root + # Initial revision + # + # + # # Makefile for Ease document. # # James S. Schoner # Purdue University Computing Center # ! all: cover mainbody apen1 apen2 apen3 apen4 cover: FRC troff -ms cover *************** *** 20,25 **** --- 31,39 ---- apen3: tbl ap3 | troff -ms + + apen4: + tbl ap4 | troff -ms FRC: diff -cr doc/ap1 /usr/src/local/local.bin/ease/doc/ap1 *** doc/ap1 Thu Aug 13 12:07:06 1987 --- /usr/src/local/local.bin/ease/doc/ap1 Thu Jan 21 15:33:47 1988 *************** *** 37,42 **** \fIm_rhdir\fR z The home directory of the recipient .TE .FS ! * Taken from pages 15 and 16 of the Installation and Operation Guide ! for Sendmail (UNIX Programmer's Manual, Volume 2c), by Eric Allman. .FE --- 37,42 ---- \fIm_rhdir\fR z The home directory of the recipient .TE .FS ! * Taken from pages 19 and 20 of the Sendmail Installation and Operation Guide ! (SMM:7 in the 4.3 BSD UNIX System Manager's Manual), by Eric Allman. .FE diff -cr doc/ap2 /usr/src/local/local.bin/ease/doc/ap2 *** doc/ap2 Thu Aug 13 12:07:08 1987 --- /usr/src/local/local.bin/ease/doc/ap2 Thu Jan 21 17:10:56 1988 *************** *** 1,3 **** --- 1,20 ---- + ... + ... $Header: ap2,v 1.4 88/01/21 17:10:33 root Locked $ + ... + ... $Log: ap2,v $ + ... Revision 1.4 88/01/21 17:10:33 root + ... Added new option; change location of Sendmail doc to 4.3 SMM. ADR. + ... + ... Revision 1.3 87/09/04 14:55:36 root + ... Fixed typo in new options. ADR. + ... + ... Revision 1.2 87/03/03 17:05:41 root + ... Changes for 4.3 version of sendmail. ADR. + ... + ... Revision 1.1 87/03/03 17:01:24 root + ... Initial revision + ... + ... .DS C \s+5\fBAppendix B\fR *************** *** 7,14 **** .sp 2 .PP For a complete description of Sendmail's options and their values, refer to ! Appendix B of the Installation and Operation Guide for Sendmail (UNIX ! Programmer's Manual, Volume 2c), by Eric Allman. .sp 2 .TS center box; --- 24,31 ---- .sp 2 .PP For a complete description of Sendmail's options and their values, refer to ! Appendix B of the Sendmail Installation and Operation Guide (SMM:7 in the ! 4.3 BSD UNIX System Managers's Manual), by Eric Allman. .sp 2 .TS center box; *************** *** 41,46 **** --- 58,64 ---- \fIo_dnet\fR N \fIo_hformat\fR o \fIo_qdir\fR Q + \fIo_qfactor\fR q \fIo_tread\fR r \fIo_flog\fR S \fIo_safe\fR s *************** *** 51,54 **** --- 69,76 ---- \fIo_wizpass\fR W \fIo_loadq\fR x \fIo_loadnc\fR X + \fIo_recipfactor\fR y + \fIo_newproc\fR Y + \fIo_prifactor\fR z + \fIo_waitfactor\fR Z .TE diff -cr doc/ap3 /usr/src/local/local.bin/ease/doc/ap3 *** doc/ap3 Thu Aug 13 12:07:10 1987 --- /usr/src/local/local.bin/ease/doc/ap3 Thu Jan 21 17:11:11 1988 *************** *** 1,3 **** --- 1,17 ---- + ... + ... $Header: ap3,v 1.3 88/01/21 17:10:57 root Locked $ + ... + ... $Log: ap3,v $ + ... Revision 1.3 88/01/21 17:10:57 root + ... Changed location of Sendmail doc to 4.3 SMM. ADR. + ... + ... Revision 1.2 87/03/03 17:05:53 root + ... Changes for 4.3 version of sendmail. ADR. + ... + ... Revision 1.1 87/03/03 17:04:52 root + ... Initial revision + ... + ... .DS C \s+5\fBAppendix C\fR *************** *** 7,14 **** .sp 5 .PP For a complete description of mailer flags, refer to ! Appendix C of the Installation and Operation Guide for Sendmail (UNIX ! Programmer's Manual, Volume 2c), by Eric Allman. .sp 5 .TS center box; --- 21,28 ---- .sp 5 .PP For a complete description of mailer flags, refer to ! Appendix C of the Sendmail Installation and Operation Guide (SMM:7 in the ! 4.3 BSD UNIX System Manager's Manual), by Eric Allman. .sp 5 .TS center box; *************** *** 38,41 **** --- 52,56 ---- \fIf_retsmtp\fR p \fIf_smtp\fR I \fIf_addrw\fR C + \fIf_escape\fR E .TE diff -cr doc/cover /usr/src/local/local.bin/ease/doc/cover *** doc/cover Thu Aug 13 12:07:11 1987 --- /usr/src/local/local.bin/ease/doc/cover Wed Dec 23 11:30:46 1987 *************** *** 1,3 **** --- 1,14 ---- + ... + ... $Header: cover,v 1.2 87/12/23 11:30:36 root Locked $ + ... + ... $Log: cover,v $ + ... Revision 1.2 87/12/23 11:30:36 root + ... Updated list of authors. ADR. + ... + ... Revision 1.1 87/12/23 10:16:35 root + ... Initial revision + ... + ... .DA .sp 15 .nr PS 14 *************** *** 19,25 **** for Sendmail .DE ! .sp 13 .nr PS 14 .ps 14 .DS C --- 30,36 ---- for Sendmail .DE ! .sp 8 .nr PS 14 .ps 14 .DS C *************** *** 27,30 **** --- 38,49 ---- \fIJames S. Schoner\fR \fIPurdue University Computing Center\fR + + Amended by + + \fIJeff P. Stearns\fR + \fIJohn Fluke Manufacturing Company\fR + + \fIArnold D. Robbins\fR + \fIEmory University Computing Center\fR .DE diff -cr doc/ease.paper /usr/src/local/local.bin/ease/doc/ease.paper *** doc/ease.paper Thu Aug 13 12:08:37 1987 --- /usr/src/local/local.bin/ease/doc/ease.paper Thu Jan 21 17:19:52 1988 *************** *** 1,3 **** --- 1,24 ---- + ... + ... $Header: ease.paper,v 1.5 88/01/21 17:19:35 root Locked $ + ... + ... $Log: ease.paper,v $ + ... Revision 1.5 88/01/21 17:19:35 root + ... Several editorial changes. ADR. + ... + ... Revision 1.4 87/12/23 11:30:47 root + ... Updated list of authors. Documented extended canon() capability. + ... Integrated fluke changes in a little better. ADR. + ... + ... Revision 1.3 87/11/04 11:33:45 root + ... Documented new keyword "while" which is equivalent to "if". ADR. + ... + ... Revision 1.2 87/08/13 17:08:05 root + ... Changes from Jeff Stearns, fluke!jeff, for Sun. ADR. + ... + ... Revision 1.1 87/08/13 17:05:00 root + ... Initial revision + ... + ... .LP .TL Ease: A Configuration Language *************** *** 7,12 **** --- 28,43 ---- .AI Purdue University Computing Center West Lafayette, Indiana 47907 + .AU + Jeff P. Stearns + .AI + John Fluke Manufacturing Company + Everett, Washington 98206 + .AU + Arnold D. Robbins + .AI + Emory University Computing Center + Atlanta, Georgia 30322 .sp 2 .I .ce *************** *** 47,53 **** the most needed improvement. Nevertheless, every element of a configuration file is structurally enhanced through the use of \fBEase\fR. .FS ! * UNIX is a trademark of AT&T Bell Laboratories. .FE .sp 2 .NH --- 78,84 ---- the most needed improvement. Nevertheless, every element of a configuration file is structurally enhanced through the use of \fBEase\fR. .FS ! * UNIX is a registered trademark of AT&T. .FE .sp 2 .NH *************** *** 107,114 **** the special uses of pre-defined macros, and the method of building configuration files. To obtain this information, the reader is advised to refer to ! the Installation and Operation Guide for Sendmail (UNIX ! Programmer's Manual, Volume 2c), by Eric Allman.\fR .FE .PP At its highest level, \fBEase\fR can be viewed as a collection of --- 138,146 ---- the special uses of pre-defined macros, and the method of building configuration files. To obtain this information, the reader is advised to refer to ! the Sendmail Installation and Operation Guide (SMM:7 in the 4.3 BSD ! UNIX System Manager's Manual), ! by Eric Allman.\fR .FE .PP At its highest level, \fBEase\fR can be viewed as a collection of *************** *** 218,224 **** .PP last_name = "Schoner"; .PP ! whole_name = "${first_name} ${second_name}"; .sp 1 defines the macros first_name, last_name, and whole_name, where whole_name is the string, "James Schoner". --- 250,256 ---- .PP last_name = "Schoner"; .PP ! whole_name = "${first_name} ${last_name}"; .sp 1 defines the macros first_name, last_name, and whole_name, where whole_name is the string, "James Schoner". *************** *** 291,297 **** .PP \fIo_tmode\fR = "0600" ; .PP ! \fIo_delivery\fR = d_background ; .sp 1 sets the options \fIo_alias\fR, \fIo_tmode\fR, and \fIo_delivery\fR. .NH 2 --- 323,329 ---- .PP \fIo_tmode\fR = "0600" ; .PP ! \fIo_delivery\fR = \fId_background\fR ; .sp 1 sets the options \fIo_alias\fR, \fIo_tmode\fR, and \fIo_delivery\fR. .NH 2 *************** *** 382,390 **** define a header, regardless of mailer flags. Refer to Appendix C for a list of \fBEase\fR identifiers representing mailer flags. The header title is a simple ! string of characters (no macro references), whereas the \fBheader-value\fR can ! be either a string of characters (possibly containing macro references) or ! a \fBconditional-expression\fR (discussed later). .sp 1 The following example, .DS --- 414,423 ---- define a header, regardless of mailer flags. Refer to Appendix C for a list of \fBEase\fR identifiers representing mailer flags. The header title is a simple ! string of characters (no macro references), whereas the \fBheader-value\fR ! is a series of one or more strings and ! \fBconditional-expressions\fP (discussed later). ! Concatenation is implicit (as in \fIawk\fP). .sp 1 The following example, .DS *************** *** 495,502 **** \fImatch\fR ( 0* ) \fImatch\fR ( 1* ) \fImatch\fR ( 1 ) ! \fImatch\fR ( 1 ) in ! \fImatch\fR ( 0 ) in .DE The star in the first two forms means: "or more". Thus, the first form would read: "match zero or more tokens". The fourth form describes --- 528,535 ---- \fImatch\fR ( 0* ) \fImatch\fR ( 1* ) \fImatch\fR ( 1 ) ! \fImatch\fR ( 1 ) \fIin\fR ! \fImatch\fR ( 0 ) \fIin\fR .DE The star in the first two forms means: "or more". Thus, the first form would read: "match zero or more tokens". The fourth form describes *************** *** 504,509 **** --- 537,552 ---- the fifth form describes a field where one token is matched if it is not of the given class (class-X). .sp 1 + In addition, the Sun release 3.0 version of sendmail supports several + new pattern matching operations represented by the following forms: + .DS + \fImatch\fR ( 0 ) \fImap\fR + \fImatch\fR ( 1 ) \fImap\fR + \fImatch host\fR + .DE + The macro \*Qmacro-identifier-X\*U should be assigned the name of the + relevant YP map. + .sp 1 The following example, .sp 1 .DS *************** *** 510,517 **** \fIfield\fR anypath : \fImatch\fR ( 0* ); recipient_host : \fImatch\fR ( 1 ); ! local_site : \fImatch\fR ( 1 ) in \fIm_sitename\fR; ! remote_site : \fImatch\fR ( 0 ) in \fIm_sitename\fR; .DE defines the fields anypath, recipient_host, local_site, and remote_site. .NH 2 --- 553,560 ---- \fIfield\fR anypath : \fImatch\fR ( 0* ); recipient_host : \fImatch\fR ( 1 ); ! local_site : \fImatch\fR ( 1 ) \fIin m_sitename\fR; ! remote_site : \fImatch\fR ( 0 ) \fIin m_sitename\fR; .DE defines the fields anypath, recipient_host, local_site, and remote_site. .NH 2 *************** *** 536,541 **** --- 579,591 ---- ( ) ; .DE where match-pattern, rewriting-pattern, and match-action are described below. + An alternative form is available: + .DS + \fIwhile\fR ( ) + ( ) ; + .DE + which is somewhat more useful when the \*Qmatch-action\*U is \fIretry\fP + (see below). .NH 3 Match-patterns .PP *************** *** 601,609 **** T} T{ ! 7. Canonicalized host names of the form \fIcanon\fR (), ! where id-token is a regular identifier, a quoted identifier (with ! double quotes), a macro reference yielding an identifier, or a positional reference in the matched address. The canonicalization of a host name is simply a mapping to its canonical (or official) form. T} --- 651,662 ---- T} T{ ! 7. Canonicalized host names of the form \fIcanon\fR (), ! where \*Qid-token-list\*U is a list of one or more \*Qid-tokens.\*U ! An \*Qid-token\*U is a regular identifier, a quoted identifier (with ! double quotes), a macro reference yielding an identifier, ! a numeric internet specification (see below), ! a literal character (such as a \*Q.\*U or a \*Q[\*U), or a positional reference in the matched address. The canonicalization of a host name is simply a mapping to its canonical (or official) form. T} *************** *** 682,688 **** anypath : \fImatch\fR (0*); usr, path : \fImatch\fR (1*); hostname : \fImatch\fR (1); ! phone_host : \fImatch\fR (1) in phonehosts; .DE .DS \fIruleset\fR --- 735,741 ---- anypath : \fImatch\fR (0*); usr, path : \fImatch\fR (1*); hostname : \fImatch\fR (1); ! phone_host : \fImatch\fR (1) \fIin\fR phonehosts; .DE .DS \fIruleset\fR diff -c /dev/null ap4 *** /dev/null Mon Jan 25 15:47:24 1988 --- ap4 Thu Jan 21 15:13:19 1988 *************** *** 0 **** --- 1,15 ---- + .DS C + \s+5\fBAppendix D\fR + + + \fBPre-Defined Classes\fR\s-5 + .DE + .sp 5 + .TS + center box; + c|c|c + l|l|l. + \fBEase\fR Class Raw Equivalent Meaning + = + \fIc_myname\fR w The list of names by which this host is known + .TE Howard_The_Duck fi # end of overwriting check echo shar: extracting "'src.diffs'" '(29805 characters)' if test -f 'src.diffs' then echo shar: will not over-write existing file "'src.diffs'" else cat << \Howard_The_Duck > 'src.diffs' diff -cr src/Makefile /usr/src/local/local.bin/ease/src/Makefile *** src/Makefile Thu Aug 13 12:07:24 1987 --- /usr/src/local/local.bin/ease/src/Makefile Thu Jan 21 19:05:32 1988 *************** *** 1,6 **** # Makefile for Ease Translator (et). # ! # $Header: /usr/src/local/etc/ease/RCS/Makefile,v 1.4 85/10/29 22:57:06 jss Exp $ # # James S. Schoner, Purdue University Computing Center, # West Lafayette, Indiana 47907 --- 1,6 ---- # Makefile for Ease Translator (et). # ! # $Header: Makefile,v 1.5 87/09/14 18:07:59 root Locked $ # # James S. Schoner, Purdue University Computing Center, # West Lafayette, Indiana 47907 *************** *** 25,34 **** LPFLAGS = -J"Ease Source" HDR = symtab.h ! SRC = main.c emitcf.c errors.c idman.c strops.c symtab.c LST = Makefile lexan.l parser.y ${HDR} ${SRC} DEP = y.tab.c lex.yy.c ${SRC} ! OBJ = y.tab.o lex.yy.o main.o emitcf.o errors.o idman.o strops.o symtab.o all: et --- 25,35 ---- LPFLAGS = -J"Ease Source" HDR = symtab.h ! SRC = main.c emitcf.c errors.c idman.c strops.c symtab.c fixstrings.c LST = Makefile lexan.l parser.y ${HDR} ${SRC} DEP = y.tab.c lex.yy.c ${SRC} ! OBJ = y.tab.o lex.yy.o main.o emitcf.o errors.o idman.o strops.o symtab.o \ ! fixstrings.o all: et diff -cr src/emitcf.c /usr/src/local/local.bin/ease/src/emitcf.c *** src/emitcf.c Thu Aug 13 12:08:15 1987 --- /usr/src/local/local.bin/ease/src/emitcf.c Thu Aug 13 16:24:32 1987 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/emitcf.c,v 1.3 85/11/22 20:14:11 jss Exp $ */ /* * emitcf.c -- This file contains routines associated with the writing --- 1,4 ---- ! /* $Header: emitcf.c,v 1.4 87/08/13 16:24:06 root Locked $ */ /* * emitcf.c -- This file contains routines associated with the writing *************** *** 17,22 **** --- 17,23 ---- #include #include "symtab.h" + #include "fixstrings.h" #define REGLINE 60 /* length of output lines which may be continued */ #define MAXLINE 256 /* liberal maximum line length */ diff -cr src/errors.c /usr/src/local/local.bin/ease/src/errors.c *** src/errors.c Thu Aug 13 12:07:50 1987 --- /usr/src/local/local.bin/ease/src/errors.c Thu Aug 13 16:24:35 1987 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/errors.c,v 1.2 85/10/29 23:40:20 jss Exp $ */ /* * errors.c -- Contains error initialization and reporting routines. --- 1,4 ---- ! /* $Header: errors.c,v 1.3 87/08/13 16:24:32 root Locked $ */ /* * errors.c -- Contains error initialization and reporting routines. *************** *** 15,20 **** --- 15,21 ---- */ #include + #include "fixstrings.h" extern int ErrorCount; /* error count */ extern char FNbuf[]; /* input file name */ diff -cr src/idman.c /usr/src/local/local.bin/ease/src/idman.c *** src/idman.c Thu Aug 13 12:07:53 1987 --- /usr/src/local/local.bin/ease/src/idman.c Thu Aug 13 16:24:39 1987 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/idman.c,v 1.2 85/10/29 23:41:38 jss Exp $ */ /* * idman.c -- Contains routines for manipulating identifiers and their --- 1,4 ---- ! /* $Header: idman.c,v 1.3 87/08/13 16:24:36 root Locked $ */ /* * idman.c -- Contains routines for manipulating identifiers and their *************** *** 17,22 **** --- 17,23 ---- #include #include "symtab.h" + #include "fixstrings.h" extern struct he *LookupSymbol (); extern void FatalError (), diff -cr src/lexan.l /usr/src/local/local.bin/ease/src/lexan.l *** src/lexan.l Thu Aug 13 12:07:55 1987 --- /usr/src/local/local.bin/ease/src/lexan.l Mon Jan 25 15:41:26 1988 *************** *** 1,5 **** %{ ! /* $Header: /usr/src/local/etc/ease/RCS/lexan.l,v 1.2 85/10/29 23:42:40 jss Exp $ */ /* * lexan.l -- Lexical Analyzer for EASE. --- 1,5 ---- %{ ! /* $Header: lexan.l,v 1.9 88/01/25 15:41:02 root Locked $ */ /* * lexan.l -- Lexical Analyzer for EASE. *************** *** 19,24 **** --- 19,25 ---- * */ + #include "fixstrings.h" #include "symtab.h" #include "lexdefs.h" *************** *** 33,44 **** char FNbuf[MaxFN]; /* file name buffer */ short RMatch = FALSE; /* ruleset match flag */ %} /* lex-specific extensions */ ! %e 1100 ! %p 3700 ! %n 500 %% int INch; /* any input character */ --- 34,73 ---- char FNbuf[MaxFN]; /* file name buffer */ short RMatch = FALSE; /* ruleset match flag */ + #undef input + # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):Getc(yyin,yyout))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) + + char + Getc (yyin, yyout) + FILE *yyin, *yyout; + { + static char linbuf[BUFSIZ], *pc = linbuf; + char c; + + /* initialize buffer: first call only */ + if (*pc == '\0' && pc == linbuf) { + if (fgets(linbuf, BUFSIZ, yyin)==NULL) + return EOF; + fprintf(yyout, "# %s", linbuf); /* echo input as comment */ + } + c = *pc++; + if (c == '\n') { + pc = linbuf; + if (fgets(linbuf, BUFSIZ, yyin) == NULL) + *pc = EOF; + else + /* echo input as comment */ + fprintf(yyout, "# %s", linbuf); + } + return c; + } + %} /* lex-specific extensions */ ! %e 1300 ! %p 4000 ! %n 600 %% int INch; /* any input character */ *************** *** 45,56 **** [ \t\f]+ ; /* discard whitepsace */ [\n] Lcount++; ! ^\#[ \t]*[0-9]+[ \t]*\".*\"[ \t]*$ { sscanf (yytext, "%*c%d%s", &Lcount, FNbuf); - INch = input (); } match return (MATCH); in return (IN); bind return (BIND); define return (DEFINE); macro return (MACRO); --- 74,85 ---- [ \t\f]+ ; /* discard whitepsace */ [\n] Lcount++; ! ^\#[ \t]*[0-9]+[ \t]*\".*\"[ \t]*[\n] { sscanf (yytext, "%*c%d%s", &Lcount, FNbuf); } match return (MATCH); in return (IN); + map return (MAP); bind return (BIND); define return (DEFINE); macro return (MACRO); *************** *** 64,69 **** --- 93,99 ---- host return (HOST); user return (USER); hostnum return (HOSTNUM); + while | if return (IF); retry return (RETRY); next return (NEXT); *************** *** 106,111 **** --- 136,142 ---- o_rsend return (MOPT); o_dnet return (NNOPT); o_hformat return (OOPT); + o_qfactor return (QOPT); o_qdir return (QQOPT); o_tread return (ROPT); o_flog return (SSOPT); *************** *** 117,122 **** --- 148,157 ---- o_wizpass return (WWOPT); o_loadq return (XOPT); o_loadnc return (XXOPT); + o_recipfactor return (YOPT); + o_newproc return (YYOPT); + o_prifactor return (ZOPT); + o_waitfactor return (ZZOPT); f_ffrom return (FFLAG); f_rfrom return (RFLAG); f_noreset return (SSFLAG); *************** *** 139,144 **** --- 174,180 ---- f_retsmtp return (PFLAG); f_smtp return (IIFLAG); f_addrw return (CCFLAG); + f_escape return (EEFLAG); [A-Za-z][A-Za-z0-9_-]* { /* store identifiers in symbol table */ yylval.phe = LookupSymbol (yytext); *************** *** 149,154 **** --- 185,191 ---- ErrorReport ("End of line in string.\n"); unput (INch); } + fixquotes (); yylval.psb = (char *) malloc (strlen (yytext) + 1); strcpy (yylval.psb, yytext + 1); return (SCONST); *************** *** 197,199 **** --- 234,261 ---- } } %% + + /* + * fixquotes --- inside a "quoted string", turn `\"' into just `"' + * + * this is most useful inside the Argv strings for mailers, + * particularly when debugging. + */ + + fixquotes () + { + register char *cp1, *cp2; + + cp1 = cp2 = yytext; + while (*cp2) { + /* + * if we really wanted to get fancy, + * at this point we'd handle C escapes, + * but I don't think it's necessary. + */ + if (*cp2 == '\\' && cp2[1] == '"') + cp2++; + *cp1++ = *cp2++; + } + *cp1++ = *cp2++; /* final '\0' */ + } diff -cr src/main.c /usr/src/local/local.bin/ease/src/main.c *** src/main.c Thu Aug 13 12:07:57 1987 --- /usr/src/local/local.bin/ease/src/main.c Thu Aug 13 16:24:50 1987 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/main.c,v 1.2 85/10/29 23:43:38 jss Exp $ */ /* * main.c -- Main procedure for Ease Translator. --- 1,4 ---- ! /* $Header: main.c,v 1.3 87/08/13 16:24:47 root Locked $ */ /* * main.c -- Main procedure for Ease Translator. *************** *** 14,19 **** --- 14,20 ---- * */ + #include "fixstrings.h" #include extern FILE *DIAGf; /* diagnostic file */ *************** *** 100,113 **** } printf ("###################################################\n"); printf ("## ##\n"); ! printf ("## WARNING: THIS FILE IS TO BE MODIFIED BY ##\n"); ! printf ("## THE EASE TRANSLATOR (ET) ONLY. ##\n"); printf ("## ##\n"); ! printf ("## ALL OTHER MODIFICATIONS WILL ##\n"); ! printf ("## DISAPPEAR THE NEXT TIME ET IS RUN. ##\n"); ! printf ("## ##\n"); ! printf ("## MAKE MODIFICATIONS TO THE EASE ##\n"); ! printf ("## SOURCE ONLY. ##\n"); printf ("## ##\n"); printf ("###################################################\n"); } --- 101,114 ---- } printf ("###################################################\n"); printf ("## ##\n"); ! printf ("## WARNING: THIS FILE IS THE OUTPUT OF THE ##\n"); ! printf ("## `EASE' PRECOMPILER FOR SENDMAIL ##\n"); ! printf ("## CONFIGURATION FILES. ##\n"); printf ("## ##\n"); ! printf ("## MAKE MODIFICATIONS TO THE SOURCE ##\n"); ! printf ("## FILE ONLY. CHANGES MADE DIRECTLY ##\n"); ! printf ("## TO THIS FILE WILL DISAPPEAR THE ##\n"); ! printf ("## NEXT TIME THAT EASE IS RUN. ##\n"); printf ("## ##\n"); printf ("###################################################\n"); } diff -cr src/parser.y /usr/src/local/local.bin/ease/src/parser.y *** src/parser.y Thu Aug 13 12:08:20 1987 --- /usr/src/local/local.bin/ease/src/parser.y Mon Jan 25 15:41:46 1988 *************** *** 1,5 **** %{ ! /* $Header: /usr/src/local/etc/ease/RCS/parser.y,v 1.3 85/12/10 18:02:11 jss Exp $ */ /* * parser.y -- EASE parser. --- 1,5 ---- %{ ! /* $Header: parser.y,v 1.10 88/01/25 15:41:27 root Locked $ */ /* * parser.y -- EASE parser. *************** *** 17,24 **** --- 17,40 ---- * * All rights reserved. * + *************************************************************************** + * + * EUCC - Arnold Robbins - 8/13/87. + * Added in support for new options and mailer flag in 4.3 sendmail. + * + * FLUKE jps 18-jun-86 - Changes made to support more flexibility in + * defining header strings as concatenations of simple strings or `ifset' + * strings. Also changes to support Sun sendmail accessing YP maps. + * + * EUCC - Arnold Robbins - 12/22/87. + * Made some changes to restore some functionality in string concatenation, + * and to remove reduce/reduce conflicts in JPS's original productions. + * + * EUCC - Arnold Robbins - 1/21/88 + * Missed a 4.3 flag earlier. */ + #include "fixstrings.h" #include #include "symtab.h" *************** *** 73,82 **** --- 89,101 ---- %token AAOPT AOPT BBOPT COPT DOPT DOPTI DOPTB DOPTQ DDOPT EOPT EOPTP EOPTE %token EOPTM EOPTW EOPTZ FFOPT FOPT GOPT HHOPT IOPT LLOPT MOPT NNOPT OOPT QQOPT %token ROPT SSOPT SOPT TTOPT TOPT UOPT VOPT WWOPT XOPT XXOPT + %token QOPT YOPT YYOPT ZOPT ZZOPT + %token EEFLAG %token FFLAG RFLAG SSFLAG NFLAG LFLAG SFLAG MFLAG FFFLAG DDFLAG MMFLAG XFLAG %token PPFLAG UFLAG HFLAG AAFLAG UUFLAG EFLAG XXFLAG LLFLAG PFLAG IIFLAG CCFLAG %token ASGN COMMA LBRACE RBRACE LPAREN RPAREN SEMI DOLLAR MATCH IN HOSTNUM %token DEFINE FIELD COLON STAR HOST USER + %token MAP %type mval strval ifcon conval ifres elseres nameset namelist %type doptid eoptid idlist fcond dlist mflags route mdefs *************** *** 83,88 **** --- 102,108 ---- %type matchaddr matchtok action actionstmt mailerspec mtdef %type rwaddr rwtok ftype reftok rword cantok resolution %type userspec hword hostid dheader + %type catstring canval canvaltok %type anychar %type cdef %type optid *************** *** 297,302 **** --- 317,325 ---- | QQOPT { $$ = opt_Q; } + | QOPT { + $$ = opt_q; + } | ROPT { $$ = opt_r; } *************** *** 327,332 **** --- 350,367 ---- | XXOPT { $$ = opt_X; } + | YOPT { + $$ = opt_y; + } + | YYOPT { + $$ = opt_Y; + } + | ZOPT { + $$ = opt_z; + } + | ZZOPT { + $$ = opt_Z; + } ; doptid : DOPTI { *************** *** 477,482 **** --- 512,520 ---- | CCFLAG { $$ = flg_C; } + | EEFLAG { + $$ = flg_E; + } ; dheader : /* empty */ { *************** *** 497,503 **** | error ; ! dlist : LPAREN strval COMMA mval RPAREN { $$ = ListAppend ($2, MacScan ($4), " "); free ($2); free ($4); --- 535,541 ---- | error ; ! dlist : LPAREN strval COMMA catstring RPAREN { $$ = ListAppend ($2, MacScan ($4), " "); free ($2); free ($4); *************** *** 507,512 **** --- 545,569 ---- } ; + catstring : SCONST { + $$ = $1; + } + | ifcon { + $$ = $1; + } + | CONCAT LPAREN conval RPAREN { + $$ = $3; + } + | catstring SCONST { + $$ = ListAppend ($1, $2, (char *) NULL); + free ($1); + } + | catstring ifcon { + $$ = ListAppend ($1, $2, (char *) NULL); + free ($2); + } + ; + mlist : /* empty */ | mlist IDENT LBRACE mdefs RBRACE SEMI { EmitDef (def_mailer, $2, $4, (char *) NULL); *************** *** 672,687 **** } ; ! cantok : CANON LPAREN IDENT RPAREN { ! $$ = Bracket ($3->psb, TRUE); ! RemoveSymbol ($3); ! } ! | CANON LPAREN SCONST RPAREN { ! $$ = Bracket (MacScan ($3), TRUE); free ($3); } ! | CANON LPAREN reftok RPAREN { ! $$ = Bracket ($3, TRUE); free ($3); } ; --- 729,766 ---- } ; ! cantok : CANON LPAREN canval RPAREN { ! $$ = Bracket ($3, TRUE); free ($3); } ! ! canval : canvaltok { ! $$ = $1; ! } ! | canval canvaltok { ! $$ = ListAppend ($1, $2, (char *) NULL); ! free ($1); ! free ($2); ! } ! ; ! ! canvaltok : IDENT { ! $$ = ListAppend ($1->psb, (char *) NULL, (char *) NULL); ! RemoveSymbol ($1); ! } ! | SCONST { ! $$ = ListAppend (MacScan ($1), (char *) NULL, (char *) NULL); ! free ($1); ! } ! | reftok { ! $$ = $1; ! } ! | SEPCHAR { ! *Cbuf = $1; ! $$ = ListAppend (Cbuf, (char *) NULL, (char *) NULL); ! } ! | HOSTNUM LPAREN reftok RPAREN { ! $$ = Bracket ($3, FALSE); free ($3); } ; *************** *** 804,814 **** ; ftype : MATCH LPAREN ICONST RPAREN cdef { ! $$ = ListAppend (MakeField ($3, $5, FALSE), (char *) NULL, (char *) NULL); } | MATCH LPAREN ICONST STAR RPAREN { ! $$ = ListAppend (MakeField ($3, (struct he *) NULL, TRUE), (char *) NULL, (char *) NULL); } | error { --- 883,901 ---- ; ftype : MATCH LPAREN ICONST RPAREN cdef { ! $$ = ListAppend (MakeField ($3, $5, FALSE, FALSE), (char *) NULL, (char *) NULL); } + | MATCH LPAREN ICONST RPAREN MAP IDENT { + $$ = ListAppend (MakeField ($3, $6, FALSE, TRUE), + (char *) NULL, (char *) NULL); + } + | MATCH HOST { + $$ = ListAppend ("$%y", + (char *) NULL, (char *) NULL); + } | MATCH LPAREN ICONST STAR RPAREN { ! $$ = ListAppend (MakeField ($3, (struct he *) NULL, TRUE, FALSE), (char *) NULL, (char *) NULL); } | error { diff -cr src/strops.c /usr/src/local/local.bin/ease/src/strops.c *** src/strops.c Thu Aug 13 12:08:23 1987 --- /usr/src/local/local.bin/ease/src/strops.c Mon Jan 25 15:41:53 1988 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/strops.c,v 1.2 85/10/29 23:45:39 jss Exp $ */ /* * strops.c -- Contains string operation routines used for constructing --- 1,4 ---- ! /* $Header: strops.c,v 1.5 88/01/25 15:41:47 root Locked $ */ /* * strops.c -- Contains string operation routines used for constructing *************** *** 15,20 **** --- 15,21 ---- * */ + #include "fixstrings.h" #include #include #include "symtab.h" *************** *** 34,39 **** --- 35,54 ---- static char *Ofield = "$-"; /* one token match structure */ static char *Zfield = "$*"; /* zero or more tokens structure */ static char *Pfield = "$+"; /* one or more tokens structure */ + + /* + * FLUKE jps 25-apr-86 + * + * Add the three new $%x, $%y, and $!x match operators that Sun introduced + * with release 3.0. + * + * BUG (probably) - Sun has assigned a predefined meaning to the $y macro; + * I imagine we will need to teach ease to avoid this letter. + */ + static char *Hfield = "$%y"; /* match in /etc/hosts */ + static char *Mfield = "$% "; /* match in specified YP map */ + static char *Nfield = "$! "; /* no match in specified YP map */ + static char *Mtest = "$? "; /* conditional macro test string */ *************** *** 69,74 **** --- 84,90 ---- case opt_o : return ("o"); case e_opt_p: return ("p"); case opt_Q : return ("Q"); + case opt_q : return ("q"); case d_opt_q: return ("q"); case opt_r : return ("r"); case opt_S : return ("S"); *************** *** 81,86 **** --- 97,106 ---- case e_opt_w: return ("w"); case opt_x : return ("x"); case opt_X : return ("X"); + case opt_y : return ("y"); + case opt_Y : return ("Y"); + case opt_z : return ("z"); + case opt_Z : return ("Z"); case e_opt_z: return ("z"); default : FatalError ("Bad case in ConvOpt ()", (char *) NULL); } *************** *** 120,125 **** --- 140,146 ---- case flg_p: return ("p"); case flg_I: return ("I"); case flg_C: return ("C"); + case flg_E: return ("E"); default : FatalError ("Bad case in ConvFlg ()", (char *) NULL); } /*NOTREACHED*/ *************** *** 336,346 **** PrintError ("Undefined ruleset identifier:", cid->psb); return ((char *) NULL); } ! res = (char *) malloc (strlen (cid->idval.rsn) + strlen (rwaddr) + 3); if (res == NULL) FatalError ("System out of string space in MakeRSCall ()", (char *) NULL); res = strcpy (res, "$>"); /* construct the call string */ res = strcat (res, cid->idval.rsn); res = strcat (res, rwaddr); return (res); } --- 357,376 ---- PrintError ("Undefined ruleset identifier:", cid->psb); return ((char *) NULL); } ! /* ! * FLUKE jps - 8-may-86 - boost string size by 1 to accomodate space ! * character. ! */ ! res = (char *) malloc (strlen (cid->idval.rsn) + strlen (rwaddr) + 4); if (res == NULL) FatalError ("System out of string space in MakeRSCall ()", (char *) NULL); res = strcpy (res, "$>"); /* construct the call string */ res = strcat (res, cid->idval.rsn); + res = strcat (res, " "); /* FLUKE jps - work around sendmail bug: + * whitespace is needed to separate tokens: + * for example: $>30$D will confuse + * sendmail, but $>30 $D is OK. + */ res = strcat (res, rwaddr); return (res); } *************** *** 353,364 **** * are used to determine what type of field string to * construct. * */ char * ! MakeField (count, class, fstar) register int count; /* match count (0 or 1) */ register struct he *class; /* optional class type */ register short fstar; /* repetition flag */ { switch (count) { case 0: if (class == NULL) /* any token is valid */ --- 383,398 ---- * are used to determine what type of field string to * construct. * + * FLUKE jps 25-apr-86 - Modified to add a fourth parameter "isYPmap". This + * supports Sun's new Yellow Pages match patterns added in release 3.0. + * */ char * ! MakeField (count, class, fstar, isYPmap) register int count; /* match count (0 or 1) */ register struct he *class; /* optional class type */ register short fstar; /* repetition flag */ + register short isYPmap; /* "class" name is really a YP map name */ { switch (count) { case 0: if (class == NULL) /* any token is valid */ *************** *** 368,387 **** ErrorReport ("Invalid field type.\n"); return ((char *) NULL); } ! else { /* match 0 from class */ Cfield[1] = '~'; Cfield[2] = MakeMac (class, ID_CLASS); return (Cfield); } case 1: if (class == NULL) /* any token is valid */ if (fstar) return (Pfield); else return (Ofield); ! else { /* match 1 from class */ Cfield[1] = '='; Cfield[2] = MakeMac (class, ID_CLASS); return (Cfield); } default: ErrorReport ("Invalid field type.\n"); } --- 402,439 ---- ErrorReport ("Invalid field type.\n"); return ((char *) NULL); } ! else { /* match 0 from class or map */ ! if (isYPmap) { ! /* "class" is a misnomer here; it's really ! * a simple macro name for a YP map. ! * FLUKE jps 25-apr-86 ! */ ! Nfield[2] = MakeMac (class, ID_MACRO); ! return (Nfield); ! } else { Cfield[1] = '~'; Cfield[2] = MakeMac (class, ID_CLASS); return (Cfield); } + } case 1: if (class == NULL) /* any token is valid */ if (fstar) return (Pfield); else return (Ofield); ! else { /* match 1 from class or map */ ! if (isYPmap) { ! /* "class" is a misnomer here; it's really ! * a simple macro name for a YP map. ! * FLUKE jps 25-apr-86 ! */ ! Mfield[2] = MakeMac (class, ID_MACRO); ! return (Mfield); ! } else { Cfield[1] = '='; Cfield[2] = MakeMac (class, ID_CLASS); return (Cfield); + } } default: ErrorReport ("Invalid field type.\n"); } diff -cr src/symtab.c /usr/src/local/local.bin/ease/src/symtab.c *** src/symtab.c Thu Aug 13 12:08:01 1987 --- /usr/src/local/local.bin/ease/src/symtab.c Thu Aug 13 16:25:19 1987 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/symtab.c,v 1.2 85/10/29 23:46:48 jss Exp $ */ /* * symtab.c -- Contains Ease Translator symbol table routines. --- 1,4 ---- ! /* $Header: symtab.c,v 1.3 87/08/13 16:25:09 root Locked $ */ /* * symtab.c -- Contains Ease Translator symbol table routines. *************** *** 14,19 **** --- 14,20 ---- * */ + #include "fixstrings.h" #include #include #include "symtab.h" *************** *** 59,64 **** --- 60,70 ---- {"sentinel", '\0'} }; + /* FLUKE jps 28-apr-86 - Install some wired-in class names */ + static struct Defmac ClassDefs[] = { /* predefined classes */ + {"c_myname", 'w'}, + {"class_sentinel", '\0'} + }; /* * DefScan () -- Scan symbol table to find macros, classes, mailers, *************** *** 81,87 **** --- 87,101 ---- isupper(hcsearch->idval.idc)) && !ISMACRO(hcsearch->idd)) PrintWarning ("Macro not defined: %s\n", hcsearch->psb); + #ifdef notdef if (ISCLASS(hcsearch->idtype) && !ISCLASS(hcsearch->idd)) + #else + /* FLUKE jps 28-apr-86 */ + /* print warnings for UPPER CASE names only */ + if (ISCLASS(hcsearch->idtype) && + isupper(hcsearch->idval.idc) && + !ISCLASS(hcsearch->idd)) + #endif PrintWarning ("Class not defined: %s\n", hcsearch->psb); if (ISMAILER(hcsearch->idtype) && !ISMAILER(hcsearch->idd)) PrintWarning ("Mailer not defined: %s\n", hcsearch->psb); *************** *** 122,127 **** --- 136,148 ---- for (macptr = &MacDefs[0]; (*macptr).macrep != '\0'; macptr++) { symptr = LookupSymbol ((*macptr).macname); symptr->idtype |= ID_MACRO; + symptr->idval.idc = (*macptr).macrep; + } + + /* preload special (lower-case) classes */ + for (macptr = &ClassDefs[0]; (*macptr).macrep != '\0'; macptr++) { + symptr = LookupSymbol ((*macptr).macname); + symptr->idtype |= ID_CLASS; symptr->idval.idc = (*macptr).macrep; } diff -cr src/symtab.h /usr/src/local/local.bin/ease/src/symtab.h *** src/symtab.h Thu Aug 13 12:07:25 1987 --- /usr/src/local/local.bin/ease/src/symtab.h Mon Jan 25 15:41:58 1988 *************** *** 1,4 **** ! /* $Header: /usr/src/local/etc/ease/RCS/symtab.h,v 1.2 85/10/29 23:47:47 jss Exp $ */ /* * symtab.h -- Definitions related to the "et" symbol table. --- 1,4 ---- ! /* $Header: symtab.h,v 1.4 88/01/25 15:41:54 root Locked $ */ /* * symtab.h -- Definitions related to the "et" symbol table. *************** *** 45,52 **** /* option types */ enum opts {opt_A, opt_a, opt_B, opt_c, opt_D, opt_d, opt_e, opt_F, opt_f, ! opt_g, opt_H, opt_i, opt_L, opt_m, opt_N, opt_o, opt_Q, opt_r, ! opt_S, opt_s, opt_T, opt_t, opt_u, opt_v, opt_W, opt_x, opt_X, d_opt_i, d_opt_b, d_opt_q, e_opt_p, e_opt_e, e_opt_m, e_opt_w, e_opt_z}; --- 45,53 ---- /* option types */ enum opts {opt_A, opt_a, opt_B, opt_c, opt_D, opt_d, opt_e, opt_F, opt_f, ! opt_g, opt_H, opt_i, opt_L, opt_m, opt_N, opt_o, opt_Q, opt_q, ! opt_r, opt_S, opt_s, opt_T, opt_t, opt_u, opt_v, opt_W, opt_x, ! opt_X, opt_Y, opt_y, opt_Z, opt_z, d_opt_i, d_opt_b, d_opt_q, e_opt_p, e_opt_e, e_opt_m, e_opt_w, e_opt_z}; *************** *** 53,59 **** /* flag types */ enum flgs {flg_f, flg_r, flg_S, flg_n, flg_l, flg_s, flg_m, flg_F, flg_D, flg_M, flg_x, flg_P, flg_u, flg_h, flg_A, flg_U, flg_e, flg_X, ! flg_L, flg_p, flg_I, flg_C}; /* mailer parameters */ enum mats {mat_path, mat_flags, mat_sender, mat_recipient, mat_argv, --- 54,60 ---- /* flag types */ enum flgs {flg_f, flg_r, flg_S, flg_n, flg_l, flg_s, flg_m, flg_F, flg_D, flg_M, flg_x, flg_P, flg_u, flg_h, flg_A, flg_U, flg_e, flg_X, ! flg_L, flg_p, flg_I, flg_C, flg_E}; /* mailer parameters */ enum mats {mat_path, mat_flags, mat_sender, mat_recipient, mat_argv, diff -c /dev/null fixstrings.h *** /dev/null Mon Jan 25 16:04:47 1988 --- fixstrings.h Thu Aug 13 15:46:27 1987 *************** *** 0 **** --- 1,31 ---- + /* + * $Source: /vax4/usr3/src/local/tc/ease/RCS/fixstrings.h,v $ + * $Locker: $ + * + * $Revision: 1.3 $ + * Check-in $Date: 87/03/05 19:37:50 $ + * $State: Exp $ + * + * $Author: jeff $ + * + * $Log: /vax4/usr3/src/local/tc/ease/RCS/fixstrings.h,v $ + * Version 1.3 87/03/05 19:37:50 jeff + * Edited RCS header and FLUKEid[] string. + * + * Version 1.2 87/02/25 16:55:16 jeff + * Add some RCS header lines. No code changes. + * + */ + + /* FLUKE jps 16-apr-86 - revector the string routines to custom-coded ones + * which handle NULL pointers. + */ + #define strcat Xstrcat + #define strncat Xstrncat + #define strcmp Xstrcmp + #define strncmp Xstrncmp + #define strcpy Xstrcpy + #define strncpy Xstrncpy + #define strlen Xstrlen + #define index Xindex + #define rindex Xrindex diff -c /dev/null fixstrings.c *** /dev/null Mon Jan 25 16:04:47 1988 --- fixstrings.c Thu Aug 13 16:13:13 1987 *************** *** 0 **** --- 1,85 ---- + /* + * $Source: /vax4/usr3/src/local/tc/ease/RCS/fixstrings.c,v $ + * $Locker: $ + * + * $Revision: 1.3 $ + * Check-in $Date: 87/03/05 19:38:33 $ + * $State: Exp $ + * + * $Author: jeff $ + * + * $Log: /vax4/usr3/src/local/tc/ease/RCS/fixstrings.c,v $ + * Version 1.3 87/03/05 19:38:33 jeff + * Edited RCS header and FLUKEid[] string. + * + * Version 1.2 87/02/25 16:55:13 jeff + * Add some RCS header lines. No code changes. + * + */ + + /* FLUKE jps 16-apr-86 - special hacks for NULL pointers. + * + * The author of ease used a *lot* of NULL pointers. This isn't much + * of a problem on a vax, where NULL pointers look like "". Not so on a Sun. + * + * We hack around the problem by defining a set of wrappers for the + * standard string functions, making it appear as though they accept NULL + * pointers. In the other C files, cpp macros are used to revector the + * standard string functions to this file. + */ + #include + #define fix(s) ((s) ? (s) : "") + + char *Xstrcat (s1, s2) + char *s1, *s2; + { + return (strcat (s1, fix (s2))); + } + + char *Xstrncat (s1, s2, n) + char *s1, *s2; + { + return (strncat (s1, fix (s2), n)); + } + + Xstrcmp (s1, s2) + char *s1, *s2; + { + return (strcmp (fix (s1), fix (s2))); + } + + Xstrncmp (s1, s2, n) + char *s1, *s2; + { + return (strncmp (fix (s1), fix (s2), n)); + } + + char *Xstrcpy (s1, s2) + char *s1, *s2; + { + return (strcpy (s1, fix (s2))); + } + + char *Xstrncpy (s1, s2, n) + char *s1, *s2; + { + return (strncpy (s1, fix (s2), n)); + } + + Xstrlen (s) + char *s; + { + return (strlen (fix (s))); + } + + char *Xindex (s, c) + char *s, c; + { + return (index (fix (s), c)); + } + + char *Xrindex (s, c) + char *s, c; + { + return (rindex (fix (s), c)); + } Howard_The_Duck fi # end of overwriting check echo shar: extracting "'local.shar'" '(3624 characters)' if test -f 'local.shar' then echo shar: will not over-write existing file "'local.shar'" else cat << \Howard_The_Duck > 'local.shar' #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # Makefile # ease.1 # ease.ksh # ease.sh # This archive created: Wed Dec 23 11:59:29 1987 export PATH; PATH=/bin:$PATH echo shar: extracting "'Makefile'" '(260 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else cat << \SHAR_EOF > 'Makefile' # Makefile for 'ease' # EASE_SH= ease.ksh #EASE_SH= ease.sh install: ../src/et $(EASE_SH) install -c -s ../src/et /usr/local/lib cp $(EASE_SH) /usr/local/bin/ease chmod 755 /usr/local/bin/ease cp ease.1 /usr/man/manl/ease.l ../src/et: cd ../src ; make SHAR_EOF fi # end of overwriting check echo shar: extracting "'ease.1'" '(788 characters)' if test -f 'ease.1' then echo shar: will not over-write existing file "'ease.1'" else cat << \SHAR_EOF > 'ease.1' .TH EASE 1 local .SH NAME ease \- build sendmail configuration files from readable descriptions .SH SYNOPSIS .B ease [ .I cpp options ] [ input_file ... ] [ .B \-o output_file ] .SH DESCRIPTION .I Ease is a simple shell script that runs the C preprocessor, piping the output into the Ease Translator. .PP If the .B \-o option is given, the named file will be used for the generated configuration information, otherwise the standard output is used. .PP By default, .I ease will read and write the standard input and output. .SH FILES /lib/cpp .br /usr/local/lib/et .SH SEE ALSO .I "Ease: A Configuration Language for Sendmail" by James S. Schoner, published in the January/February 1986 Usenix .IR ;login: . .SH DIAGNOSTICS A simple usage message if inappropriate arguments are supplied. SHAR_EOF fi # end of overwriting check echo shar: extracting "'ease.ksh'" '(694 characters)' if test -f 'ease.ksh' then echo shar: will not over-write existing file "'ease.ksh'" else cat << \SHAR_EOF > 'ease.ksh' #! /bin/ksh # ease -- run /lib/cpp and send the output into the ease translator # # usage: ease [ cpp options ] [ input files ] [ -o output_file ] PATH=/bin:/usr/ucb:/usr/bin export PATH function usage { echo usage: ease [ cpp options ] [ input files ] [ -o output_file ] 1>&2 exit 1 } ifiles= ofile= opts= while [ $# -gt 0 ] do case "$1" in -o) if [ "$2" ] then ofile="$2" shift else usage fi ;; -o?*) ofile="${1#-o}" ;; -?*) opts="$opts $1" ;; # probably -D or -I cpp options *) ifiles="$ifiles $1" ;; # will catch plain "-" esac shift done # use cat, since it understands the "-" convention cat $ifiles | /lib/cpp $opts | cat -s | /usr/local/lib/et - $ofile SHAR_EOF fi # end of overwriting check echo shar: extracting "'ease.sh'" '(686 characters)' if test -f 'ease.sh' then echo shar: will not over-write existing file "'ease.sh'" else cat << \SHAR_EOF > 'ease.sh' #! /bin/sh # ease -- run /lib/cpp and send the output into the ease translator # # usage: ease [ cpp options ] [ input files ] [ -o output_file ] PATH=/bin:/usr/ucb:/usr/bin export PATH ifiles= ofile= opts= while [ $# -gt 0 ] do case "$1" in -o) if [ "$2" ] then ofile="$2" shift else echo "usage: ease [ cpp options ] [ input files ] [ -o output_file ]" 1>&2 exit 1 fi ;; -o?*) ofile="`expr $1 : '-o\(..*\)'`" ;; -?*) opts="$opts $1" ;; # probably -D or -I cpp options *) ifiles="$ifiles $1" ;; # will catch plain "-" esac shift done # use cat, since it understands the "-" convention cat $ifiles | /lib/cpp $opts | cat -s | /usr/local/lib/et - $ofile SHAR_EOF fi # end of overwriting check # End of shell archive exit 0 Howard_The_Duck fi # end of overwriting check # End of shell archive exit 0