; ;+ ; Copyright (C) 1989-92 Terry Dutcher, All Rights Reserved ; ;*************************************************************************** ; ; THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS ONLY. ; ; The author disclaims all warranties on the program, including without ; limitation, all implied warranties of merchantablity and fitness. ; ; Full permission and consent is hereby given to reproduce, distribute, and ; publish and to permit others to reproduce this program and information ; relating thereto according to the terms granted in the license agreement. ; ;*************************************************************************** ; ; System Title: Set-Clock Date Created: 07-Apr-89 ; ; Module Name: Procomm+ Script Written By: Terry Dutcher ; ; Revsion Number: 04.0P1 Revision Date: 31 August 1992 ; ; Purpose: ; ; To front-end the CLKSET routine by dialing the Naval Observatory ; or NIST and passing it the time/date string (and switches etc.) ; ; Change Log: ; ; 0.0 to 2.4 - Prerelease versions ; 2.5 to 2.7 - Performed all processing in the command file ; 3.0 - Use external CLKSET routine to process and set clocks. ; 3.1 - Use external configuration file ; 4.0 - build CFG file via program, pursue NIST ; ;*************************************************************************** ;- emulate vt102 clear curoff ; init the screen if mono clear 0 box 0 0 5 79 112 atsay 2 23 7 " S e t - C l o c k - Version 4.0 " atsay 4 13 7 " Copyright (C) 1992 Terry Dutcher, All Rights Reserved " box 8 20 12 60 112 atsay 10 25 7 " --- Initializing --- " else clear 16 box 0 0 5 79 113 atsay 2 23 31 " S e t - C l o c k - Version 4.0 " atsay 4 13 31 " Copyright (C) 1992 Terry Dutcher, All Rights Reserved " box 8 20 12 60 113 atsay 10 25 31 " --- Initializing --- " endif locate 15 0 transmit "ATE1^M" waitfor "OK" transmit "^[[?6h" pause 1 transmit "^[[15;23r" set baudrate 1200 set parity space set databits 7 set stopbits 1 isfile "clkset.exe" if success goto findcfg endif assign s1 "CLKSET routine not found. " gosub f_error findcfg: gosub open_cfg fgets s1 fgets s9 fgets s8 fclosei ; ; Sample SC40.CFG. The file should contain only 3 lines. The lines ; MUST start in colum 1. The 1st line is the number to manually dial ; to get to the Naval Observatory or the NIST ACTS time services, ; (include dialing codes as necessary.) The second is the start of ; the CLKSET command line. The number is the local time offset from ; Universal (GMT). The third is which time signal source. ; ; 202-653-0351 ;Naval Observatory (or NIST ACTS) number ; clkset 5 ;clkset command w/ east coast offset ; navy ;which time signal source ; substr s8 s8 0 4 switch s8 case "navy" assign s6 " Calling the Naval Observatory " assign s5 "Unable to dial the Naval Observatory " init n0 20 endcase case "nist" assign s6 " Calling the NIST - ACTS " assign s5 "Unable to dial the NIST - ACTS " init n0 28 endcase case "_NULL" assign s1 "Missing time source in SC40.CFG " gosub f_error endcase default assign s1 "Invalid or unknown time source in SC40.CFG " gosub f_error endcase endswitch if mono atsay 10 25 7 s6 else atsay 10 25 31 s6 endif locate 19 0 curon mdial s1 if not connected assign s1 s5 gosub f_error endif ; wait for a good string waitfor "*^M^J" ;wait for start of good string rget s1 n0 10 ;get date / time string hangup ;now hang up ; invoke clkset routine strfmt s8 "%s %s" s9 s1 dos s8 time s8 1 date s7 if mono scroll 0 8 0 16 79 7 box 8 20 14 60 112 atsay 10 27 7 " DOS Time and Date set to: " fatsay 11 31 7 " %s %s " s8 s7 atsay 13 22 112 s1 else scroll 0 8 0 16 79 31 box 8 20 14 60 113 atsay 10 27 31 " DOS Time and Date set to: " fatsay 11 31 31 " %s %s " s8 s7 atsay 13 22 113 s1 endif locate 23 0 pause 10 ; quit exit ; bookem: ;+ ; BOOKEM (as in Danno) Routine. Play dragnet music. ;- sound 587 65 sound 32767 1 sound 659 40 sound 32767 1 sound 698 40 sound 32767 2 sound 587 130 return ; f_error: ;+ ; F_ERROR Routine. Prints error text and exits to DOS. ;- if mono clear 0 box 0 0 5 79 112 atsay 3 3 7 " F A T A L E R R O R -- " atsay 3 32 7 s1 else clear 17 box 0 0 5 79 113 atsay 3 3 31 " F A T A L E R R O R -- " atsay 3 32 31 s1 endif hangup gosub bookem pause 7 clear 11 curon quit return ; cfg_it: ;+ ; CFG_IT Routine. Subroutine to create config file on the fly. ;- gosub bookem curon fnf: atsay 15 0 7 "Config file not found. Create it ? [Y/N] " locate 15 44 kflush keyget s0 switch s0 case "Y" endcase case "y" endcase case "N" quit endcase case "n" quit endcase case "_NULL" goto fnf endcase default goto fnf endcase endswitch isfile "cfg-sc.exe" if success goto cfg_sc endif assign s1 "Configure SetClock routine not found. " gosub f_error cfg_sc: dos "cfg-sc procomm" atsay 15 0 7 " " atsay 15 0 7 "Continue execution ? [Y/N] " locate 15 27 kflush keyget s0 switch s0 case "Y" return endcase case "y" return endcase endswitch quit return ; open_cfg: ;+ ; OPEN_CFG Routine. Open the config file. ;- find_it: isfile "sc40.cfg" if success goto open_it endif gosub cfg_it goto find_it open_it: fopeni "sc40.cfg" text if not success assign s1 "Unable to open config file. " gosub f_error endif return ;