www.beck-ipc.com

@CHIP-RTOS C Library - Common Gateway Interface API


CGI_GetArgument

Returns the next available argument (name-value pair).

int CGI_GetArgument ( char far **name,
                      char far **value,
                      rpCgiPtr CgiRequest);

Parameters

name

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the argument-name.

value

Output Parameter:   A pointer to a valid char-pointer variable. After the function call the char-pointer variable points to a c-string with the argument-value.

CgiRequest

Input Parameter:   The cgi request pointer which was passed to the cgi function.

Return Value

CGI_ARGUMENT_ERR_OK: success
CGI_ARGUMENT_ERR_NONE: there was no more argument found

Comments

On the first call the function returns the first found argument. On next calls the function returns the next found argument, until no more arguments could be found.
Note that this function must be called within the context of a cgi function. The pointers returned by the function are valid only while the cgi function is active. On return from the cgi function the pointer will become invalid.
The name, value pairs returned by this function are already decoded. You don't have to call CGI_UrlDeocde yourself.

Example:

            

char *name;
char *value;

while ( CGI_GetArgument( &name, &value, CgiRequest ) == CGI_ARGUMENT_ERR_OK )
{
   printf("Argument found:\r\n"
          "Name : %s\r\n"
          "Value: %s\r\n",
          name, value);
}

See Also

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    V1.00V1.00V1.00V0.90V1.00

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.10

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document