1#!/usr/local/bin/tclsh8.6
2# The exec tclsh<whatever>'' below will simply be ignored.
3# \
4if [ -e /usr/bin/tclsh ]; then exec /usr/bin/tclsh "$0" ${1+"$@"} ; fi
5# \
6if [ -e /usr/local/bin/tclsh8.4 ]; then exec /usr/local/bin/tclsh8.4 "$0" ${1+"$@"} ; fi
7# \
8if [ -e /usr/local/bin/tclsh8.3 ]; then exec /usr/local/bin/tclsh8.3 "$0" ${1+"$@"} ; fi
9# \
10if [ -e /usr/bin/tclsh8.4 ]; then exec /usr/bin/tclsh8.4 "$0" ${1+"$@"} ; fi
11# \
12exec tclsh "$0" ${1+"$@"}
13
14if {[catch {
15    package require tcllib
16
17    ncgi::header
18    html::head Hello
19    flush stdout
20
21    set query [ncgi::nvlist]
22
23    puts [html::h1 "Hello, World!"]
24    puts [html::h2 [clock format [clock seconds]]]
25
26    puts [html::h3 "CGI Values"]
27    puts [html::tableFromList $query]
28
29    puts [html::h3 Environment]
30    puts [html::tableFromArray env]
31    flush stdout
32    exit 0
33}]} {
34    puts "Content-Type: text/html\n"
35    puts "<h1>CGI Error</h1>"
36    puts "<pre>$errorInfo</pre>"
37    puts "<h2>auto_path</h2>"
38    puts "<pre>[join $auto_path \n]</pre>"
39}
40