home *** CD-ROM | disk | FTP | other *** search
- #!/bin/tcl
- #
- # @(#) motd.cgi 13.2 97/12/23
- #
- # Copyright (c) 1997 The Santa Cruz Operation, Inc.. All Rights Reserved.
- # THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE SANTA CRUZ OPERATION INC.
- # The copyright notice above does not evidence any actual or intended
- # publication of such source code.
- #
-
- # See if the file exists
- if {[catch "file stat /etc/motd statbuf"]} {
- echo "Content-type: text/html"
- echo ""
- echo "<HTML><BODY>"
- echo "No /etc/motd file"
- echo "</BODY></HTML>"
- return
- }
- if {$statbuf(size) == 0} {
- echo "Content-type: text/html"
- echo ""
- echo "<HTML><BODY>"
- echo "Empty /etc/motd file"
- echo "</BODY></HTML>"
- return
- }
- if {[catch "exec /usr/ucb/hostname" hostname]} {
- puts stderr $hostname
- exit 1
- }
-
- set buf [read_file /etc/motd]
- echo "Content-type: text/html"
- echo ""
- echo "<HTML><HEAD>"
- echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"60; URL=http://$hostname/cgi-bin/shutd.cgi\">"
- echo "</HEAD>"
- echo "<BODY>"
- echo "<SCRIPT LANGUAGE=JavaScript>"
- set buf [split $buf \n]
- foreach line $buf {
- regsub -all {[^A-Za-z0-9]} $line {\\&} line_esc
- append nbuf "$line_esc\\n"
- }
- echo "var buf = \'$nbuf\';"
- echo "
- alert(\"\\n______________________________\\n\\nMessage of the day:\\n______________________________\\n\\n\" + buf);"
- echo "</SCRIPT> </BODY> </HTML>"
-