1*3502Seric # include	"stdio.h"
2*3502Seric # include	"../hdr/macros.h"
3*3502Seric # include	"../hdr/fatal.h"
4*3502Seric # include	"time.h"
5*3502Seric 
6*3502Seric /*
7*3502Seric  *	defines.h 2.3 of 5/18/78
8*3502Seric  */
9*3502Seric 
10*3502Seric # define CTLSTR		"%c%c\n"
11*3502Seric 
12*3502Seric # define CTLCHAR	1
13*3502Seric # define HEAD		'h'
14*3502Seric 
15*3502Seric # define STATS		's'
16*3502Seric 
17*3502Seric # define BDELTAB	'd'
18*3502Seric # define INCLUDE	'i'
19*3502Seric # define EXCLUDE	'x'
20*3502Seric # define IGNORE		'g'
21*3502Seric # define MRNUM		'm'
22*3502Seric # define COMMENTS	'c'
23*3502Seric # define EDELTAB	'e'
24*3502Seric 
25*3502Seric # define BUSERNAM	'u'
26*3502Seric # define EUSERNAM	'U'
27*3502Seric 
28*3502Seric # define NFLAGS	26
29*3502Seric 
30*3502Seric # define FLAG		'f'
31*3502Seric # define NULLFLAG	'n'
32*3502Seric # define DEFTFLAG	'd'
33*3502Seric # define TYPEFLAG	't'
34*3502Seric # define VALFLAG	'v'
35*3502Seric # define BRCHFLAG	'b'
36*3502Seric # define IDFLAG		'i'
37*3502Seric # define MODFLAG	'm'
38*3502Seric # define FLORFLAG	'f'
39*3502Seric # define CEILFLAG	'c'
40*3502Seric 
41*3502Seric # define BUSERTXT	't'
42*3502Seric # define EUSERTXT	'T'
43*3502Seric 
44*3502Seric # define INS		'I'
45*3502Seric # define DEL		'D'
46*3502Seric # define END		'E'
47*3502Seric 
48*3502Seric # define FILESIZE	510
49*3502Seric # define MAX		9999
50*3502Seric # define DELIVER	'*'
51*3502Seric 
52*3502Seric /*
53*3502Seric 	Declares for external subroutines and/or functions
54*3502Seric */
55*3502Seric 
56*3502Seric extern	char	*sname();
57*3502Seric extern	char	*cat();
58*3502Seric extern	char	*dname();
59*3502Seric extern	char	*repeat();
60*3502Seric extern	char	*satoi();
61*3502Seric extern	char	*strend();
62*3502Seric extern	char	*substr();
63*3502Seric extern	char	*trnslat();
64*3502Seric extern	char	*zero();
65*3502Seric extern	char	*zeropad();
66*3502Seric 
67*3502Seric /*
68*3502Seric 	SCCS Internal Structures.
69*3502Seric */
70*3502Seric 
71*3502Seric struct apply {
72*3502Seric 	char	a_inline;	/* in the line of normally applied deltas */
73*3502Seric 	char	a_code;		/* APPLY, NOAPPLY or EMPTY */
74*3502Seric 	int	a_reason;
75*3502Seric };
76*3502Seric #define APPLY	  (1)
77*3502Seric #define NOAPPLY  (-1)
78*3502Seric #define EMPTY	  (0)
79*3502Seric 
80*3502Seric # define IGNR		0100
81*3502Seric # define USER		040
82*3502Seric # define INCL		1
83*3502Seric # define EXCL		2
84*3502Seric # define CUTOFF		4
85*3502Seric # define INCLUSER	(USER | INCL)
86*3502Seric # define EXCLUSER	(USER | EXCL)
87*3502Seric # define IGNRUSER	(USER | IGNR)
88*3502Seric 
89*3502Seric 
90*3502Seric struct queue {
91*3502Seric 	struct queue *q_next;
92*3502Seric 	int    q_sernum;	/* serial number */
93*3502Seric 	char    q_keep;		/* keep switch setting */
94*3502Seric 	char	q_iord;		/* INS or DEL */
95*3502Seric 	char	q_ixmsg;	/* caused inex msg */
96*3502Seric 	char	q_user;		/* inex'ed by user */
97*3502Seric };
98*3502Seric #define YES	 (1)
99*3502Seric #define NO	(-1)
100*3502Seric 
101*3502Seric 
102*3502Seric struct	sid {
103*3502Seric 	int	s_rel;
104*3502Seric 	int	s_lev;
105*3502Seric 	int	s_br;
106*3502Seric 	int	s_seq;
107*3502Seric };
108*3502Seric 
109*3502Seric 
110*3502Seric struct	deltab {
111*3502Seric 	struct	sid	d_sid;
112*3502Seric 	int	d_serial;
113*3502Seric 	int	d_pred;
114*3502Seric 	long	d_datetime;
115*3502Seric 	char	d_pgmr[8];
116*3502Seric 	char	d_type;
117*3502Seric };
118*3502Seric 
119*3502Seric struct	ixg {
120*3502Seric 	struct	ixg	*i_next;
121*3502Seric 	char	i_type;
122*3502Seric 	char	i_cnt;
123*3502Seric 	int	i_ser[1];
124*3502Seric };
125*3502Seric 
126*3502Seric 
127*3502Seric struct	idel {
128*3502Seric 	struct	sid	i_sid;
129*3502Seric 	struct	ixg	*i_ixg;
130*3502Seric 	int	i_pred;
131*3502Seric 	long	i_datetime;
132*3502Seric };
133*3502Seric 
134*3502Seric 
135*3502Seric # define maxser(pkt)	((pkt)->p_idel->i_pred)
136*3502Seric # define sccsfile(f)	imatch("s.", sname(f))
137*3502Seric 
138*3502Seric struct packet {
139*3502Seric 	char	p_file[FILESIZE];	/* file name containing module */
140*3502Seric 	struct	sid	p_reqsid;	/* requested SID, then new SID */
141*3502Seric 	struct	sid	p_gotsid;	/* gotten SID */
142*3502Seric 	struct	sid	p_inssid;	/* SID which inserted current line */
143*3502Seric 	char	p_verbose;	/* verbose flags (see #define's below) */
144*3502Seric 	char	p_upd;		/* update flag (!0 = update mode) */
145*3502Seric 	long	p_cutoff;	/* specified cutoff date-time */
146*3502Seric 	int	p_ihash;	/* initial (input) hash */
147*3502Seric 	int	p_chash;	/* current (input) hash */
148*3502Seric 	int	p_nhash;	/* new (output) hash */
149*3502Seric 	int	p_glnno;	/* line number of current gfile line */
150*3502Seric 	int	p_slnno;	/* line number of current input line */
151*3502Seric 	char	p_wrttn;		/* written flag (!0 = written) */
152*3502Seric 	char	p_keep;		/* keep switch for readmod() */
153*3502Seric 	struct	apply	*p_apply;	/* ptr to apply array */
154*3502Seric 	struct	queue	*p_q;	/* ptr to control queue */
155*3502Seric 	FILE	*p_iop;		/* input file */
156*3502Seric 	char	p_buf[BUFSIZ];	/* input file buffer */
157*3502Seric 	char	p_line[BUFSIZ];	/* buffer for getline() */
158*3502Seric 	long	p_cdt;		/* date/time of newest applied delta */
159*3502Seric 	char	*p_lfile;	/* 0 = no l-file; else ptr to l arg */
160*3502Seric 	struct	idel	*p_idel;	/* ptr to internal delta table */
161*3502Seric 	FILE	*p_stdout;	/* standard output for warnings and messages */
162*3502Seric 	FILE	*p_gout;	/* g-file output file */
163*3502Seric 	char	p_user;		/* !0 = user on user list */
164*3502Seric 	char	p_chkeof;	/* 0 = eof generates error */
165*3502Seric 	int	p_maxr;		/* largest release number */
166*3502Seric 	int	p_ixmsg;	/* inex msg counter */
167*3502Seric 	int	p_reopen;	/* reopen flag used by getline on eof */
168*3502Seric 	int	p_ixuser;	/* HADI | HADX (in get) */
169*3502Seric 	int	do_chksum;	/* for getline(), 1 = do check sum */
170*3502Seric };
171*3502Seric /*
172*3502Seric 	Masks for p_verbose
173*3502Seric */
174*3502Seric 
175*3502Seric # define RLACCESS	(1)
176*3502Seric # define NLINES		(2)
177*3502Seric # define DOLIST		(4)
178*3502Seric # define UNACK		(8)
179*3502Seric # define NEWRL		(16)
180*3502Seric # define WARNING	(32)
181*3502Seric 
182*3502Seric /*
183*3502Seric 	size of login name
184*3502Seric */
185*3502Seric # define SZLNAM	(8)	/* size of login name */
186*3502Seric # define LNLNAM	(7)	/* length of login name */
187*3502Seric 
188*3502Seric 
189*3502Seric struct	stats {
190*3502Seric 	int	s_ins;
191*3502Seric 	int	s_del;
192*3502Seric 	int	s_unc;
193*3502Seric };
194*3502Seric 
195*3502Seric 
196*3502Seric struct	pfile	{
197*3502Seric 	struct	sid	pf_gsid;
198*3502Seric 	struct	sid	pf_nsid;
199*3502Seric 	char	pf_user[8];
200*3502Seric 	long	pf_date;
201*3502Seric 	char	*pf_ilist;
202*3502Seric 	char	*pf_elist;
203*3502Seric };
204*3502Seric 
205*3502Seric 
206*3502Seric # define RESPSIZE	512
207*3502Seric # define NVARGS	64
208*3502Seric # define VSTART 3
209