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
|
$NetBSD: patch-ac,v 1.2 2006/01/06 22:46:51 adam Exp $
--- cgic.c.orig 2004-11-15 17:57:59.000000000 +0100
+++ cgic.c
@@ -119,8 +119,9 @@ static void cgiFreeResources();
static int cgiStrEqNc(char *s1, char *s2);
static int cgiStrBeginsNc(char *s1, char *s2);
-int main(int argc, char *argv[]) {
- int result;
+int
+cgiInit(void)
+{
char *cgiContentLengthString;
char *e;
cgiSetupConstants();
@@ -206,17 +207,6 @@ int main(int argc, char *argv[]) {
cgiOut = stdout;
cgiRestored = 0;
-
- /* These five lines keep compilers from
- producing warnings that argc and argv
- are unused. They have no actual function. */
- if (argc) {
- if (argv[0]) {
- cgiRestored = 0;
- }
- }
-
-
if (cgiStrEqNc(cgiRequestMethod, "post")) {
#ifdef CGICDEBUG
CGICDEBUGSTART
@@ -284,9 +274,8 @@ int main(int argc, char *argv[]) {
#endif /* CGICDEBUG */
}
}
- result = cgiMain();
- cgiFreeResources();
- return result;
+ atexit(cgiFreeResources);
+ return 0;
}
static void cgiGetenv(char **s, char *var){
|