rcsbase.h revision 1494
1
2/*
3 *                     RCS common definitions and data structures
4 */
5#define RCSBASE "$Id: rcsbase.h,v 1.1.1.1 1993/06/18 04:22:13 jkh Exp $"
6
7/* Copyright (C) 1982, 1988, 1989 Walter Tichy
8   Copyright 1990, 1991 by Paul Eggert
9   Distributed under license by the Free Software Foundation, Inc.
10
11This file is part of RCS.
12
13RCS is free software; you can redistribute it and/or modify
14it under the terms of the GNU General Public License as published by
15the Free Software Foundation; either version 2, or (at your option)
16any later version.
17
18RCS is distributed in the hope that it will be useful,
19but WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21GNU General Public License for more details.
22
23You should have received a copy of the GNU General Public License
24along with RCS; see the file COPYING.  If not, write to
25the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26
27Report problems and direct all questions to:
28
29    rcs-bugs@cs.purdue.edu
30
31*/
32
33
34
35/*****************************************************************************
36 * INSTRUCTIONS:
37 * =============
38 * See the Makefile for how to define C preprocessor symbols.
39 * If you need to change the comment leaders, update the table comtable[]
40 * in rcsfnms.c. (This can wait until you know what a comment leader is.)
41 *****************************************************************************
42 */
43
44
45/* $Log: rcsbase.h,v $
46 * Revision 1.1.1.1  1993/06/18  04:22:13  jkh
47 * Updated GNU utilities
48 *
49 * Revision 5.11  1991/10/07  17:32:46  eggert
50 * Support piece tables even if !has_mmap.
51 *
52 * Revision 5.10  1991/09/24  00:28:39  eggert
53 * Remove unexported functions.
54 *
55 * Revision 5.9  1991/08/19  03:13:55  eggert
56 * Add piece tables and other tuneups, and NFS workarounds.
57 *
58 * Revision 5.8  1991/04/21  11:58:20  eggert
59 * Add -x, RCSINIT, MS-DOS support.
60 *
61 * Revision 5.7  1991/02/28  19:18:50  eggert
62 * Try setuid() if seteuid() doesn't work.
63 *
64 * Revision 5.6  1991/02/26  17:48:37  eggert
65 * Support new link behavior.  Move ANSI C / Posix declarations into conf.sh.
66 *
67 * Revision 5.5  1990/12/04  05:18:43  eggert
68 * Use -I for prompts and -q for diagnostics.
69 *
70 * Revision 5.4  1990/11/01  05:03:35  eggert
71 * Don't assume that builtins are functions; they may be macros.
72 * Permit arbitrary data in logs.
73 *
74 * Revision 5.3  1990/09/26  23:36:58  eggert
75 * Port wait() to non-Posix ANSI C hosts.
76 *
77 * Revision 5.2  1990/09/04  08:02:20  eggert
78 * Don't redefine NAME_MAX, PATH_MAX.
79 * Improve incomplete line handling.  Standardize yes-or-no procedure.
80 *
81 * Revision 5.1  1990/08/29  07:13:53  eggert
82 * Add -kkvl.  Fix type typos exposed by porting.  Clean old log messages too.
83 *
84 * Revision 5.0  1990/08/22  08:12:44  eggert
85 * Adjust ANSI C / Posix support.  Add -k, -V, setuid.  Don't call access().
86 * Remove compile-time limits; use malloc instead.
87 * Ansify and Posixate.  Add support for ISO 8859.
88 * Remove snoop and v2 support.
89 *
90 * Revision 4.9  89/05/01  15:17:14  narten
91 * botched previous USG fix
92 *
93 * Revision 4.8  89/05/01  14:53:05  narten
94 * changed #include <strings.h> -> string.h for USG systems.
95 *
96 * Revision 4.7  88/11/08  15:58:45  narten
97 * removed defs for functions loaded from libraries
98 *
99 * Revision 4.6  88/08/09  19:12:36  eggert
100 * Shrink stdio code size; remove lint; permit -Dhshsize=nn.
101 *
102 * Revision 4.5  87/12/18  17:06:41  narten
103 * made removed BSD ifdef, now uses V4_2BSD
104 *
105 * Revision 4.4  87/10/18  10:29:49  narten
106 * Updating version numbers
107 * Changes relative to 1.1 are actually relative to 4.2
108 *
109 * Revision 1.3  87/09/24  14:02:25  narten
110 * changes for lint
111 *
112 * Revision 1.2  87/03/27  14:22:02  jenkins
113 * Port to suns
114 *
115 * Revision 4.2  83/12/20  16:04:20  wft
116 * merged 3.6.1.1 and 4.1 (SMALLOG, logsize).
117 * moved setting of STRICT_LOCKING to Makefile.
118 * changed DOLLAR to UNKN (conflict with KDELIM).
119 *
120 * Revision 4.1  83/05/04  09:12:41  wft
121 * Added markers Id and RCSfile.
122 * Added Dbranch for default branches.
123 *
124 * Revision 3.6.1.1  83/12/02  21:56:22  wft
125 * Increased logsize, added macro SMALLOG.
126 *
127 * Revision 3.6  83/01/15  16:43:28  wft
128 * 4.2 prerelease
129 *
130 * Revision 3.6  83/01/15  16:43:28  wft
131 * Replaced dbm.h with BYTESIZ, fixed definition of rindex().
132 * Added variants of NCPFN and NCPPN for bsd 4.2, selected by defining V4_2BSD.
133 * Added macro DELNUMFORM to have uniform format for printing delta text nodes.
134 * Added macro DELETE to mark deleted deltas.
135 *
136 * Revision 3.5  82/12/10  12:16:56  wft
137 * Added two forms of DATEFORM, one using %02d, the other %.2d.
138 *
139 * Revision 3.4  82/12/04  20:01:25  wft
140 * added LOCKER, Locker, and USG (redefinition of rindex).
141 *
142 * Revision 3.3  82/12/03  12:22:04  wft
143 * Added dbm.h, stdio.h, RCSBASE, RCSSEP, RCSSUF, WORKMODE, TMPFILE3,
144 * PRINTDATE, PRINTTIME, map, and ctab; removed Suffix. Redefined keyvallength
145 * using NCPPN. Changed putc() to abort on write error.
146 *
147 * Revision 3.2  82/10/18  15:03:52  wft
148 * added macro STRICT_LOCKING, removed RCSUMASK.
149 * renamed JOINFILE[1,2] to JOINFIL[1,2].
150 *
151 * Revision 3.1  82/10/11  19:41:17  wft
152 * removed NBPW, NBPC, NCPW.
153 * added typdef int void to aid compiling
154 */
155
156
157#include "conf.h"
158
159
160#define EXIT_TROUBLE DIFF_TROUBLE
161
162#ifdef PATH_MAX
163#	define SIZEABLE_PATH PATH_MAX /* size of a large path; not a hard limit */
164#else
165#	define SIZEABLE_PATH _POSIX_PATH_MAX
166#endif
167
168/* for traditional C hosts with unusual size arguments */
169#define Fread(p,s,n,f)  fread(p, (freadarg_type)(s), (freadarg_type)(n), f)
170#define Fwrite(p,s,n,f)  fwrite(p, (freadarg_type)(s), (freadarg_type)(n), f)
171
172
173/*
174 * Parameters
175 */
176
177/* backwards compatibility with old versions of RCS */
178#define VERSION_min 3		/* old output RCS format supported */
179#define VERSION_max 5		/* newest output RCS format supported */
180#ifndef VERSION_DEFAULT		/* default RCS output format */
181#	define VERSION_DEFAULT VERSION_max
182#endif
183#define VERSION(n) ((n) - VERSION_DEFAULT) /* internally, 0 is the default */
184
185#ifndef STRICT_LOCKING
186#define STRICT_LOCKING 1
187#endif
188			      /* 0 sets the default locking to non-strict;  */
189                              /* used in experimental environments.         */
190                              /* 1 sets the default locking to strict;      */
191                              /* used in production environments.           */
192
193#define yearlength	   16 /* (good through AD 9,999,999,999,999,999)    */
194#define datesize (yearlength+16) /* size of output of DATEFORM		    */
195#define joinlength         20 /* number of joined revisions permitted       */
196#define RCSTMPPREFIX '_' /* prefix for temp files in working dir  */
197#define KDELIM            '$' /* delimiter for keywords                     */
198#define VDELIM            ':' /* separates keywords from values             */
199#define DEFAULTSTATE    "Exp" /* default state of revisions                 */
200
201
202
203#define true     1
204#define false    0
205#define nil      0
206
207
208/*
209 * RILE - readonly file
210 * declarecache; - declares local cache for RILE variable(s)
211 * setupcache - sets up the local RILE cache, but does not initialize it
212 * cache, uncache - caches and uncaches the local RILE;
213 *	(uncache,cache) is needed around functions that advance the RILE pointer
214 * Igeteof(f,c,s) - get a char c from f, executing statement s at EOF
215 * cachegeteof(c,s) - Igeteof applied to the local RILE
216 * Iget(f,c) - like Igeteof, except EOF is an error
217 * cacheget(c) - Iget applied to the local RILE
218 * Ifileno, Irewind, Iseek, Itell - analogs to stdio routines
219 */
220
221#if large_memory
222	typedef unsigned char const *Iptr_type;
223	typedef struct {
224		Iptr_type ptr, lim;
225		unsigned char *base; /* for lint, not Iptr_type even if has_mmap */
226#		if has_mmap
227#			define Ifileno(f) ((f)->fd)
228			int fd;
229#		else
230#			define Ifileno(f) fileno((f)->stream)
231			FILE *stream;
232			unsigned char *readlim;
233#		endif
234	} RILE;
235#	if has_mmap
236#		define declarecache register Iptr_type ptr, lim
237#		define setupcache(f) (lim = (f)->lim)
238#		define Igeteof(f,c,s) if ((f)->ptr==(f)->lim) s else (c)= *(f)->ptr++
239#		define cachegeteof(c,s) if (ptr==lim) s else (c)= *ptr++
240#	else
241#		define declarecache register Iptr_type ptr; register RILE *rRILE
242#		define setupcache(f) (rRILE = (f))
243#		define Igeteof(f,c,s) if ((f)->ptr==(f)->readlim && !Igetmore(f)) s else (c)= *(f)->ptr++
244#		define cachegeteof(c,s) if (ptr==rRILE->readlim && !Igetmore(rRILE)) s else (c)= *ptr++
245#	endif
246#	define uncache(f) ((f)->ptr = ptr)
247#	define cache(f) (ptr = (f)->ptr)
248#	define Iget(f,c) Igeteof(f,c,Ieof();)
249#	define cacheget(c) cachegeteof(c,Ieof();)
250#	define Itell(f) ((f)->ptr)
251#	define Iseek(f,p) ((f)->ptr = (p))
252#	define Irewind(f) Iseek(f, (f)->base)
253#	define cachetell() ptr
254#else
255#	define RILE FILE
256#	define declarecache register FILE *ptr
257#	define setupcache(f) (ptr = (f))
258#	define uncache(f)
259#	define cache(f)
260#	define Igeteof(f,c,s) if(((c)=getc(f))<0){testIerror(f);if(feof(f))s}else
261#	define cachegeteof(c,s) Igeteof(ptr,c,s)
262#	define Iget(f,c) if (((c)=getc(f))<0) testIeof(f); else
263#	define cacheget(c) Iget(ptr,c)
264#	define Ifileno(f) fileno(f)
265#endif
266
267/* Print a char, but abort on write error.  */
268#define aputc(c,o) if (putc(c,o)<0) testOerror(o); else
269
270/* Get a character from an RCS file, perhaps copying to a new RCS file.  */
271#define GETCeof(o,c,s) { cachegeteof(c,s); if (o) aputc(c,o); }
272#define GETC(o,c) { cacheget(c); if (o) aputc(c,o); }
273
274
275#define WORKMODE(RCSmode, writable) ((RCSmode)&~(S_IWUSR|S_IWGRP|S_IWOTH) | ((writable)?S_IWUSR:0))
276/* computes mode of working file: same as RCSmode, but write permission     */
277/* determined by writable */
278
279
280/* character classes and token codes */
281enum tokens {
282/* classes */	DELIM,	DIGIT,	IDCHAR,	NEWLN,	LETTER,	Letter,
283		PERIOD,	SBEGIN,	SPACE,	UNKN,
284/* tokens */	COLON,	ID,	NUM,	SEMI,	STRING
285};
286
287#define SDELIM  '@'     /* the actual character is needed for string handling*/
288/* SDELIM must be consistent with ctab[], so that ctab[SDELIM]==SBEGIN.
289 * there should be no overlap among SDELIM, KDELIM, and VDELIM
290 */
291
292#define isdigit(c) ((unsigned)((c)-'0') <= 9) /* faster than ctab[c]==DIGIT */
293
294
295
296
297
298/***************************************
299 * Data structures for the symbol table
300 ***************************************/
301
302/* Buffer of arbitrary data */
303struct buf {
304	char *string;
305	size_t size;
306};
307struct cbuf {
308	char const *string;
309	size_t size;
310};
311
312/* Hash table entry */
313struct hshentry {
314	char const	  * num;      /* pointer to revision number (ASCIZ) */
315	char const	  * date;     /* pointer to date of checkin	    */
316	char const	  * author;   /* login of person checking in	    */
317	char const	  * lockedby; /* who locks the revision		    */
318	char const	  * state;    /* state of revision (Exp by default) */
319	struct cbuf	    log;      /* log message requested at checkin   */
320        struct branchhead * branches; /* list of first revisions on branches*/
321	struct cbuf	    ig;	      /* ignored phrases of revision	    */
322        struct hshentry   * next;     /* next revision on same branch       */
323	struct hshentry   * nexthsh;  /* next revision with same hash value */
324	unsigned long	    insertlns;/* lines inserted (computed by rlog)  */
325	unsigned long	    deletelns;/* lines deleted  (computed by rlog)  */
326	char		    selector; /* true if selected, false if deleted */
327};
328
329/* list of hash entries */
330struct hshentries {
331	struct hshentries *rest;
332	struct hshentry *first;
333};
334
335/* list element for branch lists */
336struct branchhead {
337        struct hshentry   * hsh;
338        struct branchhead * nextbranch;
339};
340
341/* accesslist element */
342struct access {
343	char const	  * login;
344        struct access     * nextaccess;
345};
346
347/* list element for locks  */
348struct lock {
349	char const	  * login;
350        struct hshentry   * delta;
351        struct lock       * nextlock;
352};
353
354/* list element for symbolic names */
355struct assoc {
356	char const	  * symbol;
357	char const	  * num;
358        struct assoc      * nextassoc;
359};
360
361
362#define mainArgs (argc,argv) int argc; char **argv;
363
364#if lint
365#	define libId(name,rcsid)
366#	define mainProg(name,cmd,rcsid) int name mainArgs
367#else
368#	define libId(name,rcsid) char const name[] = rcsid;
369#	define mainProg(name,cmd,rcsid) char const copyright[] = "Copyright 1982,1988,1989 by Walter F. Tichy\nPurdue CS\nCopyright 1990,1991 by Paul Eggert", rcsbaseId[] = RCSBASE, cmdid[] = cmd; libId(name,rcsid) int main mainArgs
370#endif
371
372/*
373 * Markers for keyword expansion (used in co and ident)
374 *	Every byte must have class LETTER or Letter.
375 */
376#define AUTHOR          "Author"
377#define DATE            "Date"
378#define HEADER          "Header"
379#define IDH             "Id"
380#define LOCKER          "Locker"
381#define LOG             "Log"
382#define RCSFILE         "RCSfile"
383#define REVISION        "Revision"
384#define SOURCE          "Source"
385#define STATE           "State"
386#define FREEBSD		"FreeBSD"
387#define keylength 8 /* max length of any of the above keywords */
388
389enum markers { Nomatch, Author, Date, Header, Id,
390	       Locker, Log, RCSfile, Revision, Source, State, FreeBSD };
391	/* This must be in the same order as rcskeys.c's Keyword[] array. */
392
393#define DELNUMFORM      "\n\n%s\n%s\n"
394/* used by putdtext and scanlogtext */
395
396#define EMPTYLOG "*** empty log message ***" /* used by ci and rlog */
397
398/* main program */
399extern char const cmdid[];
400exiting void exiterr P((void));
401
402/* maketime */
403int setfiledate P((char const*,char const[datesize]));
404void str2date P((char const*,char[datesize]));
405void time2date P((time_t,char[datesize]));
406
407/* merge */
408int merge P((int,char const*const[2],char const*const[3]));
409
410/* partime */
411int partime P((char const*,struct tm*,int*));
412
413/* rcsedit */
414#define ciklogsize 23 /* sizeof("checked in with -k by ") */
415extern FILE *fcopy;
416extern char const *resultfile;
417extern char const ciklog[ciklogsize];
418extern int locker_expansion;
419extern struct buf dirtfname[];
420#define newRCSfilename (dirtfname[0].string)
421RILE *rcswriteopen P((struct buf*,struct stat*,int));
422char const *makedirtemp P((char const*,int));
423char const *getcaller P((void));
424int addlock P((struct hshentry*));
425int addsymbol P((char const*,char const*,int));
426int checkaccesslist P((void));
427int chnamemod P((FILE**,char const*,char const*,mode_t));
428int donerewrite P((int));
429int dorewrite P((int,int));
430int expandline P((RILE*,FILE*,struct hshentry const*,int,FILE*));
431int findlock P((int,struct hshentry**));
432void aflush P((FILE*));
433void copystring P((void));
434void dirtempunlink P((void));
435void enterstring P((void));
436void finishedit P((struct hshentry const*,FILE*,int));
437void keepdirtemp P((char const*));
438void openfcopy P((FILE*));
439void snapshotedit P((FILE*));
440void xpandstring P((struct hshentry const*));
441#if has_NFS || bad_unlink
442	int un_link P((char const*));
443#else
444#	define un_link(s) unlink(s)
445#endif
446#if large_memory
447	void edit_string P((void));
448#	define editstring(delta) edit_string()
449#else
450	void editstring P((struct hshentry const*));
451#endif
452
453/* rcsfcmp */
454int rcsfcmp P((RILE*,struct stat const*,char const*,struct hshentry const*));
455
456/* rcsfnms */
457#define bufautobegin(b) ((void) ((b)->string = 0, (b)->size = 0))
458extern FILE *workstdout;
459extern char *workfilename;
460extern char const *RCSfilename;
461extern char const *suffixes;
462extern struct stat RCSstat;
463RILE *rcsreadopen P((struct buf*,struct stat*,int));
464char *bufenlarge P((struct buf*,char const**));
465char const *basename P((char const*));
466char const *getfullRCSname P((void));
467char const *maketemp P((int));
468char const *rcssuffix P((char const*));
469int pairfilenames P((int,char**,RILE*(*)P((struct buf*,struct stat*,int)),int,int));
470size_t dirlen P((char const*));
471struct cbuf bufremember P((struct buf*,size_t));
472void bufalloc P((struct buf*,size_t));
473void bufautoend P((struct buf*));
474void bufrealloc P((struct buf*,size_t));
475void bufscat P((struct buf*,char const*));
476void bufscpy P((struct buf*,char const*));
477void tempunlink P((void));
478
479/* rcsgen */
480extern int interactiveflag;
481extern struct buf curlogbuf;
482char const *buildrevision P((struct hshentries const*,struct hshentry*,FILE*,int));
483int getcstdin P((void));
484int ttystdin P((void));
485int yesorno P((int,char const*,...));
486struct cbuf cleanlogmsg P((char*,size_t));
487struct cbuf getsstdin P((char const*,char const*,char const*,struct buf*));
488void putdesc P((int,char*));
489
490/* rcskeep */
491extern int prevkeys;
492extern struct buf prevauthor, prevdate, prevrev, prevstate;
493int getoldkeys P((RILE*));
494
495/* rcskeys */
496extern char const *const Keyword[];
497enum markers trymatch P((char const*));
498
499/* rcslex */
500extern FILE *foutptr;
501extern FILE *frewrite;
502extern RILE *finptr;
503extern char const *NextString;
504extern enum tokens nexttok;
505extern int hshenter;
506extern int nerror;
507extern int nextc;
508extern int quietflag;
509extern unsigned long rcsline;
510char const *getid P((void));
511exiting void efaterror P((char const*));
512exiting void enfaterror P((int,char const*));
513exiting void faterror P((char const*,...));
514exiting void fatserror P((char const*,...));
515exiting void Ieof P((void));
516exiting void Ierror P((void));
517exiting void Oerror P((void));
518char *checkid P((char*,int));
519int eoflex P((void));
520int getkeyopt P((char const*));
521int getlex P((enum tokens));
522struct cbuf getphrases P((char const*));
523struct cbuf savestring P((struct buf*));
524struct hshentry *getnum P((void));
525void Ifclose P((RILE*));
526void Izclose P((RILE**));
527void Lexinit P((void));
528void Ofclose P((FILE*));
529void Ozclose P((FILE**));
530void afputc P((int,FILE*));
531void aprintf P((FILE*,char const*,...));
532void aputs P((char const*,FILE*));
533void checksid P((char*));
534void diagnose P((char const*,...));
535void eerror P((char const*));
536void eflush P((void));
537void enerror P((int,char const*));
538void error P((char const*,...));
539void fvfprintf P((FILE*,char const*,va_list));
540void getkey P((char const*));
541void getkeystring P((char const*));
542void nextlex P((void));
543void oflush P((void));
544void printstring P((void));
545void readstring P((void));
546void redefined P((int));
547void testIerror P((FILE*));
548void testOerror P((FILE*));
549void warn P((char const*,...));
550void warnignore P((void));
551#if has_madvise && has_mmap && large_memory
552	void advise_access P((RILE*,int));
553#	define if_advise_access(p,f,advice) if (p) advise_access(f,advice)
554#else
555#	define advise_access(f,advice)
556#	define if_advise_access(p,f,advice)
557#endif
558#if has_mmap && large_memory
559	RILE *I_open P((char const*,struct stat*));
560#	define Iopen(f,m,s) I_open(f,s)
561#else
562	RILE *Iopen P((char const*,char const*,struct stat*));
563#endif
564#if !large_memory
565	void testIeof P((FILE*));
566	void Irewind P((RILE*));
567#endif
568
569/* rcsmap */
570extern const enum tokens ctab[];
571
572/* rcsrev */
573char *partialno P((struct buf*,char const*,unsigned));
574char const *tiprev P((void));
575int cmpnum P((char const*,char const*));
576int cmpnumfld P((char const*,char const*,unsigned));
577int compartial P((char const*,char const*,unsigned));
578int expandsym P((char const*,struct buf*));
579int fexpandsym P((char const*,struct buf*,RILE*));
580struct hshentry *genrevs P((char const*,char const*,char const*,char const*,struct hshentries**));
581unsigned countnumflds P((char const*));
582void getbranchno P((char const*,struct buf*));
583
584/* rcssyn */
585/* These expand modes must agree with Expand_names[] in rcssyn.c.  */
586#define KEYVAL_EXPAND 0 /* -kkv `$Keyword: value $' */
587#define KEYVALLOCK_EXPAND 1 /* -kkvl `$Keyword: value locker $' */
588#define KEY_EXPAND 2 /* -kk `$Keyword$' */
589#define VAL_EXPAND 3 /* -kv `value' */
590#define OLD_EXPAND 4 /* -ko use old string, omitting expansion */
591struct diffcmd {
592	unsigned long
593		line1, /* number of first line */
594		nlines, /* number of lines affected */
595		adprev, /* previous 'a' line1+1 or 'd' line1 */
596		dafter; /* sum of previous 'd' line1 and previous 'd' nlines */
597};
598extern char const      * Dbranch;
599extern struct access   * AccessList;
600extern struct assoc    * Symbols;
601extern struct cbuf Comment;
602extern struct lock     * Locks;
603extern struct hshentry * Head;
604extern int		 Expand;
605extern int               StrictLocks;
606extern unsigned TotalDeltas;
607extern char const *const expand_names[];
608extern char const Kdesc[];
609extern char const Klog[];
610extern char const Ktext[];
611int getdiffcmd P((RILE*,int,FILE*,struct diffcmd*));
612int putdftext P((char const*,struct cbuf,RILE*,FILE*,int));
613int putdtext P((char const*,struct cbuf,char const*,FILE*,int));
614int str2expmode P((char const*));
615void getadmin P((void));
616void getdesc P((int));
617void gettree P((void));
618void ignorephrase P((void));
619void initdiffcmd P((struct diffcmd*));
620void putadmin P((FILE*));
621void putstring P((FILE*,int,struct cbuf,int));
622void puttree P((struct hshentry const*,FILE*));
623
624/* rcsutil */
625extern int RCSversion;
626char *cgetenv P((char const*));
627char *fstr_save P((char const*));
628char *str_save P((char const*));
629char const *date2str P((char const[datesize],char[datesize]));
630char const *getusername P((int));
631int getRCSINIT P((int,char**,char***));
632int run P((char const*,char const*,...));
633int runv P((char const**));
634malloc_type fremember P((malloc_type));
635malloc_type ftestalloc P((size_t));
636malloc_type testalloc P((size_t));
637malloc_type testrealloc P((malloc_type,size_t));
638#define ftalloc(T) ftnalloc(T,1)
639#define talloc(T) tnalloc(T,1)
640#if lint
641	extern malloc_type lintalloc;
642#	define ftnalloc(T,n) (lintalloc = ftestalloc(sizeof(T)*(n)), (T*)0)
643#	define tnalloc(T,n) (lintalloc = testalloc(sizeof(T)*(n)), (T*)0)
644#	define trealloc(T,p,n) (lintalloc = testrealloc((malloc_type)0, sizeof(T)*(n)), p)
645#	define tfree(p)
646#else
647#	define ftnalloc(T,n) ((T*) ftestalloc(sizeof(T)*(n)))
648#	define tnalloc(T,n) ((T*) testalloc(sizeof(T)*(n)))
649#	define trealloc(T,p,n) ((T*) testrealloc((malloc_type)(p), sizeof(T)*(n)))
650#	define tfree(p) free((malloc_type)(p))
651#endif
652void awrite P((char const*,size_t,FILE*));
653void fastcopy P((RILE*,FILE*));
654void ffree P((void));
655void ffree1 P((char const*));
656void setRCSversion P((char const*));
657#if has_signal
658	void catchints P((void));
659	void ignoreints P((void));
660	void restoreints P((void));
661#else
662#	define catchints()
663#	define ignoreints()
664#	define restoreints()
665#endif
666#if has_getuid
667	uid_t ruid P((void));
668#	define myself(u) ((u) == ruid())
669#else
670#	define myself(u) true
671#endif
672#if has_setuid
673	uid_t euid P((void));
674	void nosetid P((void));
675	void seteid P((void));
676	void setrid P((void));
677#else
678#	define nosetid()
679#	define seteid()
680#	define setrid()
681#endif
682