Generated: December 12, 2003, 17:52:12 | Copyright © 2003 , Kurt Nørmark | ![]() |
The function extract-form-input reads the necessary amounts of input (as determined by the environment variable CONTENT_LENGT) and returns a Lisp association list.
The function extract-url-parameters returns and decodes the url parameters. The url parameters are the part of an URL found after the question mark. Using the CGI interface, these are passed via the environment variable QUERY_STRING. Like extract-form-input, the result of this function is also a Lisp association list.
The input functions (extract-form-input and extract-url-parameters) take a parameter, which is used for testing purposes in the situation where we are not connected to a WWW server. The global variable cgi-testing controls whether this parameter is used. The variable cgi-testing must be defined in the context of this library.
The function time-extend extends an association list with time and date information. This time stamping is quite useful when we extract data from an input form.
On the output side, the function write-page writes a page to standard output. If cgi-testing, the page is written to a local test-file.
The variable test-file must be defined in the context of this library.
The function make-url-parameters produces and encodes url paramters. This is used if we make an URL which passes parameters to another CGI program. The function make-url makes and returns an URL.
The CGI library depends on the accompanying URL encode and decode library.
There exists a simple tutorial CGI example in elucidative style.
cgi-url-input | (cgi-url-input . the-input) | Return the url input (a string) also known as the query string. |
cgi-write | (cgi-write output) | Write output (a text or a LAML AST) to standard output, or if cgi-testing, to test-file. |
end | (end) | Ends and exit the CGI program. |
extract-form-input | (extract-form-input . testfile) | Extract form input from std input, and return the decoded data as an association list. |
extract-multipart-form-input | (extract-multipart-form-input cur-time . testfile) | Extract form input from std input, and return the decoded data as an association list. |
extract-url-parameters | (extract-url-parameters . the-input) | Return a decoded URL input, as taken from the QUERY_STRING and decoded appropritely to an association list. |
length-of-std-input | (length-of-std-input) | Return the number of chars on standard input |
make-url | (make-url url-prefix cgi-program key-list val-list) | Return an URL from the parameters. |
make-url-parameters | (make-url-parameters key-list val-list) | Make the last part of an url - the part after the question mark. |
read-std-input | (read-std-input n) | Read n chars from standard input and return as string. |
save-registrations | (save-registrations a-list f g) | A special purpose function which saves the a-list in two files f and g. |
split-file-name | (split-file-name filename) | Return a list of the file name components separated by underscore. |
time-extend | (time-extend a-list second-count) | Extend the the a-list with date, time and second-cound fields (all strings). |
write-page | (write-page title body . color-list) | Writes an HTML page to standard output. |
writeln | (writeln . args) | Writes a newline on standard output |