#include <infodrom.style>
#include <projects.style>

<projectpg project="Lightweight CGI Library" maxcontrib=5>

<h3>Use of the CGI Library</h3>

<p>This library provides a very simple interface to CGI programming in
C.  It is meant to support programs that communicate with the web user
via HTML forms and GET variables.</p>

<p>Basically, you'll need to add the following code to your programs.</p>

<p>Introduce CGI library:</p>

<p><pre>
   \#include &lt;cgi.h&gt;

   s_cgi *cgi;
   cgi = cgiInit();
</pre></p>

<p>Fetch the value of a FORM-variable:</p>

<p><pre>
   name = cgiGetValue (cgi, "name");
</pre></p>

<p>Fetch the temporary filename of an uploaded file:</p>

<p><pre>
   file = cgiGetFile (cgi, "name");
</pre></p>

<p>Fetch the value of a cookie:</p>

<p><pre>
   cookie = cgiGetCookie (cgi, "cookie-name");
</pre></p>

<p>Set a cookie yourself:</p>

<p><pre>
   cgiSetHeader ("Set-Cookie", "Version=1; name=value; Path=/");
</pre></p>

</projectpg>

# Local variables:
# mode: indented-text
# end:
