Initialization Functions
cgiInit cgiSetNullStr cgiShutDown |
Field Access Functions
cgiFieldPresent cgiGetField cgiGetFieldN cgiGetFirstField cgiGetNextField |
Error Reporting Functions
cgiErr |
Name | int cgiInit(void) |
Description | Initializes CGIRef environment. Works for either POST or GET request. You must call this function before any API calls are made. |
Returns | 0 = Success
NZ = Failure |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
|
Name | void cgiSetNullStr(char *NullStr) | ||||
Description | Sets the string to be returned when you ask for a variable that is not present. Default is NULL, until you change it. NOTE: Pass this either a NULL value or a character pointer that has global scope, i.e., not a auto variable within a function, as illustrated below | ||||
Returns | Nothing | ||||
Example |
|
Name | int cgiShutDown(void) |
Description | Shuts down the library, frees all allocated memory, and marks library as unusable |
Returns | Nothing |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
|
Name | int cgiFieldPresent(char *FieldName) |
Description | Determines if the named field is present |
Returns | 1 = Field is present
0 = Field is not present |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
if(!cgiInit())
|
Name | char *cgiGetField(char *FieldName) |
Description | Get the value of the named field, if any. |
Returns | String containing value of field. If field requested is not found, NULL is returned, unless cgiSetNullStr( ) was called. |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
printf("Content-Type: text/html%c%c",10,10); if(!cgiInit())
|
Name | char *cgiGetFieldN(char *FieldName,int n) |
Description | Get the Nth Occurence of the named field. |
Returns | String containing value of nth occurence of the named field. If field requested is not found, or if n is greater than the number of occurences of that field less 1, NULL is returned, unless cgiSetNullStr( ) was called. For example, if the field "PartNum" is in a submitted form six times, cgiGetField("PartNum",5) will return the last occurence. cgiGetField("PartNum",6) will return a NULL. Actually, cgiGetField( ) calls this function with a 0 parameter. |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
|
Name | int cgiGetFirstField(char **Name, char **Value) |
Description | Gets the Name and Value of the first of all fields submitted. |
Returns | 0 = Success, *Name and *Value now point to name & value of field
NZ = Failure, *Name and *Value unmodified. |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
printf("Content-Type: text/html%c%c",10,10); if(!cgiInit())
|
Name | int cgiGetNextField(char **Name, char **Value) |
Description | Gets the Name and Value of the next field. Intended to be called after cgiGetFirstField( ). |
Returns | 0 = Success, *Name and *Value now point to name & value of next
field
NZ = Failure, *Name and *Value unmodified. |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
printf("Content-Type: text/html%c%c",10,10); if(!cgiInit())
|
Name | int cgiErr(void) |
Description | Returns last error generated by cgiRef. |
Returns | Last error encountered by CGIRef |
Example | #include <stdio.h>
#include <cgi/cgi.h> int main(int argc, char *argv[])
|