Let us consider following (ruther silly) form example. We would like to read parameters specified in the form into the C program variables :
parser reads environment CGI variables (they are placed in cgi structure - see parser.h), reads standard input and also needs translation table.
In partab_t table you have to specify variables types their names in the form and ponters to them in C program. Each entry in this table consist of three following fields :
Return value from parser function is less than zero if internal error occurs. In other case it is equal to number of variables read from the form.
If parser is sucessful you can easily use variables read from the form. You can make calculations with int, long and float variables or deal with separately mallocked strings (char *). You can even check boolean variables or deal with tables of strings.
Additionall feature is that you can use all CGI environment variables read from the environment. External variable cgi is declared in parser.h and defined in parser.c. All cgi values except SERVER_PORT and CONTENT_LENGTH(which are int type) are separately mallocked strings (char *).
Now look for the working version of form and C program or look at the sources :
If you have any suggestions or comments press this.