#!/usr/bin/rexx
/* -------------------------------------------------------------------------- */
/* -      REXX script lists the WEB server's environment variables          - */
/* -------------------------------------------------------------------------- */
srv_name =  value('SERVER_NAME', , environment) /* Get the name of the server */

say "Content-type: text/html"
say
say "<html>"
say '<body bgcolor="#ffffff">'

/* My standard header ------------------------------------------------------- */
say "<table width='70%'><tr>",
    "<td><img src=/orexx.gif align=top>",
    "<td><p align="center"><font size=+2><b>Object REXX</b></font>",
    "<br><font size=+1 color=#808080><b>The Scripting Language</b></font>",
    "</table>"
say "<head> <title> Environment Report by Object REXX </title> </head>",
    "<h1> Environment Report of Apache Server '"srv_name"': </h1>",
    "<br> <b>Date:</b> "date()"; <b>Time:</b> "time()

/* REXX prepares list of environment variables and issues ------------------- */
'env | rxqueue'
i = 0;
do queued()
  i = i + 1;
  parse pull listenv.i;
end
listenv.0 = i;
say "<ul>"
do i = 1 to listenv.0
  a = listenv.i
  a = a~changestr("<","&lt;")          /* Change special characters to mask  */
  a = a~changestr(">","&gt;")
  parse var a key"="value
  if a <> "" then
    say '<li> <font color="#0000ff">'key'</font> <font size=5>=</font>',
        '<font color="#ff0000">'value'</font></li>'
end
say "</ul><p>"

/* Footing of WEB page ------------------------------------------------------ */
say "<p>",
    "<hr>",
    '<img align="right" src="/orxok.gif"><b>End of Report</b>'

say "</body> </html>"

exit
