summaryrefslogtreecommitdiff
blob: ce0c2bdc5be547ed58438bc7b49207771c3b1c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -748,6 +748,7 @@ static struct stat	globst;
  */
 #define			SANELIMIT	0177777
 
+enum fmttype            fmttype;
 char			*progname;	/* argv[0] to main() */
 static struct dslot	*devices;	/* devices table */
 static struct dslot	*markeddevs;	/* unusable device numbers */
@@ -826,6 +827,9 @@ static int		compressed_bar;	/* this is a compressed bar archive */
 static int		formatforced;	/* -k -i -Hfmt forces a format */
 static long long	lineno;		/* input line number */
 
+enum pax                pax;
+enum pax_preserve       pax_preserve;
+
 int			pax_dflag;	/* directory matches only itself */
 int			pax_kflag;	/* do not overwrite files */
 int			pax_nflag;	/* select first archive member only */
--- a/cpio/cpio.h
+++ b/cpio/cpio.h
@@ -31,7 +31,7 @@
 #include <sys/stat.h>
 #include <inttypes.h>
 
-enum	{
+enum fmttype {
 	FMT_NONE	= 00000000,	/* no format chosen yet */
 
 	TYP_PAX		= 00000010,	/* uses pax-like extended headers */
@@ -70,7 +70,8 @@ enum	{
 	FMT_BAR		= 00400001,	/* bar format type */
 
 	FMT_ZIP		= 01000000	/* zip format */
-} fmttype;
+};
+extern enum fmttype fmttype;
 
 /*
  * Zip compression method.
@@ -173,11 +174,12 @@ extern int		printsev;
 extern char		*progname;
 extern struct glist	*patterns;
 
-enum {			/* type of pax command this is */
+enum pax {			/* type of pax command this is */
 	PAX_TYPE_CPIO		= 0,	/* not a pax command */
 	PAX_TYPE_PAX1992	= 1,	/* POSIX.2 pax command */
 	PAX_TYPE_PAX2001	= 2	/* POSIX.1-2001 pax command */
-} pax;
+};
+extern enum pax         pax;
 extern int		pax_dflag;
 extern int		pax_kflag;
 extern int		pax_nflag;
@@ -185,14 +187,15 @@ extern int		pax_sflag;
 extern int		pax_uflag;
 extern int		pax_Xflag;
 
-enum {
+enum pax_preserve {
 	PAX_P_NONE	= 0000,
 	PAX_P_ATIME	= 0001,
 	PAX_P_MTIME	= 0004,
 	PAX_P_OWNER	= 0010,
 	PAX_P_MODE	= 0020,
 	PAX_P_EVERY	= 0400
-} pax_preserve;
+};
+extern enum pax_preserve pax_preserve;
 
 extern size_t		(*ofiles)(char **, size_t *);
 extern void		(*prtime)(time_t);
--- a/tabs/tabspec.c
+++ b/tabs/tabspec.c
@@ -36,6 +36,8 @@
 #include	<blank.h>
 #include	"tabspec.h"
 
