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