Misc. updates to get a clean make on Linux. A bit of
[catagits/fcgi2.git] / examples / tiny-fcgi.c
1 /* 
2  * tiny-fcgi.c --
3  *
4  *      FastCGI example program using fcgi_stdio library
5  *
6  *
7  * Copyright (c) 1996 Open Market, Inc.
8  *
9  * See the file "LICENSE.TERMS" for information on usage and redistribution
10  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11  *
12  */
13
14 #ifndef lint
15 static const char rcsid[] = "$Id: tiny-fcgi.c,v 1.2 1999/01/30 22:27:36 roberts Exp $";
16 #endif /* not lint */
17
18 #include "fcgi_stdio.h"
19 #include <stdlib.h>
20
21 #if defined HAVE_UNISTD_H || defined __linux__
22 #include <unistd.h>
23 #endif
24
25 #ifdef _WIN32
26 #include <process.h>
27 #endif
28
29 void main(void)
30 {
31     int count = 0;
32     while(FCGI_Accept() >= 0) {
33         printf("Content-type: text/html\r\n"
34                "\r\n"
35                "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
36                "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
37                "Request number %d running on host <i>%s</i>  "
38                "Process ID: %d\n",
39                ++count, getenv("SERVER_NAME"), getpid());
40     }
41 }