1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License ("CDDL"), version 1.0.
6  * You may use this file only in accordance with the terms of version
7  * 1.0 of the CDDL.
8  *
9  * A full copy of the text of the CDDL should have accompanied this
10  * source.  A copy of the CDDL is also available via the Internet at
11  * http://www.opensource.org/licenses/cddl1.txt
12  * See the License for the specific language governing permissions
13  * and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL HEADER in each
16  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17  * If applicable, add the following below this CDDL HEADER, with the
18  * fields enclosed by brackets "[]" replaced with your own identifying
19  * information: Portions Copyright [yyyy] [name of copyright owner]
20  *
21  * CDDL HEADER END
22  */
23 /* Copyright (c) 1988 AT&T */
24 /* All Rights Reserved */
25 /*
26  * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
27  * Use is subject to license terms.
28  */
29 /*
30  * Copyright 2006-2020 J. Schilling
31  *
32  * @(#)defines.h	1.140 20/09/07 J. Schilling
33  */
34 #ifndef	_HDR_DEFINES_H
35 #define	_HDR_DEFINES_H
36 #if defined(sun)
37 #pragma ident "@(#)defines.h 1.140 20/09/07 J. Schilling"
38 #endif
39 /*
40  * @(#)defines.h 1.21 06/12/12
41  */
42 
43 #if defined(sun)
44 #pragma ident	"@(#)defines.h"
45 #pragma ident	"@(#)sccs:hdr/defines.h"
46 #endif
47 # include	<schily/mconfig.h>
48 # include	<schily/types.h>
49 # include	<schily/utypes.h>
50 # include	<schily/param.h>
51 # include	<schily/stat.h>
52 # include	<schily/errno.h>
53 # include	<schily/fcntl.h>
54 # include	<schily/stdio.h>
55 # include	<schily/stdlib.h>
56 # include	<schily/varargs.h>	/* needed for vfprintf() prototype */
57 # include	<schily/unistd.h>
58 # include	<schily/string.h>
59 # include	<schily/standard.h>	/* define signed */
60 # include	<schily/nlsdefs.h>
61 # include	<schily/io.h>		/* for setmode() prototype */
62 # include	<macros.h>
63 # undef		abs
64 # include	<fatal.h>
65 # include	<schily/time.h>
66 #ifdef	HAVE_MMAP
67 # include	<schily/mman.h>
68 #endif
69 
70 #ifdef	HAVE_LONG_LONG
71 typedef	unsigned long long urand_t;
72 #else
73 typedef struct urand {
74 	unsigned int	high;
75 	unsigned int	low;
76 } urand_t;
77 #endif
78 
79 #ifdef	HAVE_VAR_TIMEZONE		/* SysV compatible: timezone is var */
80 #ifndef	HAVE_VAR_TIMEZONE_DEF		/* IRIX has extern time_t timezone  */
81 extern long timezone;			/* Solaris and others use long	    */
82 #endif
83 #else					/* Other platforms have timezone()  */
84 #define	timezone	xtimezone	/* so use a different name inside.  */
85 extern	long	xtimezone;		/* Provide extern for all files	    */
86 #ifdef	SCCS_MAIN
87 long	xtimezone;			/* Avoid common variables for libs  */
88 #endif
89 #endif
90 #define	tzset		xtzset
91 
92 /*
93  * Note that the #define above will rename the struct timeb member "timezone"
94  * to "xtimezone" as well as the name of the variable.
95  */
96 # include	<schily/timeb.h>
97 
98 extern int optind, opterr, optopt;
99 extern char *optarg;
100 
101 # include	<schily/maxpath.h>
102 #ifndef PATH_MAX
103 #ifdef	FILENAME_MAX
104 #define	PATH_MAX	FILENAME_MAX
105 #endif
106 #endif
107 #ifndef	PATH_MAX
108 #ifdef	MAXPATHNAME
109 #define	PATH_MAX	MAXPATHNAME
110 #endif
111 #endif
112 #ifndef	PATH_MAX
113 #define	PATH_MAX	1024
114 #endif
115 
116 #ifndef	MAXPATHLEN
117 #define	MAXPATHLEN	PATH_MAX
118 #endif
119 
120 #ifdef	NO_SCCS_FATALHELP
121 #undef	SCCS_FATALHELP
122 #endif
123 
124 #ifdef	NO_MMAP
125 #undef	HAVE_MMAP
126 #endif
127 
128 #if	(!defined(HAVE_SNPRINTF) && !defined(NO_SNPRINTF)) || \
129 	defined(NEED_PRINTF_J) && !defined(HAVE_PRINTF_J)
130 #define	NEED_SCHILY_PRINT	/* We need defines for js_snprintf() */
131 #endif
132 
133 #if	(!defined(HAVE_SNPRINTF) && !defined(NO_SNPRINTF)) || \
134 	defined(NEED_PRINTF_Z) && !defined(HAVE_PRINTF_Z)
135 #define	NEED_SCHILY_PRINT	/* We need defines for js_snprintf() */
136 #endif
137 
138 /*
139  * Always include schily/schily.h to allow POSIX bug workarounds to be
140  * implemented in schily/schily.h.
141  */
142 #ifdef	NEED_SCHILY_PRINT
143 #ifndef	SCHILY_PRINT
144 #define	SCHILY_PRINT
145 #endif
146 #endif
147 #include	<schily/schily.h>
148 
149 #if SIZEOF_TIME_T == 4
150 
151 #define	mktime		xmktime
152 #define	localtime	xlocaltime
153 #define	gmtime		xgmtime
154 
155 extern time_t	xmktime		__PR((struct tm *));
156 extern struct tm *xlocaltime	__PR((time_t *));
157 extern struct tm *xgmtime	__PR((time_t *));
158 #endif
159 
160 /*
161  * SCCS was written in 1972. It supports 2 digit year strings from 1969..2068.
162  * Since the Y2000 fix from 1999, it supports to read 4 digit year strings.
163  * We start to create 4 digit year strings in Y2038 when 32 bit SCCS
164  * implementations will stop working.
165  */
166 #define	_YM9999		0x3AFFF4417FL	/* Dec 31 9999 23:59:59 GMT */
167 #define	_Y2069		0xBA37E000	/* Jan 1  2069 00:00:00 GMT */
168 #define	_YM2038		0x7FFFFFFE	/* Jan 19 2038 03:14:07 GMT */
169 #define	_Y2038		0x7FE81780	/* Jan 1  2038 00:00:00 GMT */
170 #ifdef	FOUR_DIGIT_YEAR_TEST
171 #define	_Y2038		0x47800000	/* Jan 6th 2008 for tests */
172 #endif
173 #define	_Y1969		(-31536000)	/* Jan 1  1969 00:00:00 GMT */
174 
175 extern time_t	Y2069;			/* defined in lib/comobj/src/xtzset.c */
176 extern time_t	Y2038;			/* defined in lib/comobj/src/xtzset.c */
177 extern time_t	Y1969;			/* defined in lib/comobj/src/xtzset.c */
178 
179 #if SIZEOF_TIME_T == 4			/* a 32 bit program: */
180 #define	MAX_TIME	(time_t)_YM2038	/* max positive long */
181 #else					/* a 64 bit or larger program: */
182 #define	MAX_TIME	(time_t)_YM9999	/* We currently support 4 digit years */
183 #endif
184 
185 /*
186  * The epoche start for urandom() time -> rand computation:
187  */
188 #define	URAND_BASE	0x50000000	/* 2012 Jul 13 11:01:20 UTC */
189 
190 #define	ALIGNMENT	(sizeof (long long))
191 #define	ROUND(x, base)	(((x) + (base-1)) & ~(base-1))
192 
193 # define CTLSTR		"%c%c\n"
194 
195 # define CTLCHAR	1	/* ^A control character sccs control prelude */
196 # define HEAD		'h'	/* ^Ah sccs magic number and checksum line   */
197 
198 # define STATS		's'	/* ^A sccs stats inserted/deleted/unchanged  */
199 
200 # define BDELTAB	'd'	/* ^Ad sccs delta type line		    */
201 # define INCLUDE	'i'	/* ^Ai list if include serial numbers	    */
202 # define EXCLUDE	'x'	/* ^Ax list of exclude serial numbers	    */
203 # define IGNORE		'g'	/* ^Ag list of ignore serial numbers	    */
204 # define MRNUM		'm'	/* ^Am list of mr-numbers		    */
205 # define SIDEXTENS	'S'	/* ^AS SID specific extensions V6	    */
206 # define COMMENTS	'c'	/* ^Ac a sccs comment line		    */
207 # define EDELTAB	'e'	/* ^Ae the end of a delta table		    */
208 
209 # define BUSERNAM	'u'	/* ^Au begin list of allowed delta users    */
210 # define EUSERNAM	'U'	/* ^AU end list of allowed delta users	    */
211 
212 #define	NFLAGS	28
213 #define	NLOWER		('z'-'a'+1)
214 #define	NUPPER		('Z'-'A'+1)
215 #define	NALPHA		(NLOWER + NUPPER)
216 #define	LOWER(c)	((c) >= 'a' && (c) <= 'z')
217 #define	UPPER(c)	((c) >= 'A' && (c) <= 'Z')
218 #define	ALPHA(c)	(LOWER(c) || UPPER(c))
219 #define	fdx(c)	((c)-'a')	/* Flag array index (e.g. for p_sflags)	    */
220 
221 /*
222  * Definition kept in lib to work around a bug in the Mac OS X linker
223  */
224 extern	char	saveid[50];	/* defined in lib/comobj/src/logname.c */
225 
226 # define FLAG		'f'	/* ^Af	the begin of a flag line	    */
227 # define NULLFLAG	'n'	/* ^Af n create null deltas for skipped rel */
228 # define JOINTFLAG	'j'	/* ^Af j allow multiple concurrent updates  */
229 # define DEFTFLAG	'd'	/* ^Af d def-SID to use for get		    */
230 # define TYPEFLAG	't'	/* ^Af t mod-type used for %Y % keyword	    */
231 # define VALFLAG	'v'	/* ^Af v val-prog used or mr-flags	    */
232 # define CMFFLAG	'z'	/* ^Af z CMFFLAG ????			    */
233 # define BRCHFLAG	'b'	/* ^Af b enables branch deltas		    */
234 # define IDFLAG		'i'	/* ^Af i "No id keywords (cm7)" is an error */
235 # define MODFLAG	'm'	/* ^Af m mod-name used for %M % keyword	    */
236 # define FLORFLAG	'f'	/* ^Af f floor-rel allowed to check out	    */
237 # define CEILFLAG	'c'	/* ^Af c ceiling-rel allowed to check out   */
238 # define QSECTFLAG	'q'	/* ^Af m mod-name used for %Q % keyword	    */
239 # define LOCKFLAG	'l'	/* ^Af l ll relase list locked for get -e   */
240 # define ENCODEFLAG	'e'	/* ^Af e The content is UUencoded	    */
241 # define SCANFLAG	's'	/* ^Af s # of lines to be scanned f. keyw.  */
242 # define EXTENSFLAG	'x'	/* ^Af x enables sccs e'x'tensions	    */
243 # define EXPANDFLAG	'y'	/* ^Af y list of sccs keywords to be exp.   */
244 
245 # define NAMEDFLAG	'F'	/* ^AF	the begin of a named flag line V6   */
246 # define GLOBALEXTENS	'G'	/* ^AG	the begin of a global ext. line V6  */
247 
248 # define BUSERTXT	't'	/* ^At sccs file specific comment start	    */
249 # define EUSERTXT	'T'	/* ^AT sccs file specific comment end	    */
250 
251 # define INS		'I'	/* ^AI release Insert block start	    */
252 # define DEL		'D'	/* ^AD release Delete block start	    */
253 # define END		'E'	/* ^AE release Insert/Delete block end	    */
254 
255 # define NONL		'N'	/* ^AN escaped text line with no newline V6 */
256 
257 # define MINR		1		/* minimum release number */
258 # define MAXR		9999		/* maximum release number */
259 # define MAXL		9999		/* max level for dolist() -> maxint? */
260 #ifndef	MINFBFSZ
261 # define MINFBFSZ	2048	/* Mininum File Buffer Size */
262 #endif
263 # define FILESIZE	max(MAXPATHLEN, MINFBFSZ) /* Space for path names */
264 #ifndef	MINLINESZ
265 # define MINLINESZ	8192	/* Minimum Line Buffer Size */
266 #endif
267 # define MAXLINE	max(BUFSIZ, MINLINESZ)	/* Buffer size for various */
268 # define DEF_LINE_SIZE	128		/* start size for alocated lines */
269 # define DELIVER	'*'		/* MR number was "delivered" no rmdel */
270 # define LOGSIZE	(33)		/* TWCP SCCS compatibility */
271 # define MAXERRORLEN	(1024+FILESIZE)	/* max length of SccsError buffer */
272 
273 # define FAILPUT    fatal("fputs could not write to file (ut13)")
274 # define SCCS_LOCK_ATTEMPTS	4	/* maximum number of lock   attempts  */
275 # define SCCS_CREAT_ATTEMPTS	4	/* maximum number of create attempts  */
276 
277 /*
278  * The second argument for the putmeta() function:
279  */
280 #define	M_INIT_PATH		1
281 #define	M_URAND			2
282 #define	M_ALL			0xffffffff
283 
284 /*
285  * The third argument for the function flushto() controls whether the data
286  * is only read or whether is is copied. FLUSH_COPY copies all lines including
287  * the matching final line. FLUSH_COPY_UNTIL does not copy the matching final
288  * line.
289  */
290 # define FLUSH_COPY		0	/* Copy all read lines until match */
291 # define FLUSH_NOCOPY		1	/* Skip all read lines until match */
292 # define FLUSH_COPY_UNTIL	2	/* Copy read lines until before match */
293 
294 /*
295  * The third argument for the function sinit() is a flag that controls the
296  * behavior. Unless SI_FORCE is used, the filename is checked to be either
297  * "s.name" or "xxx/s.name". SI_FORCE allows us to open the "x.file" for
298  * reading.
299  */
300 # define SI_INIT		0	/* Check filename and init pkt	    */
301 # define SI_OPEN		1	/* Check filename init pkt open file */
302 # define SI_FORCE		2	/* Init pkt & open any file name    */
303 # define SI_NOMAP		4	/* Do not mmap() file		    */
304 
305 # define SI_FORCEOPEN		(SI_OPEN|SI_FORCE)
306 
307 
308 /*
309  *	SCCS Internal Structures.
310  */
311 
312 /*
313  * Definitions for date+time
314  */
315 typedef struct dtime {
316 	time_t	dt_sec;		/* Seconds since Jan 1 1970 GMT		*/
317 	int	dt_nsec;	/* Nanoseconds (must be positive)	*/
318 	int	dt_zone;	/* Timezone (seconds east to GMT)	*/
319 } dtime_t;
320 
321 #define	DT_NO_ZONE	1	/* Impossible timezone - no zone found	*/
322 #define	DT_MIN_ZONE	(-89940) /* Minimum zone (-24:59)		*/
323 #define	DT_MAX_ZONE	93540	/* Minimum zone (+25:59)		*/
324 
325 /*
326  * String space needed for various date formats:
327  *
328  *	DT_STRSIZE	Classical SCCS date format
329  *	DT_LSTRSIZE	Long date format with 4-digit year
330  *	DT_ZSTRSIZE	Long date format with nanoseconds and time zone
331  */
332 #define	DT_STRSIZE	18	/* "11/08/18 10:54:30"			*/
333 #define	DT_LSTRSIZE	20	/* "2011/08/18 10:54:30"		*/
334 #define	DT_ZSTRSIZE	35	/* "2011/08/18 10:54:30.123456789+0200"	*/
335 
336 /*
337  * An array of struct apply[maxser+1] is allocated by dodelt() and assigned to
338  * pkt->p_apply
339  */
340 struct apply {
341 	char	a_inline;	/* in the line of normally applied deltas */
342 	char	a_code;		/* APPLY, NOAPPLY or SX_EMPTY */
343 	char	a_reason;
344 };
345 
346 /*
347  * Definitions for a_code
348  */
349 #define	SX_EMPTY	(0)
350 #define	APPLY		(1)
351 #define	NOAPPLY		(2)
352 
353 /*
354  * Definitions for a_reason
355  */
356 #define	IGNR		0100
357 #define	USER		040
358 #define	INCL		1
359 #define	EXCL		2
360 #define	CUTOFF		4
361 #define	INCLUSER	(USER | INCL)
362 #define	EXCLUSER	(USER | EXCL)
363 #define	IGNRUSER	(USER | IGNR)
364 
365 struct queue {
366 	struct queue *q_next;
367 	int	q_sernum;	/* serial number */
368 	char    q_keep;		/* keep switch setting */
369 	char	q_iord;		/* INS or DEL */
370 	char	q_ixmsg;	/* caused inex msg */
371 	char	q_user;		/* inex'ed by user */
372 };
373 
374 #define	YES	(1)
375 #define	NO	(2)
376 
377 struct	sid {
378 	int	s_rel;		/* Release			*/
379 	int	s_lev;		/* Level			*/
380 	int	s_br;		/* Branch			*/
381 	int	s_seq;		/* Sequence (if branch != 0)	*/
382 };
383 
384 /*
385  * String space needed for the SID.
386  *
387  * Currently s_rel is limited to the range MINR .. MAXR and as long
388  * as MAXR stays 1ith 9999, 38 chars would be enough. It is however
389  * safer to permit the whole range for SID -> string conversion.
390  */
391 #define	SID_STRSIZE	45	/* 4 * 10 + 3 * '.' + '\0' = 44 */
392 
393 /*
394  * Parameters for the -N option:
395  */
396 typedef struct Nparms {
397 	char	n_comma;		/* Found -N,*			*/
398 	char	n_unlink;		/* Found -N-*			*/
399 	char	n_get;			/* Found -N+* or -N++*		*/
400 	char	n_sdot;			/* Found -N*s.			*/
401 	char	n_subd;			/* Found -NSCCS			*/
402 	char	n_didchdir;		/* bulkprepare() did chdir()	*/
403 	char	*n_prefix;		/* "s." /  "* /s." / "* /SCCS"	*/
404 	char	*n_parm;		/* -N argument			*/
405 	char	*n_ifile;		/* The plain g-file name	*/
406 	char	*n_dir_name;		/* directory for -N		*/
407 	int	n_dfd;			/* Openfd for the current dir	*/
408 	struct sid	n_sid;		/* SID if n_get == 2		*/
409 	struct timespec	n_mtime;	/* Timestamp for -i -o		*/
410 	unsigned n_flags;		/* Various flags		*/
411 	unsigned n_pflags;		/* Flags to control processing	*/
412 	int	n_error;		/* bulk processing error #	*/
413 } Nparms;
414 
415 /*
416  * Definitions for n_flags above
417  */
418 #define	N_IFILE		0x0001		/* admin: -i has been specified  */
419 #define	N_IDOT		0x0002		/* admin: -i. has been specified */
420 #define	N_NFILE		0x0004		/* admin: -n has been specified  */
421 #define	N_GETI		0x0008		/* get: -p has not been specified */
422 
423 /*
424  * Definitions for n_pflags above
425  */
426 #define	NP_DIR		0x0001		/* We want the SCCS dir name	*/
427 #define	NP_NOCHDIR	0x0002		/* No chdir() in bulkprepare()	*/
428 
429 /*
430  * Definitions for n_error above
431  */
432 #define	BULK_OK		0		/* Not an error			*/
433 #define	BULK_BADARG	1		/* "bad N argument (co37)"	*/
434 #define	BULK_NOSID	2		/* "not a SID-tagged filename (co38)" */
435 #define	BULK_EPATHCONV	3		/* "path conversion error (co28)" */
436 #define	BULK_ETOOLONG	4		/* "resolved path too long (co29)" */
437 #define	BULK_NOTSCCS	5		/* "not an SCCS file (co1)"	*/
438 #define	BULK_NOTINSUBDIR 6		/* "not in specified sub dir (co36)" */
439 #define	BULK_ECLOSE	7		/* fd close error */
440 #define	BULK_ECHDIR	8		/* chdir() error */
441 #define	BULK_EISDIR	9		/* "dir specified as s-file (cm14)" */
442 #define	BULK_ENOTDIR	10		/* "non dir specified as arg (cm20)" */
443 #define	BULK_ENOIENT	11		/* input file does not exist	*/
444 #define	BULK_EMKDIR	12		/* cannot make dir		*/
445 
446 
447 /*
448  * Parameters for the -X option:
449  */
450 typedef struct Xparms {
451 	char	*x_parm;		/* -X argument			*/
452 	char	*x_mail;		/* -Xmail Email address		*/
453 	char	*x_user;		/* -Xuser User name		*/
454 	char	*x_gpath;		/* -Xgpath g-path		*/
455 	dtime_t	x_dtime;		/* -Xdate datetime		*/
456 	char	*x_init_path;		/* -XGp Initial path		*/
457 	urand_t	x_rand;			/* -XGr Unified random number	*/
458 	unsigned x_opts;		/* Options seen			*/
459 	unsigned x_flags;		/* Options permitted		*/
460 } Xparms;
461 
462 /*
463  * Definitions for x_opts / x_flags above
464  */
465 #define	XO_PREPEND_FILE	0x01		/* Optimized mode for Changeset files */
466 #define	XO_INIT_PATH	0x10		/* -XGp Initial path		*/
467 #define	XO_URAND	0x20		/* -XGr Unified random number	*/
468 #define	XO_UNLINK	0x40		/* -Xunlink create an unlink delta */
469 #define	XO_MAIL		0x80		/* -Xmail= e-mail address	*/
470 #define	XO_USER		0x100		/* -Xuser= user name		*/
471 #define	XO_DATE		0x200		/* -Xdate= commit date		*/
472 #define	XO_NULLPATH	0x400		/* -X0 read '\0' terminated pathnames */
473 #define	XO_NOBULK	0x800		/* -Xnobulk Disable bulkprepare() */
474 #define	XO_G_PATH	0x1000		/* -Xgpath=g-path		*/
475 
476 
477 struct	deltab {
478 	struct	sid	d_sid;
479 	int	d_serial;
480 	int	d_pred;
481 	dtime_t	d_dtime;
482 	char	d_pgmr[LOGSIZE];
483 	char	d_type;
484 };
485 
486 struct	ixg {
487 	struct	ixg	*i_next;
488 	char	i_type;
489 	char	i_cnt;
490 	int	i_ser[1];
491 };
492 
493 /*
494  * An array of struct idel[maxser+1] is allocated by dodelt() and assigned to
495  * pkt->p_idel
496  */
497 struct	idel {
498 	struct	sid	i_sid;		/* sid from ^Ad line		*/
499 	struct	ixg	*i_ixg;		/* I/X/G entries from delta	*/
500 	int		i_pred;		/* predecessor serial		*/
501 	char		i_dtype;	/* delta type from ^Ad line	*/
502 					/* 3 bytes padding		*/
503 	struct timespec	i_datetime;	/* time stamp from ^Ad line	*/
504 };
505 
506 # define maxser(pkt)	((pkt)->p_idel->i_pred)
507 # define sccsfile(f)	imatch("s.", sname(f))
508 
509 /*
510  * SCCS used to use setbuf() with packet.p_buf as buffer. Since at least
511  * Solaris uses parts of such a buffer for multi-byte putback features,
512  * calling setbuf() is counter-productive as it results in unaligned reads
513  * with BUFSIZE-8 as read(2) buffer size.
514  * We try to avoid this problem by calling setvbuf(f, NULL, _IOFBF, size)
515  * and telling stdio to allocate the buffer for us instead. Thus, if we have
516  * setvbuf, we no longer need packet.p_buf.
517  */
518 #ifdef	HAVE_SETVBUF
519 #ifdef	VBUF_BUFSIZE
520 #define	VBUF_SIZE	VBUF_BUFSIZE
521 #else
522 #define	VBUF_SIZE	(32*1024)
523 #endif
524 #define	USE_SETVBUF
525 #else
526 #define	VBUF_SIZE	BUFSIZ
527 #endif
528 #ifdef	pdp11
529 #undef	VBUF_SIZE
530 #define	VBUF_SIZE	512
531 #endif
532 #ifdef	VMS
533 #define	RECORD_IO
534 #endif
535 #if !defined(SCHILY_BUILD) && !defined(RECORD_IO)
536 #define	RECORD_IO
537 #endif
538 
539 struct packet {
540 	char	p_file[FILESIZE]; /* file name containing module */
541 	struct	sid p_reqsid;	/* requested SID, then new SID */
542 	struct	sid p_gotsid;	/* gotten SID */
543 	struct	sid p_inssid;	/* SID which inserted current line */
544 #ifdef	HAVE_MMAP
545 	off_t	p_mmsize;	/* size of mmap()ed area */
546 	char	*p_mmbase;	/* mmap() base address for file */
547 	char	*p_mmend;	/* mmap() end address for file */
548 	char	*p_mmnext;	/* next "read" position in mmapped file */
549 	char	p_savec;	/* saved char from *p_mmnext */
550 #endif
551 	char	*p_sflags[NFLAGS]; /* SCCS s.file flags */
552 	char	p_verbose;	/* verbose flags (see #define's below) */
553 	char	p_upd;		/* update flag (!0 = update mode) */
554 	char	p_flags;	/* general flags see below */
555 	char	p_props;	/* file properties see below */
556 	time_t	p_cutoff;	/* specified cutoff date-time */
557 	int	p_ihash;	/* initial (input) hash */
558 	int	p_chash;	/* current (input) hash */
559 	int	p_uchash;	/* current unsigned (input) hash */
560 	int	p_clhash;	/* current (input) line hash */
561 	int	p_uclhash;	/* current unsigned (input) line hash */
562 	int	p_nhash;	/* new (output) hash */
563 	int	p_onhash;	/* saved (output) hash */
564 	int	p_ghash;	/* current gfile hash */
565 	int	p_glines;	/* number of lines in current gfile */
566 	int	p_glnno;	/* line number of current gfile line */
567 	int	p_slnno;	/* line number of current input line */
568 	int	p_insser;	/* serial number which inserted current line */
569 	char	p_wrttn;	/* written flag (!0 = written) */
570 	char	p_keep;		/* keep switch for readmod() */
571 	char	p_encoding;	/* encoding flags for data */
572 	char	p_xcreate;	/* output file created, first line written */
573 	UInt16_t *p_hash;	/* ptr to array of checksums */
574 	struct	apply *p_apply;	/* ptr to apply array */
575 	struct	queue *p_q;	/* ptr to control queue */
576 	FILE	*p_iop;		/* input file */
577 	FILE	*p_xiop;	/* output file */
578 #ifndef	HAVE_SETVBUF
579 	char	p_buf[BUFSIZ];	/* input file buffer */
580 #endif
581 	char	*p_linebase;	/* base addr of malloc()ed line */
582 	char	*p_lineptr;	/* begin of line past escape process */
583 	char	*p_line;	/* buffer for getline() */
584 	size_t	p_line_length;	/* actual line length for getline() */
585 	size_t	p_line_size;	/* size of the buffer for getline() */
586 	time_t	p_cdt;		/* date/time of newest applied delta */
587 	char	*p_lfile;	/* 0 = no l-file; else ptr to l arg */
588 	struct	idel *p_idel;	/* ptr to internal delta table */
589 	char	**p_pgmrs;	/* ptr to table of delta users */
590 	FILE	*p_stdout;	/* standard output for warnings and messages */
591 	FILE	*p_gout;	/* g-file output file */
592 	char	p_user;		/* !0 = user on user list */
593 	char	p_chkeof;	/* 0 = eof generates error */
594 	int	p_maxr;		/* largest release number */
595 	int	p_ixmsg;	/* inex msg counter */
596 	int	p_reopen;	/* reopen flag used by getline on eof */
597 	int	p_ixuser;	/* HADI | HADX (in get) */
598 	int	do_chksum;	/* for getline(), 1 = do check sum */
599 	int	no_chksum;	/* for getline(), 1 = don't compute check sum */
600 	/*
601 	 * Global meta data
602 	 */
603 	char	*p_init_path;	/* Initial path relative to project set home */
604 	urand_t	p_rand;		/* Unified random number for file */
605 	/*
606 	 * SID specific meta data
607 	 */
608 	char	*p_mail;	/* E-mail of committer */
609 	/*
610 	 * Various other s-file specific data
611 	 */
612 	void	(*p_enter) __PR((struct packet *pkt,
613 					int ch, int n,
614 					struct sid *sidp));
615 	void	(*p_escdodelt) __PR((struct packet *pkt));
616 	void	(*p_fredck) __PR((struct packet *pkt));
617 	char	p_cdid_mrs;	/* for cdc to check MRs */
618 	char	p_did_id;	/* whether a keyword was found */
619 	char	p_first_cmt;	/* first comment encountered */
620 	char	p_first_esc;	/* cdc, first time */
621 	char    p_pgmr[LOGSIZE]; /* for rmdel & chghist (rmchg) */
622 };
623 
624 /*
625  * General flags (p_flags)
626  *
627  * The PF_GMT flag is used to avoid calling mktime(3) in get(1) and delta(1)
628  * as this is an expensive operation on some systems like SunOS-4.x and Linux.
629  * If we set the flag, we need to carefully compensate the systematic error
630  * introduced by this hack.
631  */
632 #define	PF_GMT		1	/* Use GMT conversion			  */
633 #define	PF_V6		2	/* Support SCCS V6 features		  */
634 #define	PF_V6TAGS	4	/* SCCS V6 features found in hist file	  */
635 #define	PF_NONL		8	/* This line has no newline		  */
636 #define	PF_SCOX		0x10	/* SCO eXecutable flag found s.file	  */
637 
638 /*
639  * Encoding flags (p_encoding)
640  *
641  * The uuencoding takes place before the interleaved delta is created,
642  * the gzip compression takes place on the interleaved delta block.
643  */
644 #define	EF_TEXT		0	/* Pure text in interleaved delta	  */
645 #define	EF_UUENCODE	1	/* UUencoded binary in interleaved delta  */
646 #define	EF_GZIP		4	/* Gzipped interleaved delta		  */
647 
648 /*
649  * Flags to collect reasons for non-Text files also used in p_props
650  */
651 #define	CK_NONL		1	/* No newline at end of file	*/
652 #define	CK_CTLCHAR	2	/* CTLCHAR ar beginning of line	*/
653 #define	CK_NULL		4	/* NUL character found in file	*/
654 
655 struct	stats {
656 	int	s_ins;
657 	int	s_del;
658 	int	s_unc;
659 };
660 
661 struct	pfile	{
662 	struct	sid	pf_gsid;
663 	struct	sid	pf_nsid;
664 	char	pf_user[LOGSIZE];
665 	time_t	pf_date;
666 	char	*pf_ilist;
667 	char	*pf_elist;
668 	char 	*pf_cmrlist;
669 };
670 
671 /*
672  * Declares for external functions in lib/cassi
673  */
674 extern	char	*gf	__PR((char *));
675 extern	int	sweep	__PR((int, char *, char *, int, int, int, char **,
676 				char *, char **,
677 				int (*)(char *, int, char **),
678 				int (*)(char **, char **,
679 				int)));
680 extern	int	cmrcheck __PR((char *, char *));
681 extern	int	deltack __PR((char [], char *, char *, char *, char *[]));
682 extern	void	cmrerror __PR((const char *));
683 
684 /*
685  * Declares for external variables in lib/comobj
686  */
687 extern	char	*sccs_insbase;	/* Installation base dir or "/usr"	  */
688 extern	char	*Comments;	/* Comments from -y option		  */
689 extern	char	*Mrs;		/* List of Mr numbers from -m option	  */
690 extern	int	Domrs;		/* 'v' flag was found in the histroy file */
691 
692 				/*
693 				 * If it is not possible to retrieve "setahome",
694 				 * it may be a NULL pointer. The variables
695 				 * "setrhome" and "cwdprefix" are always set
696 				 * from sethome().
697 				 */
698 extern	char	*setphome;	/* Best path to the project set home dir */
699 extern	char	*setrhome;	/* Relative path to the project set home dir */
700 extern	char	*setahome;	/* Absolute path to the project set home dir */
701 extern	char	*cwdprefix;	/* Prefix from project set home dir to cwd */
702 extern	char	*changesetfile;	/* The path to the changeset history file */
703 extern	char	*changesetgfile; /* The path to the changeset file */
704 extern	int	homedist;	/* The # of dirs to the project set home dir */
705 extern	int	setphomelen;	/* strlen(setphome) */
706 extern	int	setrhomelen;	/* strlen(setrhome) */
707 extern	int	setahomelen;	/* strlen(setahome) */
708 extern	int	cwdprefixlen;	/* strlen(cwdprefix) */
709 extern	int	sethomestat;	/* sethome() status flags */
710 
711 /*
712  * sethome() status flags:
713  */
714 #define	SETHOME_NONE	0	/* $SET_HOME/.sccs could not be found	*/
715 #define	SETHOME_OK	1	/* $SET_HOME/.sccs was found		*/
716 #define	SETHOME_ABS	2	/* Using setahome is preferred		*/
717 #define	SETHOME_INTREE	4	/* $SET_HOME/.sccs/data missing, SCCS in tree */
718 #define	SETHOME_OFFTREE	8	/* $SET_HOME/.sccs/data found, SCCS off tree */
719 #define	SETHOME_DELS_OK 16	/* $SET_HOME/.sccs/dels was found	*/
720 #define	SETHOME_CHSET_OK 32	/* $SET_HOME/.sccs/SCCS/s.changeset found */
721 #define	SETHOME_NEWMODE	64	/* NewMode has been selected in sccs(1)	*/
722 
723 #define	SETHOME_ALL_OK	(SETHOME_OK|SETHOME_DELS_OK)
724 #define	SETHOME_ALLP_OK	(SETHOME_OK|SETHOME_DELS_OK|SETHOME_CHSET_OK)
725 
726 #define	SETHOME_INIT()	((sethomestat & SETHOME_ALL_OK) == SETHOME_ALL_OK)
727 #define	SETHOME_CHSET()	((sethomestat & SETHOME_ALLP_OK) == SETHOME_ALLP_OK)
728 
729 /*
730  * Declares for external functions in lib/comobj
731  */
732 
733 extern	char	*auxf	__PR((char *, int));
734 extern	void	sinit	__PR((struct packet *, char *, int));
735 extern	void	sclose	__PR((struct packet *));
736 extern	void	sfree	__PR((struct packet *));
737 extern	char	*checkmagic __PR((struct packet *, char *));
738 extern	void	setup	__PR((struct packet *, int));
739 extern	void	finduser __PR((struct packet *));
740 extern	void	permiss	__PR((struct packet *));
741 extern	char	*sid_ab	__PR((char *, struct sid *));
742 extern	char	*sid_ba	__PR((struct sid *, char *));
743 extern	void	sidext_ab __PR((struct packet *, struct deltab *, char *));
744 extern	void	sidext_v4compat_ab __PR((struct packet *, struct deltab *));
745 extern	void	sidext_ba __PR((struct packet *, struct deltab *));
746 extern	char	*omit_sid __PR((char *));
747 extern	int	date_ab	__PR((char *, time_t *, int flags));
748 extern	int	date_abz __PR((char *, dtime_t *, int flags));
749 extern	char	*date_ba __PR((time_t *, char *, int flags));
750 extern	char	*date_bal __PR((time_t *, char *, int flags));
751 extern	char	*date_bazl __PR((dtime_t *, char *, int flags));
752 extern	char	del_ab	__PR((char *, struct deltab *, struct packet *));
753 extern	char	*del_ba	__PR((struct deltab *, char *, int flags));
754 extern	void	stats_ab __PR((struct packet *, struct stats *));
755 extern	void	pf_ab	__PR((char *, struct pfile *, int));
756 extern	int	getser	__PR((struct packet *));
757 extern	int	sidtoser __PR((struct sid *, struct packet *));
758 extern	int	eqsid	__PR((struct sid *, struct sid *));
759 extern	void	chksid	__PR((char *, struct sid *));
760 extern	void	newsid	__PR((struct packet *, int));
761 extern	void	newstats __PR((struct packet *, char *, char *));
762 extern	void	condset	__PR((struct apply *, int, int));
763 extern	void	dolist	__PR((struct packet *, char *, int));
764 extern	void	dohist	__PR((char *));
765 extern	void	doie	__PR((struct packet *, char *, char *, char *));
766 extern	void	doflags	__PR((struct packet *));
767 extern	void	donamedflags	__PR((struct packet *));
768 extern	void	dometa	__PR((struct packet *));
769 extern	struct idel *dodelt __PR((struct packet *,
770 				struct stats *, struct sid *, int));
771 extern	void	do_file __PR((char *, void (*func)(char *), int,
772 				int, Xparms *));
773 extern	void	doget	__PR((char *afile, char *gname, int ser));
774 extern	void	dogtime	__PR((struct packet *pkt, char *gfile,
775 				struct timespec *mtime));
776 extern	void	fmterr	__PR((struct packet *));
777 /*
778  * Deal with unfriendly and non POSIX compliant glibc that defines getline()
779  */
780 #undef	getline
781 #define	getline	comgetline
782 extern	char	*getline __PR((struct packet *));
783 extern	void	grewind	__PR((struct packet *));
784 extern	void	putline	__PR((struct packet *, char *));
785 extern	void	putlline	__PR((struct packet *, char *, ssize_t));
786 extern	void	putchr	__PR((struct packet *, int c));
787 extern	void	putctl	__PR((struct packet *));
788 extern	void	putctlnnl __PR((struct packet *));
789 extern	void	putmagic __PR((struct packet *, char *));
790 extern	void	putmeta	__PR((struct packet *, unsigned flags));
791 extern	char	*logname	__PR((void));
792 extern	char	*sccs_user	__PR((char *));
793 extern	int	mystrptime __PR((char *, struct tm *, int));
794 extern	char	*savecmt	__PR((char *));
795 extern	void	mrfixup	__PR((void));
796 extern	void	xrm	__PR((struct packet *));
797 extern	void	flushto	__PR((struct packet *, int, int));
798 extern	void	flushline __PR((struct packet *, struct stats *));
799 extern	int 	chkid	__PR((char *, char *, char *[]));
800 extern	int	valmrs	__PR((struct packet *, char *));
801 extern	void	encode	__PR((FILE *, FILE *));
802 extern	void	decode	__PR((char *, FILE *));
803 extern	int	readmod	__PR((struct packet *));
804 extern	int	parse_date __PR((char *, time_t *, int flags));
805 extern	int	parse_datez __PR((char *, dtime_t *, int flags));
806 extern	int	cmpdate	__PR((struct tm *, struct tm *));
807 extern	void	addq	__PR((struct packet *, int, int, int, int));
808 extern	void	remq	__PR((struct packet *, int));
809 extern	void	setkeep	__PR((struct packet *));
810 extern	void	get_Del_Date_time __PR((char *, struct deltab *,
811 					struct packet *, struct tm *));
812 extern	char	*stalloc	__PR((unsigned int));
813 extern	int	mosize	__PR((int y, int t));
814 extern	int	gN	__PR((char *str, char **next, int num,
815 					int *digits, int *chars));
816 extern	int	gNp	__PR((char *str, char **next, int num,
817 					int *digits, int *chars));
818 extern	int	gns	__PR((char *str, char **next));
819 extern	int	gtz	__PR((char *str, char **next));
820 extern	void	xtzset	__PR((void));
821 extern	void	dtime	__PR((dtime_t *));
822 extern	void	time2dt	__PR((dtime_t *, time_t, int));
823 extern	time_t	gmtoff	__PR((time_t));
824 extern	int		ssum __PR((char *, int));
825 extern	unsigned int	usum __PR((char *, int));
826 extern  void	set_init_path __PR((struct packet *, char *file, char *dir));
827 extern	void	sccs_setinsbase __PR((char *));
828 extern	int	sccsfatalhelp __PR((char *));
829 extern	int	sccshelp __PR((FILE *, char *));
830 extern	size_t	lhash_size	__PR((size_t size));
831 extern	void	lhash_destroy	__PR((void));
832 extern	char	*lhash_add	__PR((char *str));
833 extern	char	*lhash_lookup	__PR((char *str));
834 extern	void	sccs_xpg4 __PR((int val));
835 extern	void	whatsetup __PR((char *w));
836 extern	void	idsetup __PR((struct packet *pkt, char *gname));
837 extern	char *	idsubst __PR((struct packet *pkt, char *line));
838 extern	char *	getmodname __PR((void));
839 extern	char *	urand_ab __PR((char *aurand, urand_t *urandp));
840 extern	char *	urand_ba __PR((urand_t *urandp,
841 					char *aurand, size_t aurandsize));
842 extern	int	urand_valid __PR((urand_t *urandp));
843 extern	void	change_ba __PR((struct packet *pkt,
844 					char *cbuf, size_t cbuflen));
845 extern	char *	change_ab __PR((char *cbuf, struct packet *pkt));
846 extern	void	initN	__PR((Nparms *N));
847 extern	void	freeN	__PR((Nparms *N));
848 extern	void	parseN	__PR((Nparms *N));
849 extern	char *	bulkprepare __PR((Nparms *N, char *afile));
850 extern	int	bulkchdir __PR((Nparms *N));
851 extern	int	bulkclosedir __PR((Nparms *N));
852 extern	char *	bulkerror __PR((Nparms *N));
853 extern	int	parseX	__PR((Xparms *X));
854 extern	int	lockchset	__PR((pid_t ppid, pid_t pid, char *uuname));
855 extern	int	unlockchset	__PR((pid_t pid, char *uuname));
856 extern	int	islockchset	__PR((char *fname));
857 extern	int	refreshchsetlock __PR((void));
858 extern	void	timersetlockfile __PR((char *name));
859 extern	void	timerchsetlock	__PR((void));
860 
861 extern	int	opendirfd	__PR((const char *name));
862 extern	int	closedirfd	__PR((int fd));
863 extern	int	opencwd		__PR((void));
864 extern	int	openphome	__PR((void));
865 extern	BOOL	has_dotdot	__PR((const char *name));
866 extern	BOOL	in_tree		__PR((const char *name));
867 extern	void	make_relative	__PR((char *name));
868 extern	off_t	stell	__PR((struct packet *));
869 extern	int	sseek	__PR((struct packet *, off_t, int));
870 extern	int	srewind	__PR((struct packet *));
871 
872 /*
873  * Declares for external variables in lib/mpwlib
874  */
875 extern	char	SccsError[MAXERRORLEN];
876 
877 /*
878  * Declares for external functions in lib/mpwlib
879  */
880 
881 extern	int	any	__PR((int, char *));
882 #ifdef	HAVE_STRCHR
883 #define	any(c, s)	strchr(s, c)
884 #endif
885 extern	char	*fixpath __PR((char *));
886 extern	char	*sname	__PR((char *));
887 extern	char	*cat	__PR((char *dest, ...));
888 extern	char	*dname	__PR((char *));
889 extern	char	*satoi	__PR((char *, int *));
890 extern	int	patoi	__PR((char *));
891 extern	char	*repl	__PR((char *, char, char));
892 extern	char	*strend	__PR((char *));
893 extern	char	*trnslat __PR((char *, char *, char *, char *));
894 extern	char	*zero	__PR((char *, int));
895 extern	void	*fmalloc __PR((unsigned));
896 extern	void	ffree	__PR((void *));
897 extern	void	ffreeall __PR((void));
898 extern	void	*xmalloc __PR((size_t));
899 extern	int	efatal	__PR((char *));
900 extern	int	fatal	__PR((char *));
901 extern	int	lockit	__PR((char *, int, pid_t, char *));
902 extern	int	lockrefresh __PR((char *));
903 extern	int	unlockit __PR((char *, pid_t, char *));
904 extern	int	ismylock __PR((char *, pid_t, char *));
905 extern	int	mylock	__PR((char *, pid_t, char *));
906 extern	void	lockfatal __PR((char *, pid_t, char *));
907 extern	int	sccs_index __PR((char *, char *));
908 extern	int	imatch	__PR((char *, char *));
909 extern	int	xmsg	__PR((const char *, const char *));
910 extern	FILE	*fdfopen	__PR((int, int));
911 extern	int	xcreat	__PR((char *, mode_t));
912 extern	int	xmkdir	__PR((char *, mode_t));
913 extern	int	xmkdirs	__PR((char *, mode_t));
914 extern	int	xopen	__PR((char [], int));
915 extern	int	xlink	__PR((const char *, const char *));
916 extern	int	xunlink	__PR((const char *));
917 extern	int	xpipe	__PR((int *));
918 extern	void	setsig	__PR((void));
919 extern	int	check_permission_SccsDir __PR((char *));
920 extern  char	*get_Sccs_Comments __PR((void));
921 extern	int	userexit __PR((int code));
922 extern	void	*zrealloc __PR((void *ptr, size_t amt));
923 extern	int	urandom	__PR((urand_t *urp));
924 extern	void	tv2urand __PR((struct timeval *tvp, urand_t *urp));
925 extern	void	urand2tv __PR((urand_t *urp, struct timeval *tvp));
926 extern	int	checkhome __PR((char *path));
927 extern	int	sethome	__PR((char *path));
928 extern	void	unsethome __PR((void));
929 extern	int	xsethome __PR((char *path));
930 extern	void	setnewmode __PR((void));
931 extern	void	unsetnewmode __PR((void));
932 extern	pid_t	xpopen(FILE **pfpin, FILE **pfpout, FILE **pfperr,
933 				const char *cmd, char *const argv[]);
934 extern	int	xpclose(FILE *fpin, FILE *fpout, FILE *fperr, pid_t child);
935 
936 #ifdef	DBG_MALLOC
937 extern	void	*dbg_fmalloc __PR((unsigned, char *, int));
938 
939 #define	fmalloc(s)	dbg_fmalloc(s, __FILE__, __LINE__)
940 #endif
941 
942 
943 #ifndef	HAVE_REALLOC_NULL
944 #define	realloc	zrealloc
945 #endif
946 
947 /*
948  * Setup a callback for fatal() from libmpw
949  */
950 extern	void	set_clean_up	__PR((void (*f)(void)));
951 
952 
953 /*
954  * Declares for external functions in lib/sccs
955  */
956 extern	int	addcmd		__PR((int nfiles, int argc, char **argv));
957 extern	int	commitcmd	__PR((int nfiles, int argc, char **argv));
958 extern	int	initcmd		__PR((int nfiles, int argc, char **argv));
959 extern	int	sccs_debug	__PR((void));
960 extern	char	**sccs_getanames	__PR((void));
961 extern	int	sccs_getanum	__PR((void));
962 extern	int	sccs_setdebug	__PR((int val));
963 extern	void	sccs_sethdebug	__PR((void));
964 extern	int	removecmd	__PR((int nfiles, int argc, char **argv));
965 extern	int	renamecmd	__PR((int nfiles, int argc, char **argv));
966 extern	int	rootcmd		__PR((int nfiles, int argc, char **argv));
967 extern	int	statuscmd	__PR((int nfiles, int argc, char **argv));
968 extern	int	usrerr		__PR((const char *f, ...));
969 
970 
971 # define RESPSIZE	1024
972 # define NVARGS		64
973 # define VSTART		3
974 
975 /*
976  *	The following five definitions (copy, xfopen, xfcreat, remove,
977  *	USXALLOC) are taken from macros.h 1.1
978  */
979 
980 # define copy(srce, dest)	cat(dest, srce, (char *)0)
981 # define xfopen(file, mode)	fdfopen(xopen(file, mode), mode)
982 # define xfcreat(file, mode)	fdfopen(xcreat(file, mode), O_WRONLY|O_BINARY)
983 # define remove(file)		xunlink(file)
984 # define USXALLOC() \
985 		char *alloc(n) {return ((char *)xalloc((unsigned)n)); } \
986 		free(n) char *n; {xfree(n); } \
987 		char *malloc(n) unsigned n; {int p; p = xalloc(n); \
988 			return ((char *)(p != -1?p:0)); }
989 
990 
991 #if defined(linux) && !defined(NO_LINUX_SETVBUF_HACK) && \
992     defined(HAVE_FILE__FLAGS) && defined(HAVE_FILE__IO_BUF_BASE) && \
993     defined(_IO_USER_BUF)
994 /*
995  * Work around a performance problem in the baroque stdio implementaion on
996  * Linux.
997  */
998 #define	setvbuf(f, buf, type, sz)	setvbuf(f, malloc(sz), type, sz)
999 
1000 static inline int xfclose __PR((FILE *f));
xfclose(f)1001 static inline int xfclose(f)
1002 	FILE	*f;
1003 {	int	ret;
1004 	int	flags = f->_flags;
1005 	char	*buf = f->_IO_buf_base;
1006 
1007 	ret = fclose(f);
1008 	if (ret == 0 && (flags & _IO_USER_BUF)) {
1009 		free(buf);
1010 	}
1011 	return (ret);
1012 }
1013 #define	fclose(f)	xfclose(f)
1014 #endif
1015 
1016 #if !defined(HAVE_MEMSET) && !defined(memset)
1017 #define	memset(s, c, n)		fillbytes(s, n, c)
1018 #endif
1019 #if !defined(HAVE_MEMCHR) && !defined(memchr)
1020 #define	memchr(s, c, n)		findbytes(s, n, c)
1021 #endif
1022 #if !defined(HAVE_MEMCPY) && !defined(memcpy)
1023 #define	memcpy(s1, s2, n)	movebytes(s2, s1, n)
1024 #endif
1025 #if !defined(HAVE_MEMMOVE) && !defined(memmove)
1026 #define	memmove(s1, s2, n)	movebytes(s2, s1, n)
1027 #endif
1028 
1029 #endif	/* _HDR_DEFINES_H */
1030