13502Seric # include	"stdio.h"
23502Seric # include	"../hdr/macros.h"
33502Seric # include	"../hdr/fatal.h"
43502Seric # include	"time.h"
53502Seric 
63502Seric /*
73502Seric  *	defines.h 2.3 of 5/18/78
8*3510Seric  *	defines.h 4.2 of 04/13/81
93502Seric  */
103502Seric 
113502Seric # define CTLSTR		"%c%c\n"
123502Seric 
133502Seric # define CTLCHAR	1
143502Seric # define HEAD		'h'
153502Seric 
163502Seric # define STATS		's'
173502Seric 
183502Seric # define BDELTAB	'd'
193502Seric # define INCLUDE	'i'
203502Seric # define EXCLUDE	'x'
213502Seric # define IGNORE		'g'
223502Seric # define MRNUM		'm'
233502Seric # define COMMENTS	'c'
243502Seric # define EDELTAB	'e'
253502Seric 
263502Seric # define BUSERNAM	'u'
273502Seric # define EUSERNAM	'U'
283502Seric 
293502Seric # define NFLAGS	26
303502Seric 
313502Seric # define FLAG		'f'
323502Seric # define NULLFLAG	'n'
333502Seric # define DEFTFLAG	'd'
343502Seric # define TYPEFLAG	't'
353502Seric # define VALFLAG	'v'
363502Seric # define BRCHFLAG	'b'
373502Seric # define IDFLAG		'i'
383502Seric # define MODFLAG	'm'
393502Seric # define FLORFLAG	'f'
403502Seric # define CEILFLAG	'c'
413502Seric 
423502Seric # define BUSERTXT	't'
433502Seric # define EUSERTXT	'T'
443502Seric 
453502Seric # define INS		'I'
463502Seric # define DEL		'D'
473502Seric # define END		'E'
483502Seric 
493502Seric # define FILESIZE	510
503502Seric # define MAX		9999
513502Seric # define DELIVER	'*'
523502Seric 
533502Seric /*
543502Seric 	Declares for external subroutines and/or functions
553502Seric */
563502Seric 
573502Seric extern	char	*sname();
583502Seric extern	char	*cat();
593502Seric extern	char	*dname();
603502Seric extern	char	*repeat();
613502Seric extern	char	*satoi();
623502Seric extern	char	*strend();
633502Seric extern	char	*substr();
643502Seric extern	char	*trnslat();
653502Seric extern	char	*zero();
663502Seric extern	char	*zeropad();
673502Seric 
683502Seric /*
69*3510Seric 	size of login name
70*3510Seric */
71*3510Seric # define SZLNAM	9	/* size of login name */
72*3510Seric # define LNLNAM	8	/* length of login name */
73*3510Seric 
74*3510Seric /*
753502Seric 	SCCS Internal Structures.
763502Seric */
773502Seric 
783502Seric struct apply {
793502Seric 	char	a_inline;	/* in the line of normally applied deltas */
803502Seric 	char	a_code;		/* APPLY, NOAPPLY or EMPTY */
813502Seric 	int	a_reason;
823502Seric };
833502Seric #define APPLY	  (1)
843502Seric #define NOAPPLY  (-1)
853502Seric #define EMPTY	  (0)
863502Seric 
873502Seric # define IGNR		0100
883502Seric # define USER		040
893502Seric # define INCL		1
903502Seric # define EXCL		2
913502Seric # define CUTOFF		4
923502Seric # define INCLUSER	(USER | INCL)
933502Seric # define EXCLUSER	(USER | EXCL)
943502Seric # define IGNRUSER	(USER | IGNR)
953502Seric 
963502Seric 
973502Seric struct queue {
983502Seric 	struct queue *q_next;
993502Seric 	int    q_sernum;	/* serial number */
1003502Seric 	char    q_keep;		/* keep switch setting */
1013502Seric 	char	q_iord;		/* INS or DEL */
1023502Seric 	char	q_ixmsg;	/* caused inex msg */
1033502Seric 	char	q_user;		/* inex'ed by user */
1043502Seric };
1053502Seric #define YES	 (1)
1063502Seric #define NO	(-1)
1073502Seric 
1083502Seric 
1093502Seric struct	sid {
1103502Seric 	int	s_rel;
1113502Seric 	int	s_lev;
1123502Seric 	int	s_br;
1133502Seric 	int	s_seq;
1143502Seric };
1153502Seric 
1163502Seric 
1173502Seric struct	deltab {
1183502Seric 	struct	sid	d_sid;
1193502Seric 	int	d_serial;
1203502Seric 	int	d_pred;
1213502Seric 	long	d_datetime;
1223508Seric 	char	d_pgmr[SZLNAM];
1233502Seric 	char	d_type;
1243502Seric };
1253502Seric 
1263502Seric struct	ixg {
1273502Seric 	struct	ixg	*i_next;
1283502Seric 	char	i_type;
1293502Seric 	char	i_cnt;
1303502Seric 	int	i_ser[1];
1313502Seric };
1323502Seric 
1333502Seric 
1343502Seric struct	idel {
1353502Seric 	struct	sid	i_sid;
1363502Seric 	struct	ixg	*i_ixg;
1373502Seric 	int	i_pred;
1383502Seric 	long	i_datetime;
1393502Seric };
1403502Seric 
1413502Seric 
1423502Seric # define maxser(pkt)	((pkt)->p_idel->i_pred)
1433502Seric # define sccsfile(f)	imatch("s.", sname(f))
1443502Seric 
1453502Seric struct packet {
1463502Seric 	char	p_file[FILESIZE];	/* file name containing module */
1473502Seric 	struct	sid	p_reqsid;	/* requested SID, then new SID */
1483502Seric 	struct	sid	p_gotsid;	/* gotten SID */
1493502Seric 	struct	sid	p_inssid;	/* SID which inserted current line */
1503502Seric 	char	p_verbose;	/* verbose flags (see #define's below) */
1513502Seric 	char	p_upd;		/* update flag (!0 = update mode) */
1523502Seric 	long	p_cutoff;	/* specified cutoff date-time */
1533502Seric 	int	p_ihash;	/* initial (input) hash */
1543502Seric 	int	p_chash;	/* current (input) hash */
1553502Seric 	int	p_nhash;	/* new (output) hash */
1563502Seric 	int	p_glnno;	/* line number of current gfile line */
1573502Seric 	int	p_slnno;	/* line number of current input line */
1583502Seric 	char	p_wrttn;		/* written flag (!0 = written) */
1593502Seric 	char	p_keep;		/* keep switch for readmod() */
1603502Seric 	struct	apply	*p_apply;	/* ptr to apply array */
1613502Seric 	struct	queue	*p_q;	/* ptr to control queue */
1623502Seric 	FILE	*p_iop;		/* input file */
1633502Seric 	char	p_buf[BUFSIZ];	/* input file buffer */
1643502Seric 	char	p_line[BUFSIZ];	/* buffer for getline() */
1653502Seric 	long	p_cdt;		/* date/time of newest applied delta */
1663502Seric 	char	*p_lfile;	/* 0 = no l-file; else ptr to l arg */
1673502Seric 	struct	idel	*p_idel;	/* ptr to internal delta table */
1683502Seric 	FILE	*p_stdout;	/* standard output for warnings and messages */
1693502Seric 	FILE	*p_gout;	/* g-file output file */
1703502Seric 	char	p_user;		/* !0 = user on user list */
1713502Seric 	char	p_chkeof;	/* 0 = eof generates error */
1723502Seric 	int	p_maxr;		/* largest release number */
1733502Seric 	int	p_ixmsg;	/* inex msg counter */
1743502Seric 	int	p_reopen;	/* reopen flag used by getline on eof */
1753502Seric 	int	p_ixuser;	/* HADI | HADX (in get) */
1763502Seric 	int	do_chksum;	/* for getline(), 1 = do check sum */
1773502Seric };
1783502Seric /*
1793502Seric 	Masks for p_verbose
1803502Seric */
1813502Seric 
1823502Seric # define RLACCESS	(1)
1833502Seric # define NLINES		(2)
1843502Seric # define DOLIST		(4)
1853502Seric # define UNACK		(8)
1863502Seric # define NEWRL		(16)
1873502Seric # define WARNING	(32)
1883502Seric 
1893502Seric 
1903502Seric struct	stats {
1913502Seric 	int	s_ins;
1923502Seric 	int	s_del;
1933502Seric 	int	s_unc;
1943502Seric };
1953502Seric 
1963502Seric 
1973502Seric struct	pfile	{
1983502Seric 	struct	sid	pf_gsid;
1993502Seric 	struct	sid	pf_nsid;
2003508Seric 	char	pf_user[SZLNAM];
2013502Seric 	long	pf_date;
2023502Seric 	char	*pf_ilist;
2033502Seric 	char	*pf_elist;
2043502Seric };
2053502Seric 
2063502Seric 
2073502Seric # define RESPSIZE	512
2083502Seric # define NVARGS	64
2093502Seric # define VSTART 3
210