Lightweight CGI LibraryUse of the CGI LibraryThis library is intend to provide an easy interface to CGI programming for the Free Software Community. Please see how easy it is to work with CGI. To use this library you need to include the cgi.h include file with the following command into your C programs: #include <cgi.h> Additionally you'll have to add the library libcgi.a to the linker, either by modifying LDFLAGS in your makefiles or by adding `-lcgi' to the appropriate commandline.
#include <cgi.h>
s_cgi *cgiArg;
void main()
{
char *url;
char *server_url = NULL;
cgiArg = cgiInit ();
server_url = getenv("SERVER_URL");
if ((url = cgiGetValue(cgiArg, "url")) == NULL) {
if (server_url)
cgiRedirect(server_url);
else
cgiRedirect("/");
} else
cgiRedirect(url);
}
|
|