# iconcgi.icn: Test frame for CGI #-- # Written by John W. Shipman (john@nmt.edu), New Mexico Tech Computer Center, # Socorro, NM 87801. This program is in the public domain. #-- $include "cgiutil.icn" # CGI utility functions procedure main ( argList ) local argx # Walks the argList local query # Translated query string #-- # Write the CGI header, then the mandatory blank line, then # start an HTML page #-- write ( "Content-type: text/html" ); write ( ); # Mandatory blank line write ( "Icon/CGI test page" ); write ( "

Icon/CGI test page

" ); write ( "

To see how special characters are passed to a CGI handler," ); write ( "type a string in the text field below and then press enter." ); write ( "" ); write ( "

" );

#--
# Display the command line argument values, if any
#--
  every  argx := 1 to * argList  do
    write ( "arg[", argx, "] = `", argList[argx], "'" );

#--
# Display all the relevant environmental variables
#--
  Show_Env ( "SERVER_SOFTWARE" );
  Show_Env ( "SERVER_NAME" );
  Show_Env ( "GATEWAY_INTERFACE" );
  Show_Env ( "SERVER_PROTOCOL" );
  Show_Env ( "SERVER_PORT" );
  Show_Env ( "PATH_INFO" );
  Show_Env ( "PATH_TRANSLATED" );

#--
# Finally, show the query string, in both untranslated and translated form
#--
  query  :=  Show_Env ( "QUERY_STRING" );
  write ( "Translated query: `",
          HTML_Escape ( URL_Decode ( query ) ),
          "'" );

  write ( "
" ); end # --- iconcgi.icn -- main ---