Initial revision
[catagits/fcgi2.git] / examples / tiny-fcgi2.c
1 /* 
2  * tiny-fcgi2.c --
3  *
4  *      FastCGI example program using fcgiapp 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-fcgi2.c,v 1.1 1997/09/16 15:36:29 stanleyg Exp $";
16 #endif /* not lint */
17
18 #include "fcgiapp.h"
19
20 #ifdef _WIN32
21 #include <process.h>
22 #endif
23
24 void main(void)
25 {
26     FCGX_Stream *in, *out, *err;
27     FCGX_ParamArray envp;
28     int count = 0;
29     while(FCGX_Accept(&in, &out, &err, &envp) >= 0)
30         FCGX_FPrintF(out,
31                "Content-type: text/html\r\n"
32                "\r\n"
33                "<title>FastCGI Hello! (C, fcgiapp library)</title>"
34                "<h1>FastCGI Hello! (C, fcgiapp library)</h1>"
35                "Request number %d running on host <i>%s</i>  "
36                "Process ID: %d\n",
37                ++count, FCGX_GetParam("SERVER_NAME", envp), getpid());
38 }