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*3508Seric  *	defines.h 4.1 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 /*
693502Seric 	SCCS Internal Structures.
703502Seric */
713502Seric 
723502Seric struct apply {
733502Seric 	char	a_inline;	/* in the line of normally applied deltas */
743502Seric 	char	a_code;		/* APPLY, NOAPPLY or EMPTY */
753502Seric 	int	a_reason;
763502Seric };
773502Seric #define APPLY	  (1)
783502Seric #define NOAPPLY  (-1)
793502Seric #define EMPTY	  (0)
803502Seric 
813502Seric # define IGNR		0100
823502Seric # define USER		040
833502Seric # define INCL		1
843502Seric # define EXCL		2
853502Seric # define CUTOFF		4
863502Seric # define INCLUSER	(USER | INCL)
873502Seric # define EXCLUSER	(USER | EXCL)
883502Seric # define IGNRUSER	(USER | IGNR)
893502Seric 
903502Seric 
913502Seric struct queue {
923502Seric 	struct queue *q_next;
933502Seric 	int    q_sernum;	/* serial number */
943502Seric 	char    q_keep;		/* keep switch setting */
953502Seric 	char	q_iord;		/* INS or DEL */
963502Seric 	char	q_ixmsg;	/* caused inex msg */
973502Seric 	char	q_user;		/* inex'ed by user */
983502Seric };
993502Seric #define YES	 (1)
1003502Seric #define NO	(-1)
1013502Seric 
1023502Seric 
1033502Seric struct	sid {
1043502Seric 	int	s_rel;
1053502Seric 	int	s_lev;
1063502Seric 	int	s_br;
1073502Seric 	int	s_seq;
1083502Seric };
1093502Seric 
1103502Seric 
1113502Seric struct	deltab {
1123502Seric 	struct	sid	d_sid;
1133502Seric 	int	d_serial;
1143502Seric 	int	d_pred;
1153502Seric 	long	d_datetime;
116*3508Seric 	char	d_pgmr[SZLNAM];
1173502Seric 	char	d_type;
1183502Seric };
1193502Seric 
1203502Seric struct	ixg {
1213502Seric 	struct	ixg	*i_next;
1223502Seric 	char	i_type;
1233502Seric 	char	i_cnt;
1243502Seric 	int	i_ser[1];
1253502Seric };
1263502Seric 
1273502Seric 
1283502Seric struct	idel {
1293502Seric 	struct	sid	i_sid;
1303502Seric 	struct	ixg	*i_ixg;
1313502Seric 	int	i_pred;
1323502Seric 	long	i_datetime;
1333502Seric };
1343502Seric 
1353502Seric 
1363502Seric # define maxser(pkt)	((pkt)->p_idel->i_pred)
1373502Seric # define sccsfile(f)	imatch("s.", sname(f))
1383502Seric 
1393502Seric struct packet {
1403502Seric 	char	p_file[FILESIZE];	/* file name containing module */
1413502Seric 	struct	sid	p_reqsid;	/* requested SID, then new SID */
1423502Seric 	struct	sid	p_gotsid;	/* gotten SID */
1433502Seric 	struct	sid	p_inssid;	/* SID which inserted current line */
1443502Seric 	char	p_verbose;	/* verbose flags (see #define's below) */
1453502Seric 	char	p_upd;		/* update flag (!0 = update mode) */
1463502Seric 	long	p_cutoff;	/* specified cutoff date-time */
1473502Seric 	int	p_ihash;	/* initial (input) hash */
1483502Seric 	int	p_chash;	/* current (input) hash */
1493502Seric 	int	p_nhash;	/* new (output) hash */
1503502Seric 	int	p_glnno;	/* line number of current gfile line */
1513502Seric 	int	p_slnno;	/* line number of current input line */
1523502Seric 	char	p_wrttn;		/* written flag (!0 = written) */
1533502Seric 	char	p_keep;		/* keep switch for readmod() */
1543502Seric 	struct	apply	*p_apply;	/* ptr to apply array */
1553502Seric 	struct	queue	*p_q;	/* ptr to control queue */
1563502Seric 	FILE	*p_iop;		/* input file */
1573502Seric 	char	p_buf[BUFSIZ];	/* input file buffer */
1583502Seric 	char	p_line[BUFSIZ];	/* buffer for getline() */
1593502Seric 	long	p_cdt;		/* date/time of newest applied delta */
1603502Seric 	char	*p_lfile;	/* 0 = no l-file; else ptr to l arg */
1613502Seric 	struct	idel	*p_idel;	/* ptr to internal delta table */
1623502Seric 	FILE	*p_stdout;	/* standard output for warnings and messages */
1633502Seric 	FILE	*p_gout;	/* g-file output file */
1643502Seric 	char	p_user;		/* !0 = user on user list */
1653502Seric 	char	p_chkeof;	/* 0 = eof generates error */
1663502Seric 	int	p_maxr;		/* largest release number */
1673502Seric 	int	p_ixmsg;	/* inex msg counter */
1683502Seric 	int	p_reopen;	/* reopen flag used by getline on eof */
1693502Seric 	int	p_ixuser;	/* HADI | HADX (in get) */
1703502Seric 	int	do_chksum;	/* for getline(), 1 = do check sum */
1713502Seric };
1723502Seric /*
1733502Seric 	Masks for p_verbose
1743502Seric */
1753502Seric 
1763502Seric # define RLACCESS	(1)
1773502Seric # define NLINES		(2)
1783502Seric # define DOLIST		(4)
1793502Seric # define UNACK		(8)
1803502Seric # define NEWRL		(16)
1813502Seric # define WARNING	(32)
1823502Seric 
1833502Seric /*
1843502Seric 	size of login name
1853502Seric */
186*3508Seric # define SZLNAM	9	/* size of login name */
187*3508Seric # define LNLNAM	8	/* length of login name */
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;
200*3508Seric 	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