### Copyright (C) 1995-1997 Jesper K. Pedersen ### This program is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### This program is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with this program; if not, write to the Free Software ### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. proc time2 {} { # time Desc "Here you can configure periodic commands and time related commands" ShortDesc "Configuration of time related commands" Radio ampm \ -text "Time format" \ -entries {AM/PM "24 hours"} \ -defaultIndex 1\ -packFrame:fill x Line l1 Int tperiod \ -text "Period in minutes between periodic commands" TextBox periodic \ -text "command(s) to execute" CheckBox exitvalue \ -text "print exit value for interactive programs" Line l3 Int mailtime \ -text "Interval between mail check" \ -textafter "(0 - before each prompt)" \ -default 10 File-Dir-Browser mail -text "Filename"\ -default /var/spool/mail/ ExtEntry mailfiles \ -text "Files to check for mail" \ -entries frame_mail ################################ Help ################################ Help tperiod \ "In this way you can specify a command or a series of commands"\ "to execute every 'period' minutes.\n"\ "0 - means after each command\n"\ "--1 or blank: means never" Help periodic \ "This is commands to execute every 'period' of time.\n" \ "To execute more than one command, put them on separate lines." Help exitvalue \ "When an interactive program exits with a non zero status"\ "the shell prints \"Exit Status\" if this option is selected." Help mailtime \ "This is the interval between each mail check in minutes." \ "If more than this amount of time has gone the shell checks for mail" \ "before each prompt" foreach elm {frame_mail mail com_mail} { Help $elm \ "If you type a filename here, then the shell will check for new"\ "mail in this file. If more than one file name is typed, the"\ "message \"New mail in \" is shown otherwise: \"You have"\ "new mail\" is displayed.\n The filename is often something"\ "like /var/spool/mail/" } Help mailfiles \ "If you type a filename here, then the shell will check for new"\ "mail in this file. If more than one file name is typed, the"\ "message \"New mail in \" is shown otherwise: \"You have"\ "new mail\" is shown.\n The filename is often something like"\ "/var/spool/mail/" ############################## Page End ############################## PageEnd { if {$mailtime == ""} { error "Entry with text:\"Interval between mail check\" is empty" } } ################################ Save ################################ Save { ########## ampm ########## if {$ampm(index) == 0 || $generateDefault} { print "[pick $ampm(index) set unset] ampm" } ########## periodic, tperiod ########## if {($tperiod != "" && $tperiod > -1) || $generateDefault} { if {$tperiod == "" || $tperiod == -1} { print "unalias periodic" } else { print "set tperiod = $tperiod" regsub -all "\n" $periodic ";" per print "alias periodic \"$per\"" } } ########## printexitvalue ########## if {$exitvalue || $generateDefault} { print "[pick $exitvalue set unset] printexitvalue" } ########## mail ########## set filenames "" forevery mailfiles { append filenames "$mail " } set filenames [string trim $filenames] if {$filenames != "" || $generateDefault} { if {$mailtime != 10 || $generateDefault} { print "set mail = ($mailtime $filenames)" } else { print "set mail = ($filenames)" } } } }