summaryrefslogtreecommitdiff
path: root/www/cgic/patches/patch-ac
blob: eb7a2089d208557f8f2984f76de615c97278cdca (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
$NetBSD: patch-ac,v 1.1.1.1 2004/07/20 21:44:29 jmmv Exp $

--- cgic.c.orig	Sun Jan 12 13:59:43 2003
+++ cgic.c
@@ -124,8 +124,9 @@ static int cgiStrBeginsNc(char *s1, char
 
 static int firstCookie = 1;
 
-int main(int argc, char *argv[]) {
-	int result;
+int
+cgiInit(void)
+{
 	char *cgiContentLengthString;
 	char *e;
 	cgiSetupConstants();
@@ -211,17 +212,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
@@ -290,9 +280,9 @@ int main(int argc, char *argv[]) {
 		}
 	}
 	firstCookie = 1;
-	result = cgiMain();
-	cgiFreeResources();
-	return result;
+
+        atexit(cgiFreeResources);
+        return(0);
 }
 
 static void cgiGetenv(char **s, char *var){
@@ -1995,7 +1985,7 @@ cgiEnvironmentResultType cgiReadEnvironm
 	FILE *in;
 	cgiFormEntry *e = 0, *p;
 	char *version;
-	cgiEnvironmentResultType result;
+	cgiEnvironmentResultType result = cgiEnvironmentSuccess;
 	/* Free any existing data first */
 	cgiFreeResources();
 	/* Be sure to open in binary mode */