+enum taberrno taberrno;
+
 static const struct {
 	const char	*c_nam;
 	const char	*c_str;
--- a/tabs/tabspec.h
+++ b/tabs/tabspec.h
@@ -34,14 +34,15 @@ struct	tabulator {
 	int	t_rep;			/* repetitive tab count */
 };
 
-enum {
+enum taberrno {
 	TABERR_NONE,
 	TABERR_CANTOP,	/* can't open */
 	TABERR_FILIND,	/* file indirection */
 	TABERR_UNKTAB,	/* unknown tab code */
 	TABERR_ILLINC,	/* illegal increment */
 	TABERR_ILLTAB	/* illegal tabs */
-} taberrno;
+};
+extern enum taberrno taberrno;
 
 extern void		*scalloc(size_t nmemb, size_t size);
 extern struct tabulator	*tabstops(const char *s, int cols);
--- a/diff/diff.c
+++ b/diff/diff.c
@@ -92,6 +92,23 @@ static void	usage(void);
 static void	xadd(const char *);
 static void	Xadd(const char *);
 
+char *ifdef1;
+char *ifdef2;
+int   wantelses;
+char *file1, *file2;
+char *tempfile1, *tempfile2;
+char **diffargv;
+struct stat stb1, stb2;
+jmp_buf recenv;
+const char *start;
+struct xclusion *xflag;
+struct stackblk *curstack;
+int hflag,tflag,aflag,lflag,Nflag,sflag,rflag,Bflag,iflag,wflag,bflag,pflag;
+int mb_cur_max;
+int opt;
+int context;
+int status;
+
 int
 main(int argc, char **argv)
 {
--- a/diff/diff.h
+++ b/diff/diff.h
@@ -106,7 +106,7 @@
 /*
  * Output format options
  */
-int	opt;
+extern int	opt;
 
 #define	D_NORMAL	0	/* Normal output */
 #define	D_EDIT		-1	/* Editor script out */
@@ -117,66 +117,66 @@ int	opt;
 				   lines and no trailing . */
 #define	D_UNIFIED	5	/* Unified diff */
 
-int	aflag;			/* diff binary files */
-int	tflag;			/* expand tabs on output */
-int	pflag;			/* show surrounding C function */
+extern int	aflag;			/* diff binary files */
+extern int	tflag;			/* expand tabs on output */
+extern int	pflag;			/* show surrounding C function */
 
 /*
  * Algorithm related options
  */
-int	hflag;			/* -h, use halfhearted DIFFH */
-int	bflag;			/* ignore blanks in comparisons */
-int	wflag;			/* totally ignore blanks in comparisons */
-int	iflag;			/* ignore case in comparisons */
-int	Bflag;			/* ignore changes that consist of blank lines */
+extern int	hflag;			/* -h, use halfhearted DIFFH */
+extern int	bflag;			/* ignore blanks in comparisons */
+extern int	wflag;			/* totally ignore blanks in comparisons */
+extern int	iflag;			/* ignore case in comparisons */
+extern int	Bflag;			/* ignore changes that consist of blank lines */
 
 /*
  * Options on hierarchical diffs.
  */
-int	lflag;			/* long output format with header */
-int	rflag;			/* recursively trace directories */
-int	sflag;			/* announce files which are same */
-int	Nflag;			/* write text of nonexistant files */
-const char	*start;		/* do file only if name >= this */
+extern int	lflag;			/* long output format with header */
+extern int	rflag;			/* recursively trace directories */
+extern int	sflag;			/* announce files which are same */
+extern int	Nflag;			/* write text of nonexistant files */
+extern const char	*start;		/* do file only if name >= this */
 
 struct xclusion {
 	struct xclusion	*x_nxt;
 	const char	*x_pat;
-}	*xflag;			/* patterns to exclude from comparison */
+};
+extern struct xclusion	*xflag;			/* patterns to exclude from comparison */
 
 /*
  * Variables for -I D_IFDEF option.
  */
-int	wantelses;		/* -E */
-char	*ifdef1;		/* String for -1 */
-char	*ifdef2;		/* String for -2 */
-char	*endifname;		/* What we will print on next #endif */
-int	inifdef;
+extern int	wantelses;		/* -E */
+extern char	*ifdef1;		/* String for -1 */
+extern char	*ifdef2;		/* String for -2 */
 
 /*
  * Variables for -c context option.
  */
-int	context;		/* lines of context to be printed */
+extern int	context;		/* lines of context to be printed */
 
 /*
  * State for exit status.
  */
-int	status;
-int	anychange;
-char	*tempfile1;		/* used when comparing against std input */
-char	*tempfile2;		/* used when comparing against std input */
+extern int	status;
+extern int	anychange;
+extern char	*tempfile1;		/* used when comparing against std input */
+extern char	*tempfile2;		/* used when comparing against std input */
 
 /*
  * Variables for diffdir.
  */
-char	**diffargv;		/* option list to pass to recursive diffs */
-int	recdepth;		/* recursion depth */
-jmp_buf	recenv;			/* jump stack on error */
+extern char	**diffargv;		/* option list to pass to recursive diffs */
+extern int	recdepth;		/* recursion depth */
+extern jmp_buf	recenv;			/* jump stack on error */
 
 struct stackblk {
 	struct stackblk	*s_prev;
 	struct stackblk	*s_next;
-} *curstack;
+};
+extern struct stackblk *curstack;
 
 /*
  * Input file names.
@@ -184,13 +184,13 @@ struct stackblk {
  * and padded with a '/', and then efile0 and efile1 point after
  * the '/'.
  */
-char	*file1, *file2, *efile1, *efile2;
-struct	stat stb1, stb2;
+extern char	*file1, *file2;
+extern struct	stat stb1, stb2;
 
 extern	const char diffh[], diff[], pr[];
 extern	const char *argv0;
 extern	const char *progname;
-int	mb_cur_max;
+extern int	mb_cur_max;
 extern int	sysv3;
 
 /* diff.c */
--- a/diff/diffdir.c
+++ b/diff/diffdir.c
@@ -142,6 +142,10 @@ static char	*mkpath(const char *, const char *);
 static void	mktitle(void);
 static int	xclude(const char *);
 
+int anychange;
+int recdepth;
+static char *efile1, *efile2;
+
 void
 diffdir(char **argv)
 {
--- a/diff/diffreg.c
+++ b/diff/diffreg.c
@@ -186,6 +186,8 @@ static int	(*chrtran)(int);/* translation for case-folding */
 static long	pstart;		/* start of last search for -p */
 static long	plast;		/* match of last search for -p */
 static long	*saveJ;		/* saved J for -p */
+static char	*endifname;	/* What we will print on next #endif */
+static int	inifdef;
 
 /* chrtran points to one of 3 translation functions:
  *	cup2low if folding upper to lower case