The CGI API provides a library of functions for creating CGI (Common Gateway Interface) programs. It contains functions for manipulating the CGI environment, avoiding the often-quirky CGI transport and encoding mechanisms and replacing them with a consistent interface.
Access to the API is through a
CGI struct that is returned by
a call to
opencgi(). Translated CGI variables from the URL,
content, and elsewhere are obtained from this object with the
getcgi() function. Variables can be created and saved across
program invocations with the
putcgi() function, allowing state
retention through the duration of a Web client's session. This makes
it easier to write CGI programs that need to "remember" information
about a Web client's session (e.g. perhaps a list of items chosen to be
Output of HTML- or URL-encoded data is made easier with the
htpf() set of functions, which supersede the standard
printf() library. Metamorph queries can even be executed and
marked up in HTML on the fly by simply "printing" the string and query.
closecgi() closes the given
frees its resources.