There are standard initialization things that you will want to do when using this library. The following template should give you some idea of how to properly use this library.
/* template using cgihtml.a library */
#include <stdio.h> /* standard io functions */
#include <signal.h> /* this and unistd.h for signal trapping */
#include <unistd.h>
#include "cgi-lib.h" /* CGI-related routines */
#include "html-lib.h" /* HTML-related routines */
int main()
{
llist entries; /* define a linked list; this is where the entries */
/* are stored. */
/* prevent runaway processes; assume that the program will finish */
/* executing in a few seconds. If the program is still running after */
/* 30 seconds, assume it is running out of control and die. */
signal(SIGALRM, die);
alarm(30);
read_cgi_input(&entries); /* parse the form data and add it to the list */
/* The data is now in a very usable form. To search the list entries
by name, call the function:
cgi_val(entries, "nameofentry")
which returns a pointer to the value associated with "nameofentry". */
html_header(); /* print HTML MIME header */
html_begin("Output"); /* send appropriate HTML headers with title */
/* Output */
/* display whatever data you wish, probably with printf() */
html_end(); /* send appropriate HTML end footers (