use #if instead of #ifdef
[catagits/fcgi2.git] / examples / log-dump.c
index d2023ad..d5ef8df 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * log-dump.c --
  *
  *     FastCGI example program to illustrate both an Authorizer and a
  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
  */
-
 #ifndef lint
-static const char rcsid[] = "$Id: log-dump.c,v 1.1 1997/09/16 15:36:28 stanleyg Exp $";
+static const char rcsid[] = "$Id: log-dump.c,v 1.5 2001/09/01 01:12:26 robs Exp $";
 #endif /* not lint */
 
-#include "fcgi_stdio.h"
+#include "fcgi_config.h"
+
+#include <sys/types.h>
 #include <stdlib.h>
 #include <signal.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
+#include <string.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
 
-#ifndef NULL
-#define NULL 0
+#if defined __linux__
+int kill(pid_t pid, int sig);
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
 #endif
 
+#include "fcgi_stdio.h"
+
 static int successCount = 0;
 static int failureCount = 0;
 
-void main(void)
+int main(void)
 {
     char *queryString = NULL;
     char *rolePtr;
@@ -45,7 +50,7 @@ void main(void)
     int fd, n, i, j;
     char temp[4096];
     char temp2[5000];
-    
+
     while(FCGI_Accept() >= 0) {
         rolePtr = getenv("FCGI_ROLE");
        if(rolePtr == NULL) {
@@ -129,4 +134,6 @@ void main(void)
            continue;
        }
     }
+
+    exit(0);
 }