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