#!/usr/local/bin/tclsh # # Copyright (c): Uwe Schmidt, FH Wedel # # You may study, modify and distribute this source code # FOR NON-COMMERCIAL PURPOSES ONLY. # This copyright message has to remain unchanged. # # Note that this document is provided 'as is', # WITHOUT WARRANTY of any kind either expressed or implied. #!/bin/sh # the next line restarts using tclsh (anywhere in search path) \ exec tclsh "$0" "$@" #-------------------- # # berechne Datum mit dem "date" Kommando proc date {} { return [exec date "+%Y/%m/%d"] } proc fortune {} { if {[catch { exec fortune } res]} { # der default spruch set res "As long as the answer is right, who cares if the question is wrong?\n" } return $res } #-------------------- # # erzeuge die HTML Seite proc fortune-page {} { return "Content-Type: text/html The Message of Today The message of today ( [date] ) is:
[fortune]
  

"
}

#--------------------
#
# Aufruf

puts [fortune-page]

#--------------------