#!/usr/bin/newlisp # # Demo of CGI 1.1 interface # # version 1.2 changed for newlisp v.10.0 # version 1.2a comments added # # get form data from CGI STDIN parse and # write back to the client browser # # # (print "Content-Type: text/html\r\n\r\n") (println "

Post or Get Variables

\n") ;; Try to read POST data. For an alternative ;; method using CONTENT_LENGTH and CONTEN_TYPE ;; see the module cgi.lsp from the distribution (set 'input (read-line)) (if (not input) (set 'input (env "QUERY_STRING"))) (if input (begin (set 'vars (parse input "&")) (dolist (elmnt vars) (replace "+" elmnt " ") (println elmnt"
")) (println "

"))) # # command line arguments (print "

Command line

\n" (main-args) "

\n") # # print environment variables (println "

Environment Variables

") (dolist (e (env)) (print (e 0) "=" (e 1) "
")) (println) (exit)