home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB139 / mail20r.lzh / MINIT.INC < prev    next >
Text File  |  1988-10-11  |  8KB  |  232 lines

  1. { File = MINIT.INC -- Include file for Reliance Mailing List
  2.     Copyright (c) 1986 William Meacham, All Rights Reserved
  3.     Revised: 3/9/86 }
  4.  
  5. {Revised 11-Oct-1988 by David P. Maroun.}
  6.  
  7. { ----------------------------------------------------------- }
  8.  
  9. overlay procedure reset_disks ;
  10.   var
  11.     ch : char ;
  12.   begin
  13.     clrscr ;
  14.     write_str ('CHANGE DATA DISKETTE',30,2) ;
  15.     write_str ('Put in the new data diskette,',25,5) ;
  16.     write_str ('THEN press the space-bar . . . ',25,6) ;
  17.     repeat
  18.         read(kbd,ch)
  19.     until ch in [' ',#$1B] ;
  20.     if ch = ' ' then
  21.       begin
  22. { ******** COMMENT OUT THE NEXT LINE FOR MS/PC-DOS ******** }
  23. (*      bdos($0D) ;  *)
  24. { ******** INCLUDE THE PREVIOUS LINE FOR CP/M ************* }
  25.         if not files_exist then
  26.           begin
  27.             show_msg ('DATA FILES NOT FOUND') ;
  28.             halt
  29.           end ;
  30.         read_scr
  31.       end ;
  32.     fld := 1
  33.   end ; { proc reset_disks }
  34.  
  35. { ----------------------------------------------------------- }
  36.  
  37. overlay procedure initialize ;
  38.   { Do initialization housekeeping when program starts }
  39.     var
  40.         n   : integer ;
  41.         yes : boolean ;
  42.  
  43.   { + + + + + + + + + + + + + + + + + + + + }
  44.  
  45. procedure create_files ;
  46.   { This is called if files are not found on the selected drive.
  47.     It creates the four files and initializes the SCR. }
  48.  
  49.     procedure bomb (filename : str14) ;
  50.       begin
  51.         show_msg (concat('CANNOT CREATE ',filename,'!')) ;
  52.         halt
  53.       end ;
  54.  
  55.     var
  56.         i,
  57.         result  : integer ;
  58.  
  59.     begin
  60.         write_str ('CREATING FILES -- PLEASE WAIT', 21,24) ;
  61.  
  62.         with scr do                         { initialize SCR }
  63.           begin
  64.             num_k := 0 ;
  65.             max_rec := 0 ;
  66.             num_recs := 0 ;
  67.             prt_init := chr(15) ; { for Epson & compatible printers }
  68.             prt_rset := chr(18) ; { " }
  69.             for i := 2 to 4 do
  70.               begin
  71.                 prt_init[i] := chr(0) ;
  72.                 prt_rset[i] := chr(0)
  73.               end ;
  74.             for i := 1 to 8 do
  75.                 cat_name[i] := ''
  76.           end ; { with }
  77.  
  78. { ******** COMMENT OUT THE NEXT LINE FOR MS/PC-DOS ******** }
  79. (*      bdos($0D) ;  *)
  80. { ******** INCLUDE THE PREVIOUS LINE FOR CP/M ************* }
  81.  
  82.         {$i-} rewrite(scr_file) ; {$i+}      { create files }
  83.         result := ioresult ;
  84.         if not (result = 0) then
  85.           begin
  86.             write_str('IORESULT = ',16,20) ;
  87.             write    (result) ;
  88.             bomb(scr_fname)
  89.           end
  90.         else
  91.           begin
  92.             write(scr_file,scr) ;
  93.             close(scr_file)
  94.           end ;
  95.  
  96.         makefile (mf_file,mf_fname,sizeof(master)) ;
  97.         if not OK then bomb (mf_fname) ;
  98.         makeindex (ix1_file,ix1_fname,sizeof(key1),dups_ok) ;
  99.         if not OK then bomb (ix1_fname) ;
  100.         makeindex (ix2_file,ix2_fname,sizeof(key2),dups_ok) ;
  101.         if not OK then bomb (ix2_fname) ;
  102.  
  103.         clear_master ;                       { the following kludge is }
  104.         master.last_name := 'ZZZZZ' ;        { necessary per Borland }
  105.         master.zip := '999999999' ;
  106.         addrec (mf_file,rec_num,master) ;
  107.         deleterec (mf_file,rec_num) ;
  108.         close_database    
  109.     end ; { --- Procedure create_files --- }
  110.  
  111.   { + + + + + + + + + + + + + + + + + + + + }
  112.  
  113.     begin  { proc initialize }
  114.                   { Display cover screen }
  115.         clrscr ;
  116.         write_str ('RELIANCE SOFTWARE SERVICES',26,4) ;
  117.         write_str ('--------------------',29,7) ;
  118.         write_str ('      RELIANCE',29,9) ;
  119.         write_str ('    MAILING LIST',29,10) ;
  120.         write_str ('    Version 2.0R',29,12) ;
  121.         write_str ('--------------------',29,14) ;
  122.         write_str ('    Reliance Software Services',22,18) ;
  123.         write_str ('1004 Elm Street, Austin, Tx  78703',22,19) ;
  124.         write_str ('Copyright (c) 1986, Wm Meacham',24,21) ;
  125.         fld := 1 ;
  126.         hard_pause ;
  127.         if fld = maxint then halt ;
  128.  
  129.         initindex ;
  130.         clrscr ;
  131.         write_str ('Please enter today''s date:',16,5) ;
  132.         write_str ('On which drive do you keep your data files?',16,7) ;
  133.         cur_proc_dt := null_date ;
  134.         drive := '' ;
  135.         scr.ID := '' ;
  136.         fld := 1 ;
  137.         repeat
  138.             case fld of
  139.              1: begin                                { get current date }
  140.                   read_date (cur_proc_dt,43,5) ;
  141.                   if fld = maxint then halt ;
  142.                   if equal_date (cur_proc_dt,null_date) then
  143.                     begin
  144.                       beep ;
  145.                       fld := 1
  146.                     end
  147.                   else if fld > 2 then
  148.                       fld := 2
  149.                 end ; { 1 }
  150.              2: begin                                { get data file drive }
  151.                   read_str (drive,1,60,7) ;
  152.                   drive[1] := upcase(drive[1]) ;
  153.                   write_str (drive,60,7) ;
  154.                   if fld = maxint then halt ;
  155.                   if (fld > 2) then
  156.                     begin
  157.                       if length(drive) < 1 then
  158.                           fld := 2
  159.                       else if not (drive[1] in ['A'..'P']) then
  160.                         begin
  161.                           drive := '' ;
  162.                           fld := 2
  163.                         end
  164.                       else { drive spec ok }
  165.                         begin
  166.                           n := pos(':',scr_fname) ;
  167.                           if not(n = 0) then
  168.                               delete (scr_fname,1,n) ;
  169.                           n := pos(':',mf_fname) ;
  170.                           if not(n = 0) then
  171.                               delete (mf_fname,1,n) ;
  172.                           n := pos(':',ix1_fname) ;
  173.                           if not(n = 0) then
  174.                               delete (ix1_fname,1,n) ;
  175.                           n := pos(':',ix2_fname) ;
  176.                           if not(n = 0) then
  177.                               delete (ix2_fname,1,n) ;
  178.  
  179.                           scr_fname := concat (drive,':',scr_fname) ;
  180.                           mf_fname  := concat (drive,':',mf_fname) ;
  181.                           ix1_fname := concat (drive,':',ix1_fname) ;
  182.                           ix2_fname := concat (drive,':',ix2_fname) ;
  183.  
  184.                           assign (scr_file,scr_fname)
  185.                         end { else drive spec ok }
  186.                     end ; { if fld > 2 }
  187.                   if fld > 3 then fld := 3
  188.                 end ; { 2 }
  189.              3: if files_exist then
  190.                     fld := 5
  191.                 else
  192.                   begin
  193.                     yes := false ;
  194.                     write_str('DATA FILES DO NOT EXIST ON DRIVE ',16,9) ;
  195.                     write    (drive) ;
  196.                     beep ;
  197.                     write_str('Do you wish to create them? (Y/N)',16,10) ;
  198.                     read_bool(yes,50,10) ;
  199.                     if fld < 3 then
  200.                       begin
  201.                         clrline (16,9) ;
  202.                         clrline (16,10)
  203.                       end
  204.                     else if (not yes) or (fld = maxint) then
  205.                         halt
  206.                     else
  207.                         fld := 4
  208.                   end ; { else, not files_exist }
  209.              4: begin
  210.                   write_str ('Please enter a descriptive ID for these data files:',16,12) ;
  211.                   read_str (scr.ID,30,16,13) ;
  212.                   if fld < 4 then
  213.                     begin
  214.                       clrline (16,12) ;
  215.                       clrline (16,13) ;
  216.                       fld := 3
  217.                     end
  218.                   else if fld = maxint then
  219.                       halt
  220.                   else
  221.                       create_files
  222.                 end { 4 }
  223.             end ; { case }
  224.             if fld = maxint then halt
  225.             else if fld < 1 then fld := 1
  226.         until fld > 4 ;
  227.         read_scr
  228.  
  229.     end ; { --- Procedure initialize --- }
  230.  
  231. {---- EOF FILE MINIT.INC ------------------------------------- }
  232.