header juggling
[catagits/fcgi2.git] / examples / tiny-fcgi2.c
CommitLineData
6600ff68 1/*
0198fd3c 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
6600ff68 15static const char rcsid[] = "$Id: tiny-fcgi2.c,v 1.4 1999/07/28 00:36:11 roberts Exp $";
0198fd3c 16#endif /* not lint */
17
6600ff68 18#include "fcgi_config.h"
19
20#ifdef HAVE_UNISTD_H
2fd179ab 21#include <unistd.h>
22#endif
23
0198fd3c 24#ifdef _WIN32
25#include <process.h>
26#endif
27
6600ff68 28#include "fcgiapp.h"
29
3293ebdf 30int main(void)
0198fd3c 31{
32 FCGX_Stream *in, *out, *err;
33 FCGX_ParamArray envp;
34 int count = 0;
3293ebdf 35
36 while (FCGX_Accept(&in, &out, &err, &envp) >= 0) {
0198fd3c 37 FCGX_FPrintF(out,
6600ff68 38 "Content-type: text/html\r\n"
39 "\r\n"
40 "<title>FastCGI Hello! (C, fcgiapp library)</title>"
41 "<h1>FastCGI Hello! (C, fcgiapp library)</h1>"
42 "Request number %d running on host <i>%s</i> "
43 "Process ID: %d\n",
44 ++count, FCGX_GetParam("SERVER_NAME", envp), getpid());
3293ebdf 45 }
46
47 return 0;
0198fd3c 48}