summaryrefslogtreecommitdiff
path: root/Build/source/texk/detex/detex-2.8-PATCHES/patch-01-ANSI-C
blob: 15dadd020ddf437479a98d7e3940d2af0d6f59c1 (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
diff -ur detex-2.8.orig/detex.l detex-2.8/detex.l
--- detex-2.8.orig/detex.l	2008-02-01 20:55:51.000000000 +0100
+++ detex-2.8/detex.l	2010-06-09 13:34:01.456409201 +0200
@@ -63,6 +63,21 @@
 #include <stdlib.h>
 #endif
 
+#undef IGNORE
+
+int BeginEnv(char *sbEnv);
+int EndEnv(char *sbEnv);
+void InputFile(char *sbFile);
+void IncludeFile(char *sbFile);
+void AddInclude(char *sbFile);
+void SetInputPaths(void);
+void SetEnvIgnore(char *sbEnvList);
+void Warning(char *sb1, char *sb2); 
+void ErrorExit(char *sb1);
+int SeparateList(char *sbList, char *rgsbList[] ,char chSep,int csbMax);
+int InList(char *sbFile);
+FILE * TexOpen(char *sbFile);
+
 #define	LaBEGIN		if (fLatex) BEGIN
 #define	IGNORE		if (fSpace && !fWord) putchar(' ')
 #define	SPACE		if (!fWord) putchar(' ')
@@ -72,7 +87,7 @@
 #define STRIPARGS(x)	cArgs=x; LaBEGIN LaMacro2
 #define	CITE(x)		if (fLatex && !fCite) KILLARGS(x)
 
-char	*SafeMalloc();
+char    *SafeMalloc(int cch, char *sbMessage);
 #ifndef NO_MALLOC_DECL
 char	*malloc();
 #endif
@@ -368,12 +383,10 @@
 **	If no input files are specified on the command line, process stdin.
 ******/
 
-main(cArgs,rgsbArgs)
-int	cArgs;
-char	*rgsbArgs[];
+int
+main(int cArgs, char *rgsbArgs[])
 {
 	char	*pch, *sbEnvList = DEFAULTENV, sbBadOpt[2];
-	FILE	*TexOpen();
 	int	fSawFile = 0, iArgs = 1;
 	
 	/* get base name and decide what we are doing, detex or delatex */
@@ -477,7 +490,8 @@
 **	return the termination signal for lex.
 ******/
 
-yywrap()
+int
+yywrap(void)
 {
 	(void)fclose(yyin);
 #ifdef FLEX_SCANNER
@@ -501,8 +515,8 @@
 **	a yyless routine
 ******/
 
-void yyless(n)
-int n;
+void
+yyless(int n)
 {
 	int 	i = strlen(yytext);
 
@@ -516,8 +530,8 @@
 **	sbEnvList.
 ******/
 
-SetEnvIgnore(sbEnvList)
-char	*sbEnvList;
+void
+SetEnvIgnore(char *sbEnvList)
 {
 	char *sb;
 
@@ -533,8 +547,8 @@
 **	is, sbCurrentEnv is set to sbEnv.
 ******/
 
-BeginEnv(sbEnv)
-char	*sbEnv;
+int
+BeginEnv(char *sbEnv)
 {
 	int	i;
 
@@ -551,8 +565,8 @@
 ** EndEnv -- checks to see if sbEnv is the current environment being ignored.
 ******/
 
-EndEnv(sbEnv)
-char	*sbEnv;
+int
+EndEnv(char *sbEnv)
 {
 	if (!fLatex) return(0);
 	if (strcmp(sbEnv, sbCurrentEnv) == 0)
@@ -565,11 +579,9 @@
 **	the sbFile is ignored.
 ******/
 
-InputFile(sbFile)
-char	*sbFile;
+void
+InputFile(char *sbFile)
 {
-	FILE	*TexOpen();
-
 	if (!fFollow)
 	    return;
 	rgfp[cfp++] = yyin;
@@ -589,11 +601,9 @@
 **	and open sbFile.  If the open fails, the sbFile is ignored.
 ******/
 
-IncludeFile(sbFile)
-char	*sbFile;
+void
+IncludeFile(char *sbFile)
 {
-	FILE	*TexOpen();
-
 	if (!fFollow)
 	    return;
 	if (!InList(sbFile))
@@ -615,8 +625,8 @@
 **	If the include list is too long, sbFile is ignored.
 ******/
 
-AddInclude(sbFile)
-char	*sbFile;
+void
+AddInclude(char *sbFile)
 {
 	if (!fFollow)
 	    return;
@@ -631,8 +641,8 @@
 **	no list, all files are assumed to be "in the list".
 ******/
 
-InList(sbFile)
-char	*sbFile;
+int
+InList(char *sbFile)
 {
 	char	*pch, sbBase[MAXPATHLEN];
 	int	i;
@@ -658,7 +668,8 @@
 **	routine does not honor the '//' construct (expand subdirs).
 ******/
 
-SetInputPaths()
+void
+SetInputPaths(void)
 {
 	char *sb, *sbPaths, *getenv();
 	int cchDefaults, cchPaths;
@@ -698,9 +709,8 @@
 **	ERROR is returned if there are more than csbMax words.
 ******/
 
-SeparateList(sbList, rgsbList, chSep, csbMax)
-char	*sbList, *rgsbList[], chSep;
-int	csbMax;
+int
+SeparateList(char *sbList, char *rgsbList[], char chSep, int csbMax)
 {
 	int	csbList = 0;
 
@@ -725,8 +735,7 @@
 ******/
 
 FILE *
-TexOpen(sbFile)
-char	*sbFile;
+TexOpen(char *sbFile)
 {
 	char	*pch, *sbNew;
 	FILE	*fp;
@@ -784,9 +793,7 @@
 ******/
 
 char *
-SafeMalloc(cch, sbMessage)
-int cch;
-char *sbMessage;
+SafeMalloc(int cch, char *sbMessage)
 {
 	char *sb;
 
@@ -799,8 +806,8 @@
 ** Warning -- print a warning message preceded by the program name.
 ******/
 
-Warning(sb1, sb2)
-char	*sb1, *sb2;
+void
+Warning(char *sb1, char *sb2)
 {
 	(void)fprintf(stderr, "%s: warning: %s %s\n", sbProgName, sb1, sb2);
 }
@@ -810,8 +817,8 @@
 **	Stdout is flushed and detex exits.
 ******/
 
-ErrorExit(sb1)
-char	*sb1;
+void
+ErrorExit(char *sb1)
 {
 	(void)fflush(stdout);
 	(void)fprintf(stderr, "%s: error: %s\n", sbProgName, sb1);
@@ -823,7 +830,8 @@
 ** OS2UsageExit -- print OS/2 usage message and exit.
 ******/
 
-OS2UsageExit()
+void
+OS2UsageExit(void)
 {
 	(void)printf("\n%s [ -clnstw ] [ -e environment-list ] [ filename[.tex] ... ]\n",
 		sbProgName);