home *** CD-ROM | disk | FTP | other *** search
- { File = MINIT.INC -- Include file for Reliance Mailing List
- Copyright (c) 1986 William Meacham, All Rights Reserved
- Revised: 3/9/86 }
-
- { ----------------------------------------------------------- }
-
- overlay procedure reset_disks ;
- var
- ch : char ;
- begin
- clrscr ;
- write_str ('CHANGE DATA DISKETTE',30,2) ;
- write_str ('Put in the new data diskette,',25,5) ;
- write_str ('THEN press the space-bar . . . ',25,6) ;
- repeat
- read(kbd,ch)
- until ch in [' ',#$1B] ;
- if ch = ' ' then
- begin
- { ******** COMMENT OUT THE NEXT LINE FOR MS/PC-DOS ******** }
- bdos($0D) ;
- { ******** INCLUDE THE PREVIOUS LINE FOR CP/M ************* }
- if not files_exist then
- begin
- show_msg ('DATA FILES NOT FOUND') ;
- halt
- end ;
- read_scr
- end ;
- fld := 1
- end ; { proc reset_disks }
-
- { ----------------------------------------------------------- }
-
- overlay procedure initialize ;
- { Do initialization housekeeping when program starts }
- var
- n : integer ;
- yes : boolean ;
-
- { + + + + + + + + + + + + + + + + + + + + }
-
- procedure create_files ;
- { This is called if files are not found on the selected drive.
- It creates the four files and initializes the SCR. }
-
- procedure bomb (filename : str14) ;
- begin
- show_msg (concat('CANNOT CREATE ',filename,'!')) ;
- halt
- end ;
-
- var
- i,
- result : integer ;
-
- begin
- write_str ('CREATING FILES -- PLEASE WAIT', 21,24) ;
-
- with scr do { initialize SCR }
- begin
- num_k := 0 ;
- max_rec := 0 ;
- num_recs := 0 ;
- prt_init := chr(15) ; { for Epson & compatible printers }
- prt_rset := chr(18) ; { " }
- for i := 2 to 4 do
- begin
- prt_init[i] := chr(0) ;
- prt_rset[i] := chr(0)
- end ;
- for i := 1 to 8 do
- cat_name[i] := ''
- end ; { with }
-
- { ******** COMMENT OUT THE NEXT LINE FOR MS/PC-DOS ******** }
- bdos($0D) ;
- { ******** INCLUDE THE PREVIOUS LINE FOR CP/M ************* }
-
- {$i-} rewrite(scr_file) ; {$i+} { create files }
- result := ioresult ;
- if not (result = 0) then
- begin
- write_str('IORESULT = ',16,20) ;
- write (result) ;
- bomb(scr_fname)
- end
- else
- begin
- write(scr_file,scr) ;
- close(scr_file)
- end ;
-
- makefile (mf_file,mf_fname,sizeof(master)) ;
- if not OK then bomb (mf_fname) ;
- makeindex (ix1_file,ix1_fname,sizeof(key1),dups_ok) ;
- if not OK then bomb (ix1_fname) ;
- makeindex (ix2_file,ix2_fname,sizeof(key2),dups_ok) ;
- if not OK then bomb (ix2_fname) ;
-
- clear_master ; { the following kludge is }
- master.last_name := 'ZZZZZ' ; { necessary per Borland }
- master.zip := '999999999' ;
- addrec (mf_file,rec_num,master) ;
- deleterec (mf_file,rec_num) ;
- close_database
- end ; { --- Procedure create_files --- }
-
- { + + + + + + + + + + + + + + + + + + + + }
-
- begin { proc initialize }
- { Display cover screen }
- clrscr ;
- write_str ('RELIANCE SOFTWARE SERVICES',26,4) ;
- write_str ('--------------------',29,7) ;
- write_str (' RELIANCE',29,9) ;
- write_str (' MAILING LIST',29,10) ;
- write_str (' Version 2.0',29,12) ;
- write_str ('--------------------',29,14) ;
- write_str (' Reliance Software Services',22,18) ;
- write_str ('1004 Elm Street, Austin, Tx 78703',22,19) ;
- write_str ('Copyright (c) 1986, Wm Meacham',24,21) ;
- fld := 1 ;
- hard_pause ;
- if fld = maxint then halt ;
-
- initindex ;
- clrscr ;
- write_str ('Please enter today''s date:',16,5) ;
- write_str ('On which drive do you keep your data files?',16,7) ;
- cur_proc_dt := null_date ;
- drive := '' ;
- scr.ID := '' ;
- fld := 1 ;
- repeat
- case fld of
- 1: begin { get current date }
- read_date (cur_proc_dt,43,5) ;
- if fld = maxint then halt ;
- if equal_date (cur_proc_dt,null_date) then
- begin
- beep ;
- fld := 1
- end
- else if fld > 2 then
- fld := 2
- end ; { 1 }
- 2: begin { get data file drive }
- read_str (drive,1,60,7) ;
- drive[1] := upcase(drive[1]) ;
- write_str (drive,60,7) ;
- if fld = maxint then halt ;
- if (fld > 2) then
- begin
- if length(drive) < 1 then
- fld := 2
- else if not (drive[1] in ['A'..'P']) then
- begin
- drive := '' ;
- fld := 2
- end
- else { drive spec ok }
- begin
- n := pos(':',scr_fname) ;
- if not(n = 0) then
- delete (scr_fname,1,n) ;
- n := pos(':',mf_fname) ;
- if not(n = 0) then
- delete (mf_fname,1,n) ;
- n := pos(':',ix1_fname) ;
- if not(n = 0) then
- delete (ix1_fname,1,n) ;
- n := pos(':',ix2_fname) ;
- if not(n = 0) then
- delete (ix2_fname,1,n) ;
-
- scr_fname := concat (drive,':',scr_fname) ;
- mf_fname := concat (drive,':',mf_fname) ;
- ix1_fname := concat (drive,':',ix1_fname) ;
- ix2_fname := concat (drive,':',ix2_fname) ;
-
- assign (scr_file,scr_fname)
- end { else drive spec ok }
- end ; { if fld > 2 }
- if fld > 3 then fld := 3
- end ; { 2 }
- 3: if files_exist then
- fld := 5
- else
- begin
- yes := false ;
- write_str('DATA FILES DO NOT NOT EXIST ON DRIVE ',16,9) ;
- write (drive) ;
- beep ;
- write_str('Do you wish to create them? (Y/N)',16,10) ;
- read_bool(yes,50,10) ;
- if fld < 3 then
- begin
- clrline (16,9) ;
- clrline (16,10)
- end
- else if (not yes) or (fld = maxint) then
- halt
- else
- fld := 4
- end ; { else, not files_exist }
- 4: begin
- write_str ('Please enter a descriptive ID for these data files:',16,12) ;
- read_str (scr.ID,30,16,13) ;
- if fld < 4 then
- begin
- clrline (16,12) ;
- clrline (16,13) ;
- fld := 3
- end
- else if fld = maxint then
- halt
- else
- create_files
- end { 4 }
- end ; { case }
- if fld = maxint then halt
- else if fld < 1 then fld := 1
- until fld > 4 ;
- read_scr
-
- end ; { --- Procedure initialize --- }
-
- {---- EOF FILE MINIT.INC ------------------------------------- }
- end
- else if (not yes) or (fld = maxint) then
- halt
-