eekim.com >
Software >
cgihtml
|
Publications | Software | Talks | Weblog | About |
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 "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. */ /* parse the form data and add it to the list */ read_cgi_input(&entries); /* 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 */ /* <title>Output</title> */ /* display whatever data you wish here, probably with printf() */ html_end(); /* send appropriate HTML end footers (</body> </html>) */ list_clear(&entries); /* free up the pointers in the linked list */ return 0; }
To compile your program with the library, include the file
cgihtml.a
when linking your object files. For example, if
your main object file is program.cgi.o, the following should work
successfully:
cc -o program.cgi program.cgi.o cgihtml.a
Copyright © 2001-2003 Eugene Eric Kim /
eekim@eekim.com.
All rights reserved. Revision: $Id: cgihtml-4.html,v 1.1 2001/05/23 17:13:24 eekim Exp $ |
Publications | Software | Talks | Weblog | About |