Functions | |
formvars * | cgi_process_form () |
Process HTML form or URL data. | |
void | cgi_fatal (const char *msg) |
Kills the application with a message. | |
int | cgi_include (const char *filename) |
Include static files. | |
void | cgi_init_headers () |
Initialize HTML headers. | |
char * | cgi_param_multiple (const char *name) |
Return all values with the same name sent by a form. | |
void | cgi_redirect (char *url) |
Recirects to the specified url. | |
int | cgi_init () |
Main cgi function. | |
void | cgi_end () |
Performs cgi clean ups. | |
char * | cgi_unescape_special_chars (char *str) |
Transforms' URL special chars. | |
char * | cgi_escape_special_chars (char *str) |
Transforms' special characters into hexadecimal form ( %E1 ). | |
char * | cgi_param (const char *var_name) |
Gets the of HTML or URL variable indicated by 'name'. | |
void | cgi_send_header (const char *header) |
Sends a specific header. |
|
Performs cgi clean ups. Provides some methods to clean memory or any other job that need to be done before the end of the application.
|
|
Transforms' special characters into hexadecimal form ( %E1 ).
|
|
Kills the application with a message. Writes msg and terminate
|
|
Include static files. Function used to include static data ( normaly html files ). File contents will never be processed. Note that I don't scan for any special character. The reason I did it is, if the you are using this library, you have a shell where you can compile the cgi program. And can do much more ;-)
cgi_include("top_bar.htm"); |
|
Main cgi function. Configures all (most?) we need to get cgi library working correctly. It MUST be called before any other cgi function.
|
|
Initialize HTML headers. You need to call this function before that any content is send to the brosert, otherwise you'll get an error (Error 500).
|
|
Gets the of HTML or URL variable indicated by 'name'.
// ... char *contents; cgi_init(); cgi_process_form(); cgi_init_headers(); contents = cgi_param("foo"); puts(contents); // ... |
|
Return all values with the same name sent by a form.
"What do you like??" then, to retrieve all values, you can make a code like
// ... char *data; \\ ... while ((data = cgi_param_multiple("like")) != NULL) puts(data); \\ ... |
|
Process HTML form or URL data. Used to retrieve GET or POST data. It handles automaticaly the correct REQUEST_METHOD, so you don't need to afraid about it.
|
|
Recirects to the specified url.
Remember that you cannot send any header before this function, or it will not work. Note:
cgi_redirect("http://wwww.linux.org"); |
|
Sends a specific header. Sends a specific HTTP header. You won't need to add '\n\n' chars.
|
|
Transforms' URL special chars. Search for special chars ( like %E1 ) in str, converting them to the ascii character correspondent.
|