header juggling
[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.4 1999/07/28 00:35:28 roberts Exp $";
16 #endif /* not lint */
17
18 #include "fcgi_config.h"
19
20 #include <stdlib.h>
21
22 #ifdef HAVE_UNISTD_H
23 #include <unistd.h>
24 #endif
25
26 #ifdef _WIN32
27 #include <process.h>
28 #endif
29
30 #include "fcgi_stdio.h"
31
32 int main(void)
33 {
34     int count = 0;
35     while(FCGI_Accept() >= 0) {
36         printf("Content-type: text/html\r\n"
37                "\r\n"
38                "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
39                "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
40                "Request number %d running on host <i>%s</i>  "
41                "Process ID: %d\n",
42                ++count, getenv("SERVER_NAME"), getpid());
43     }
44
45     return 0;
46 }