/* An example CGI script written in REXX */

Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs

Parse Arg Argv

Argc = Words(Argv)

Say "HTTP/1.0 200 OK"
Say "Content-type: text/html"
Say "Server:" value("SERVER_SOFTWARE",,"OS2ENVIRONMENT")
Say 

Say "<H1>CGI/1.0 test script report:</H1>"  

Say "<UL>"

Say "<LI>argc = " Argc
Say "<LI>argv = " Argv 
Say "<LI>SERVER_SOFTWARE = " value("SERVER_SOFTWARE",,"OS2ENVIRONMENT") 
Say "<LI>SERVER_NAME = " value("SERVER_NAME",,"OS2ENVIRONMENT") 
Say "<LI>GATEWAY_INTERFACE = " value("GATEWAY_INTERFACE",,"OS2ENVIRONMENT") 
Say "<LI>SERVER_PROTOCOL = " value("SERVER_PROTOCOL",,"OS2ENVIRONMENT") 
Say "<LI>SERVER_PORT = " value("SERVER_PORT",,"OS2ENVIRONMENT")
Say "<LI>REQUEST_METHOD = " value("REQUEST_METHOD",,"OS2ENVIRONMENT") 
Say "<LI>HTTP_ACCEPT = " value("HTTP_ACCEPT",,"OS2ENVIRONMENT") 
Say "<LI>PATH_INFO = " value("PATH_INFO",,"OS2ENVIRONMENT") 
Say "<LI>PATH_TRANSLATED = " value("PATH_TRANSLATED",,"OS2ENVIRONMENT") 
Say "<LI>SCRIPT_NAME = " value("SCRIPT_NAME",,"OS2ENVIRONMENT")
Say "<LI>QUERY_STRING = " value("QUERY_STRING",,"OS2ENVIRONMENT")
Say "<LI>REMOTE_HOST = " value("REMOTE_HOST",,"OS2ENVIRONMENT")
Say "<LI>REMOTE_ADDR = " value("REMOTE_ADDR",,"OS2ENVIRONMENT")
Say "<LI>REMOTE_USER = " value("REMOTE_USER",,"OS2ENVIRONMENT")
Say "<LI>AUTH_TYPE = " value("AUTH_TYPE",,"OS2ENVIRONMENT")
Say "<LI>CONTENT_TYPE = " value("CONTENT_TYPE",,"OS2ENVIRONMENT")
Say "<LI>CONTENT_LENGTH = " value("CONTENT_LENGTH",,"OS2ENVIRONMENT")
If (value("REQUEST_METHOD",,"OS2ENVIRONMENT") == "POST") & (value("CONTENT_LENGTH",,"OS2ENVIRONMENT") \= "") Then Do
  post_string = LineIn() 
  Say "<LI>Standard Input = " || post_string
End
Say "</UL>"

Say "Apache Extensions"  
Say "<UL>"
Say "<LI>SERVER_ADMIN = " value("SERVER_ADMIN",,"OS2ENVIRONMENT") 
Say "<LI>DOCUMENT_ROOT = " value("DOCUMENT_ROOT",,"OS2ENVIRONMENT") 
Say "<LI>QUERY_STRING_UNESCAPED = " value("QUERY_STRING_UNESCAPED",,"OS2ENVIRONMENT")
Say "<LI>REDIRECT_QUERY_STRING = " value("REDIRECT_QUERY_STRING",,"OS2ENVIRONMENT")
Say "<LI>REDIRECT_URL = " value("REDIRECT_URL",,"OS2ENVIRONMENT")
Say "</UL>"
