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