xref: /openbsd-src/usr.bin/patch/common.h (revision db3296cf5c1dd9058ceecc3a29fe4aaa0bd26000)
1 /*	$OpenBSD: common.h,v 1.21 2003/07/31 14:10:21 otto Exp $	*/
2 
3 #define DEBUGGING
4 
5 /* constants */
6 
7 #define TRUE	1
8 #define FALSE	0
9 
10 #define MAXHUNKSIZE 100000	/* is this enough lines? */
11 #define INITHUNKMAX 125		/* initial dynamic allocation size */
12 #define MAXLINELEN 8192
13 #define BUFFERSIZE 1024
14 
15 #define SCCSPREFIX "s."
16 #define GET "get -e %s"
17 #define SCCSDIFF "get -p %s | diff - %s >/dev/null"
18 
19 #define RCSSUFFIX ",v"
20 #define CHECKOUT "co -l %s"
21 #define RCSDIFF "rcsdiff %s > /dev/null"
22 
23 #define ORIGEXT ".orig"
24 #define REJEXT ".rej"
25 
26 /* handy definitions */
27 
28 #define strNE(s1,s2) (strcmp(s1, s2))
29 #define strEQ(s1,s2) (!strcmp(s1, s2))
30 #define strnNE(s1,s2,l) (strncmp(s1, s2, l))
31 #define strnEQ(s1,s2,l) (!strncmp(s1, s2, l))
32 
33 /* typedefs */
34 
35 typedef char    bool;
36 typedef long    LINENUM;	/* must be signed */
37 
38 /* globals */
39 
40 extern int	filemode;
41 
42 extern char	buf[MAXLINELEN];/* general purpose buffer */
43 
44 extern bool	using_plan_a;	/* try to keep everything in memory */
45 extern bool	out_of_mem;	/* ran out of memory in plan a */
46 
47 #define MAXFILEC 2
48 
49 extern char	*filearg[MAXFILEC];
50 extern bool	ok_to_create_file;
51 extern char	*outname;
52 extern char	*origprae;
53 
54 extern char	*TMPOUTNAME;
55 extern char	*TMPINNAME;
56 extern char	*TMPREJNAME;
57 extern char	*TMPPATNAME;
58 extern bool	toutkeep;
59 extern bool	trejkeep;
60 
61 #ifdef DEBUGGING
62 extern int	debug;
63 #endif
64 
65 extern bool	force;
66 extern bool	batch;
67 extern bool	verbose;
68 extern bool	reverse;
69 extern bool	noreverse;
70 extern bool	skip_rest_of_patch;
71 extern int	strippath;
72 extern bool	canonicalize;
73 /* TRUE if -C was specified on command line.  */
74 extern bool	check_only;
75 extern bool	warn_on_invalid_line;
76 
77 
78 #define CONTEXT_DIFF 1
79 #define NORMAL_DIFF 2
80 #define ED_DIFF 3
81 #define NEW_CONTEXT_DIFF 4
82 #define UNI_DIFF 5
83 
84 extern int	diff_type;
85 extern char	*revision;	/* prerequisite revision, if any */
86 extern LINENUM	input_lines;	/* how long is input file in lines */
87 
88 
89