exec tclsh "$0" "$@"
proc date {} {
return [exec date "+%Y/%m/%d"]
}
proc fortune {} {
if {[catch {
exec fortune
} res]} {
set res "As long as the answer is right, who cares if the question is wrong?\n"
}
return $res
}
proc fortune-page {} {
return "Content-Type: text/html
<html>
<head>
<title>The Message of Today</title>
</head>
<body>
<b>The message of today ( [date] ) is:</b>
<pre>
[fortune]
<pre>
</body>
</html>
"
}
puts [fortune-page]