home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 276.img / FORUM21S.ZIP / CNVT210.SUP < prev    next >
Text File  |  1988-03-27  |  20KB  |  803 lines

  1. {$R-,S+,I+,D+,T-,F-,V-,B-,N-,L-}
  2. {$M 7000,0,0 }
  3.  
  4. { $define checkmode}  {***** CLOSE THIS TO SEE WHAT CHANGED *****}
  5.  
  6. program convert;
  7.  
  8. uses crt,gentypes,configrt,gensubs,statret;
  9.  
  10. {$I c:\forum20e\gentypes} {***** SPECIFY GENTYPES FROM OLD VERSION HERE *****}
  11.  
  12. {$ifdef checkmode}
  13.  
  14. procedure check (s1,s2:integer; t:string; done:boolean);
  15. var x:integer;
  16. const rows:array [1..4] of integer=(3,3,3,3);
  17.       cols:array [1..4] of integer=(1,21,41,61);
  18. begin
  19.   if s1<>s2
  20.     then if done
  21.       then x:=2
  22.       else x:=1
  23.     else if done
  24.       then x:=4
  25.       else x:=3;
  26.   gotoxy (cols[x],rows[x]);
  27.   write (t);
  28.   inc(rows[x])
  29. end;
  30.  
  31. begin
  32.   clrscr;
  33.   writeln ('Needs fixing        Fixed               Unchanged           Unchanged/converted');
  34.   check (sizeof(udrec),sizeof(gentypes.udrec),'udrec',true);
  35.   check (sizeof(userrec),sizeof(gentypes.userrec),'userrec',true);
  36.   check (sizeof(boardrec),sizeof(gentypes.boardrec),'boardrec',true);
  37.   check (sizeof(bulrec),sizeof(gentypes.bulrec),'bulrec',true);
  38.   check (sizeof(filerec),sizeof(gentypes.filerec),'filerec',true);
  39.   check (sizeof(mailrec),sizeof(gentypes.mailrec),'mailrec/feedback',true);
  40.   check (sizeof(abrec),sizeof(gentypes.abrec),'abrec',false);
  41. { check (sizeof(catalogrec),sizeof(gentypes.catalogrec),'catalogrec',false); }
  42.   check (sizeof(grouprec),sizeof(gentypes.grouprec),'grouprec',false);
  43.   check (sizeof(topicrec),sizeof(gentypes.topicrec),'topicrec',false);
  44.   check (sizeof(choicerec),sizeof(gentypes.choicerec),'choicerec',false);
  45.   check (sizeof(lastrec),sizeof(gentypes.lastrec),'lastrec',true);
  46.   check (sizeof(baserec),sizeof(gentypes.baserec),'baserec',true);
  47.   check (sizeof(entryrec),sizeof(gentypes.entryrec),'entryrec',true);
  48.   check (sizeof(arearec),sizeof(gentypes.arearec),'arearec',true);
  49.   check (sizeof(doorrec),sizeof(gentypes.doorrec),'doorrec',false);
  50.   check (sizeof(logrec),sizeof(gentypes.logrec),'logrec',true);
  51.   check (sizeof(syslogdatrec),sizeof(gentypes.syslogdatrec),'syslogdatrec',false)
  52.  
  53. {$else}
  54.  
  55. var windowx1,windowy1,windowx2,windowy2,scrnwidth,midpoint:integer;
  56.     when,shoulderase:boolean;
  57.  
  58. procedure killfile (newname:string);
  59. var f2:file;
  60.     x:integer;
  61. begin
  62.   assign (f2,newname);
  63.   {$I-} erase (f2); {$I+}
  64.   x:=ioresult
  65. end;
  66.  
  67. procedure window (x1,y1,x2,y2:integer);
  68. begin
  69.   windowx1:=x1;
  70.   windowy1:=y1;
  71.   windowx2:=x2;
  72.   windowy2:=y2;
  73.   scrnwidth:=x2-x1+1;
  74.   midpoint:=scrnwidth div 2;
  75.   crt.window (x1,y1,x2,y2)
  76. end;
  77.  
  78. procedure center (y:integer; l:string);
  79. begin
  80.   gotoxy (1,y);
  81.   clreol;
  82.   gotoxy (midpoint-length(l) div 2,y);
  83.   write (l)
  84. end;
  85.  
  86. procedure returntodos;
  87. begin
  88.   window (1,1,80,25);
  89.   textcolor (6);
  90.   textbackground (0);
  91.   gotoxy (1,25);
  92.   clreol;
  93.   gotoxy (1,24);
  94.   clreol;
  95.   halt
  96. end;
  97.  
  98. procedure topmessage (x:string; printalso:boolean);
  99. var xx,yy:integer;
  100. begin
  101.   xx:=wherex;
  102.   yy:=wherey;
  103.   window (1,1,80,25);
  104.   gotoxy (1,6);
  105.   textcolor (15);
  106.   textbackground (1);
  107.   clreol;
  108.   window (3,1,78,25);
  109.   textcolor (14);
  110.   textbackground (0);
  111.   center (4,x);
  112.   window (3,8,78,21);
  113.   gotoxy (xx,yy);
  114.   textcolor (6);
  115.   textbackground (0);
  116.   if printalso then writeln (^M^J,x,^M^J);
  117. end;
  118.  
  119. procedure divider;
  120. begin
  121.   writeln;
  122.   writeln ('────────────────────────────────────────────────────────────────────────────');
  123. end;
  124.  
  125. procedure init;
  126. var cnt:integer;
  127. begin
  128.   checksnow:=true;
  129.   textmode (bw80);
  130.   textcolor (15);
  131.   textbackground (1);
  132.   window (1,1,80,25);
  133.   for cnt:=1 to 46 do begin
  134.     gotoxy (1,cnt div 2);
  135.     write (' ');
  136.     gotoxy (80,cnt div 2);
  137.     write (' ');
  138.     gotoxy (cnt,1);
  139.     write ('  ');
  140.     gotoxy (79-cnt,1);
  141.     write ('  ');
  142.     gotoxy (cnt,23);
  143.     write ('  ');
  144.     gotoxy (79-cnt,23);
  145.     write ('  ');
  146.     if odd(cnt)
  147.       then gotoxy (39+cnt div 2,12)
  148.       else gotoxy (40-cnt div 2,12);
  149.     delay (10)
  150.   end;
  151.   center (1,'Forum-PC Conversion Program');
  152.   center (2,versionnum+' to '+gentypes.versionnum);
  153.   window (3,4,78,21);
  154.   gotoxy (1,1);
  155.   textcolor (6);
  156.   textbackground (0);
  157.   topmessage ('',false);
  158.   clrscr
  159. end;
  160.  
  161.  
  162. procedure ensureconfigexists;
  163. var f:file;
  164. begin
  165.   topmessage ('Searching for CONFIG.BBS',false);
  166.   assign (f,'config.bbs');
  167.   {$I-} reset (f); {$I+}
  168.   if ioresult<>0 then begin
  169.     writeln ('Sorry!  I can''t seem to locate your CONFIG.BBS file.');
  170.     writeln ('This means that either:');
  171.     writeln ('  1. You aren''t running CONVERT from your Forum-PC directory');
  172.     writeln ('  2. You haven''t been using an old version and you don''t need to convert');
  173.     writeln;
  174.     writeln ('If you have been running an old version, please change to your Forum-PC');
  175.     writeln ('directory and run this program again.');
  176.     writeln;
  177.     writeln ('If you haven''t been using an old version, then you don''t need this program!');
  178.     returntodos
  179.   end;
  180.   close (f)
  181. end;
  182.  
  183. procedure readconfig;        { Shouldn't check version code }
  184. var q:file of configrt.configsettype;
  185. begin
  186.   topmessage ('Reading CONFIG.BBS',false);
  187.   assign (q,'Config.BBS');
  188.   reset (q);
  189.   read (q,configset);
  190.   close (q)
  191. end;
  192.  
  193. procedure writeconfig;
  194. var q:file of configrt.configsettype;
  195. begin
  196.   assign (q,'Config.BBS');
  197.   rewrite (q);
  198.   write (q,configset);
  199.   close (q)
  200. end;
  201.  
  202. procedure ensurenotsecondtime;
  203. begin
  204.   if versioncode=gentypes.thisversioncode then begin
  205.     topmessage ('WARNING!  You may have already converted',false);
  206.     writeln ('It appears that you may have already converted.');
  207.     writeln ('It is important that you do not try to convert twice!');
  208.     writeln;
  209.     write ('Are you sure you wish to convert [y/n]: ');
  210.     if upcase(readkey)='Y'
  211.       then writeln ('Yes')
  212.       else returntodos
  213.   end;
  214.   divider
  215. end;
  216.  
  217. procedure shouldierase;
  218. var k:char;
  219. begin
  220.   topmessage ('Keep old disk files?',false);
  221.   writeln ('In the conversion process, I ordinarily simply remove the old versions');
  222.   writeln ('of Forum''s various data files.  However, if you wish, I will keep the old');
  223.   writeln ('data files, with an extension of ".OLD".');
  224.   writeln;
  225.   write ('Should I KEEP the old data files [y/n]: ');
  226.   repeat
  227.     k:=upcase(readkey)
  228.   until k in ['Y','N'];
  229.   shoulderase:=k='N';
  230.   if shoulderase
  231.     then write ('No, erase')
  232.     else write ('Yes, keep');
  233.   writeln (' old disk files');
  234.   divider
  235. end;
  236.  
  237. function convertdati (da,ti:sstr):longint;
  238. begin
  239.   convertdati:=dateval(da)+timeval(ti)
  240. end;
  241.  
  242. procedure convertfilexfer;
  243.  
  244.   procedure convertarearec (var oa:arearec; var a:gentypes.arearec);
  245.   begin
  246.     with a do begin
  247.       name:=oa.name;
  248.       xmodemdir:=oa.xmodemdir;
  249.       sponsor:=oa.sponsor;
  250.       level:=oa.level
  251.     end
  252.   end;
  253.  
  254.   procedure convertudrec (var o:udrec; var u:gentypes.udrec);
  255.   begin
  256.     u.sentby:=o.sentby;
  257.     u.when:=convertdati(o.sentda,o.sentti);
  258.     u.whenrated:=u.when;
  259.     u.sentby:=o.sentby;
  260.     u.filename:=o.filename;
  261.     u.path:=o.path;
  262.     u.points:=o.points;
  263.     if (o.filesize<maxlongint) and (o.filesize>0)
  264.       then u.filesize:=round(o.filesize)
  265.       else u.filesize:=-1;
  266.     u.descrip:=o.descrip;
  267.     u.downloaded:=o.downloaded;
  268.     u.newfile:=ord(o.newfile)<>0;
  269.     u.specialfile:=ord(o.specialfile)<>0
  270.   end;
  271.  
  272. var oa:arearec;
  273.     ou:udrec;
  274.     a:gentypes.arearec;
  275.     u:gentypes.udrec;
  276.     oaf:file of arearec;
  277.     ouf:file of udrec;
  278.     af:file of gentypes.arearec;
  279.     uf:file of gentypes.udrec;
  280.     k:char;
  281.     anum:integer;
  282. begin
  283.   writeln ('NO! I REFUSE to do this.');
  284.   halt;
  285.   topmessage ('Converting file transfer section',true);
  286.   assign (oaf,'areadir');
  287.   killfile ('areadir.old');
  288.   {$I-} rename (oaf,'areadir.old'); {$I+}
  289.   if ioresult<>0 then begin
  290.     writeln ('I can''t locate a file transfer section!');
  291.     writeln ('Press any key to continue...');
  292.     k:=readkey;
  293.     divider;
  294.     exit
  295.   end;
  296.   reset (oaf);
  297.   assign (af,'areadir');
  298.   rewrite (af);
  299.   writeln ('Filesize = ',filesize(oaf));
  300.   for anum:=1 to filesize(oaf) do begin
  301.     seek (oaf,anum-1);
  302.     read (oaf,oa);
  303.     convertarearec (oa,a);
  304.     write (af,a);
  305.     writeln ('        Converting area ',anum,': ',a.name);
  306.     assign (ouf,'area'+strr(anum));
  307.     killfile ('area'+strr(anum)+'.old');
  308.     {$I-} rename (ouf,'area'+strr(anum)+'.old'); {$I+}
  309.     if ioresult<>0
  310.       then writeln ('  ****  Unable to access file AREA',anum)
  311.       else begin
  312.         assign (uf,'area'+strr(anum));
  313.         rewrite (uf);
  314.         reset (ouf);
  315.         while not eof(ouf) do begin
  316.           read (ouf,ou);
  317.           convertudrec (ou,u);
  318.           write (uf,u)
  319.         end;
  320.         close (uf);
  321.         close (ouf);
  322.         if shoulderase then erase (ouf)
  323.       end
  324.   end;
  325.   close (af);
  326.   close (oaf);
  327.   if shoulderase then erase(oaf);
  328.   divider
  329. end;
  330.  
  331. procedure convertuserfile;
  332.  
  333.   procedure convertuserrec (var ou:userrec; var u:gentypes.userrec);
  334.   begin
  335.     with u do begin
  336.       handle:=ou.handle;
  337.       password:=ou.password;
  338.       phonenum:=ou.phonenum;
  339.       laston:=convertdati(ou.londa,ou.lonti);
  340.       numon:=ou.numon;
  341.       timetoday:=ou.timetoday;
  342.       nup:=ou.nup;
  343.       ndn:=ou.ndn;
  344.       nbu:=ou.nbu;
  345.       uploads:=ou.uploads;
  346.       downloads:=ou.downloads;
  347.       totaltime:=ou.totaltime;
  348.       voted:=gentypes.voteset(ou.voted);
  349.       udlevel:=ou.udlevel;
  350.       udpoints:=ou.udpoints;
  351.       level:=ou.level;
  352.       emailannounce:=ou.emailannounce;
  353.       beepedpwd:=ou.beepedpwd;
  354.       infoform:=ou.infoform;
  355.       regularcolor:=ou.regularcolor;
  356.       promptcolor:=ou.promptcolor;
  357.       statcolor:=ou.statcolor;
  358.       inputcolor:=ou.inputcolor;
  359.       displaylen:=ou.displaylen;
  360.       config:=ou.config;
  361.       newscanconfig:=ou.newscanconfig;
  362.       access1:=ou.access1;
  363.       access2:=ou.access2;
  364.       fillchar (lastread,sizeof(lastread),0)
  365.     end
  366.   end;
  367.  
  368. var uf:file of gentypes.userrec;
  369.     ouf:file of userrec;
  370.     ou:userrec;
  371.     u:gentypes.userrec;
  372.     k:char;
  373.     cnt:integer;
  374. begin
  375.   topmessage ('Converting user list',true);
  376.   assign (ouf,'users');
  377.   killfile ('users.old');
  378.   {$I-} rename (ouf,'users.old'); {$I+}
  379.   if ioresult<>0 then begin
  380.     writeln ('I can''t find the user list!');
  381.     writeln ('Press any key to continue...');
  382.     k:=readkey;
  383.     divider;
  384.     exit
  385.   end;
  386.   reset (ouf);
  387.   assign (uf,'users');
  388.   rewrite (uf);
  389.   cnt:=0;
  390.   while not eof(ouf) do begin
  391.     read (ouf,ou);
  392.     convertuserrec (ou,u);
  393.     write (uf,u);
  394.     cnt:=cnt+1;
  395.     if (cnt mod 10)=0 then write (cnt,'... ')
  396.   end;
  397.   writeln ('Done!');
  398.   close (uf);
  399.   close (ouf);
  400.   if shoulderase then erase (ouf);
  401.   divider
  402. end;
  403.  
  404. procedure convertconfig;
  405. var f:file;
  406.     k:char;
  407. begin
  408.   topmessage ('Converting configuration',true);
  409.   assign (f,'config.bbs');
  410.   killfile ('config.old');
  411.   {$I-} rename (f,'config.old'); {$I+}
  412.   if ioresult<>0 then begin
  413.     writeln ('This can''t happen!  I can''t find the configuration file!');
  414.     writeln ('Press any key to continue...');
  415.     k:=readkey;
  416.     divider;
  417.     exit
  418.   end;
  419.   versioncode:=gentypes.thisversioncode;
  420.   directvideo:=true;
  421.   checksnowmode:=true;
  422.   hashayes:=false;
  423.   writeconfig;
  424.   if shoulderase then erase(f);
  425.   divider
  426. end;
  427.  
  428. procedure convertbulletins;
  429. var counter:word;
  430.  
  431.   procedure convertboardrec (var obd:boardrec; var bd:gentypes.boardrec);
  432.   begin
  433.     with bd do begin
  434.       boardname:=obd.boardname;
  435.       sponsor:=obd.sponsor;
  436.       level:=obd.level;
  437.       autodel:=obd.autodel;
  438.       shortname:=obd.shortname
  439.     end
  440.   end;
  441.  
  442.   procedure convertbulrec (var ob:bulrec; var b:gentypes.bulrec);
  443.   begin
  444.     counter:=counter+1;
  445.     with b do begin
  446.       title:=ob.title;
  447.       leftby:=ob.leftby;
  448.       when:=convertdati(ob.leftda,ob.leftti);
  449.       anon:=ob.anon;
  450.       line:=ob.line;
  451.       plevel:=ob.plevel;
  452.       id:=counter
  453.     end
  454.   end;
  455.  
  456.   procedure convertfilerec (var oof:filerec; var f:gentypes.filerec);
  457.   begin
  458.     with f do begin
  459.       descrip:=oof.descrip;
  460.       fname:=oof.fname;
  461.       sentby:=oof.sentby;
  462.       when:=convertdati(oof.sentda,oof.sentti);
  463.       downloaded:=oof.downloaded;
  464.     end
  465.   end;
  466.  
  467. var bf:file of gentypes.bulrec;
  468.     obf:file of bulrec;
  469.     ff:file of gentypes.filerec;
  470.     off:file of filerec;
  471.     bdf:file of gentypes.boardrec;
  472.     obdf:file of boardrec;
  473.     b:gentypes.bulrec;
  474.     ob:bulrec;
  475.     f:gentypes.filerec;
  476.     oof:filerec;
  477.     bd:gentypes.boardrec;
  478.     obd:boardrec;
  479.     k:char;
  480.     cbprefix:lstr;
  481. begin
  482.   topmessage ('Converting bulletin section',true);
  483.   assign (obdf,boarddir+'boarddir');
  484.   killfile (boarddir+'boarddir.old');
  485.   {$I-} rename (obdf,boarddir+'boarddir.old'); {$I+}
  486.   if ioresult<>0 then begin
  487.     writeln ('I can''t find the bulletin section! (',boarddir,'BOARDDIR)');
  488.     writeln ('Press any key to continue...');
  489.     k:=readkey;
  490.     divider;
  491.     exit
  492.   end;
  493.   reset (obdf);
  494.   assign (bdf,boarddir+'boarddir');
  495.   rewrite (bdf);
  496.   while not eof(obdf) do begin
  497.     read (obdf,obd);
  498.     convertboardrec (obd,bd);
  499.     write (bdf,bd);
  500.     writeln ('        Converting ',bd.boardname,' [',bd.shortname,']');
  501.     writeln ('                   bulletins');
  502.     cbprefix:=boarddir+bd.shortname+'.';
  503.     assign (obf,cbprefix+'bul');
  504.     killfile (cbprefix+'obu');
  505.     {$I-} rename (obf,cbprefix+'obu'); {$I+}
  506.     if ioresult<>0
  507.       then writeln ('  ****  Unable to access file ',cbprefix,'BUL')
  508.       else begin
  509.         reset (obf);
  510.         assign (bf,cbprefix+'bul');
  511.         rewrite (bf);
  512.         counter:=0;
  513.         while not eof(obf) do begin
  514.           read (obf,ob);
  515.           convertbulrec (ob,b);
  516.           write (bf,b)
  517.         end;
  518.         close (bf);
  519.         close (obf);
  520.         if shoulderase then erase (obf)
  521.       end;
  522.     writeln ('                   text files');
  523.     assign (off,cbprefix+'fil');
  524.     killfile (cbprefix+'ofi');
  525.     {$I-} rename (off,cbprefix+'ofi'); {$I+}
  526.     if ioresult<>0
  527.       then writeln ('  ****  Unable to access file ',cbprefix,'FIL')
  528.       else begin
  529.         reset (off);
  530.         assign (ff,cbprefix+'fil');
  531.         rewrite (ff);
  532.         while not eof(off) do begin
  533.           read (off,oof);
  534.           convertfilerec (oof,f);
  535.           write (ff,f)
  536.         end;
  537.         close (ff);
  538.         close (off);
  539.         if shoulderase then erase (off)
  540.       end
  541.   end;
  542.   close (bdf);
  543.   close (obdf);
  544.   if shoulderase then erase (obdf);
  545.   divider
  546. end;
  547.  
  548. procedure convertmailgeneral (secname,fname:string);
  549.  
  550.   procedure convertmailrec (var om:mailrec; var m:gentypes.mailrec);
  551.   begin
  552.     with m do begin
  553.       title:=om.title;
  554.       sentby:=om.sentby;
  555.       when:=convertdati(om.sentda,om.sentti);
  556.       anon:=om.anon;
  557.       read:=om.read;
  558.       sentto:=om.sentto;
  559.       line:=om.line;
  560.       fileindex:=om.fileindex
  561.     end
  562.   end;
  563.  
  564. var omf:file of mailrec;
  565.     mf:file of gentypes.mailrec;
  566.     om:mailrec;
  567.     m:gentypes.mailrec;
  568.     k:char;
  569.     cnt:integer;
  570. begin
  571.   topmessage ('Converting '+secname,true);
  572.   assign (omf,fname);
  573.   killfile (fname+'.old');
  574.   {$I-} rename (omf,fname+'.old'); {$I+}
  575.   if ioresult<>0 then begin
  576.     writeln ('I can''t find the '+secname+' file!');
  577.     writeln ('Press any key to continue...');
  578.     k:=readkey;
  579.     divider;
  580.     exit
  581.   end;
  582.   reset (omf);
  583.   assign (mf,fname);
  584.   rewrite (mf);
  585.   cnt:=0;
  586.   while not eof(omf) do begin
  587.     {$I-} read (omf,om); {$I+}
  588.     if ioresult=0 then begin
  589.       convertmailrec (om,m);
  590.       write (mf,m);
  591.       cnt:=cnt+1;
  592.       if (cnt mod 10)=0 then write (cnt,'... ')
  593.     end
  594.   end;
  595.   close (mf);
  596.   close (omf);
  597.   if shoulderase then erase (omf);
  598.   divider
  599. end;
  600.  
  601. procedure convertemail;
  602. begin
  603.   convertmailgeneral ('electronic mail','mail')
  604. end;
  605.  
  606. procedure convertfeedback;
  607. begin
  608.   convertmailgeneral ('feedback','feedback')
  609. end;
  610.  
  611. procedure convertdatabase;
  612.  
  613.   procedure convertbaserec (var ob:baserec; var b:gentypes.baserec);
  614.   begin
  615.     if sizeof(ob)=sizeof(b)
  616.       then move(ob,b,sizeof(ob))
  617.       else begin
  618.         writeln ('ARGH, gentypes.baserec has changed size!');
  619.         halt
  620.       end
  621.   end;
  622.  
  623.   procedure convertentryrec (var oe:entryrec; var e:gentypes.entryrec);
  624.   begin
  625.     e.data:=oe.data;
  626.     e.when:=convertdati(oe.eda,oe.eti);
  627.     e.addedby:=oe.addedby
  628.   end;
  629.  
  630. var ob:baserec;
  631.     oe:entryrec;
  632.     b:gentypes.baserec;
  633.     e:gentypes.entryrec;
  634.     obf:file of baserec;
  635.     oef:file of entryrec;
  636.     bf:file of gentypes.baserec;
  637.     ef:file of gentypes.entryrec;
  638.     k:char;
  639.     bnum:integer;
  640. begin
  641.   topmessage ('Converting database section',true);
  642.   assign (obf,'datadir');
  643.   killfile ('datadir.old');
  644.   {$I-} rename (obf,'datadir.old'); {$I+}
  645.   if ioresult<>0 then begin
  646.     writeln ('I can''t locate the database section!');
  647.     writeln ('Press any key to continue...');
  648.     k:=readkey;
  649.     divider;
  650.     exit
  651.   end;
  652.   reset (obf);
  653.   assign (bf,'datadir');
  654.   rewrite (bf);
  655.   for bnum:=1 to filesize(obf) do begin
  656.     seek (obf,bnum-1);
  657.     read (obf,ob);
  658.     convertbaserec (ob,b);
  659.     write (bf,b);
  660.     writeln ('        Converting database ',bnum,': ',b.basename);
  661.     assign (oef,'database.'+strr(bnum));
  662.     killfile ('data'+strr(bnum)+'.old');
  663.     {$I-} rename (oef,'data'+strr(bnum)+'.old'); {$I+}
  664.     if ioresult<>0
  665.       then writeln ('  ****  Unable to access file DATABASE.',bnum)
  666.       else begin
  667.         assign (ef,'database.'+strr(bnum));
  668.         rewrite (ef);
  669.         reset (oef);
  670.         while not eof(oef) do begin
  671.           read (oef,oe);
  672.           convertentryrec (oe,e);
  673.           write (ef,e)
  674.         end;
  675.         close (ef);
  676.         close (oef);
  677.         if shoulderase then erase (oef)
  678.       end
  679.   end;
  680.   close (bf);
  681.   close (obf);
  682.   if shoulderase then erase(obf);
  683.   divider
  684. end;
  685.  
  686. procedure convertlastcallers;
  687. var cnum:integer;
  688.  
  689.   procedure convertlastrec (var ol:lastrec; var l:gentypes.lastrec);
  690.   begin
  691.     l.name:=ol.name;
  692.     l.when:=convertdati(ol.da,ol.ti);
  693.     l.callnum:=round(numcallers)-maxlastcallers+cnum
  694.   end;
  695.  
  696. var ol:lastrec;
  697.     l:gentypes.lastrec;
  698.     olf:file of lastrec;
  699.     lf:file of gentypes.lastrec;
  700.     k:char;
  701. begin
  702.   topmessage ('Converting list of recent callers',true);
  703.   assign (olf,'callers');
  704.   killfile ('callers.old');
  705.   {$I-} rename (olf,'callers.old'); {$I+}
  706.   if ioresult<>0 then begin
  707.     writeln ('I can''t find the recent caller file!');
  708.     writeln ('Press any key to continue...');
  709.     k:=readkey;
  710.     divider;
  711.     exit
  712.   end;
  713.   reset (olf);
  714.   assign (lf,'callers');
  715.   rewrite (lf);
  716.   cnum:=0;
  717.   while not eof(olf) do begin
  718.     cnum:=cnum+1;
  719.     read (olf,ol);
  720.     convertlastrec (ol,l);
  721.     write (lf,l)
  722.   end;
  723.   close (lf);
  724.   close (olf);
  725.   if shoulderase then erase (olf);
  726.   divider
  727. end;
  728.  
  729. procedure convertsystemlog;
  730.  
  731.   procedure convertlogrec (var ol:logrec; var l:gentypes.logrec);
  732.   begin
  733.     l.menu:=ol.menu;
  734.     l.subcommand:=ol.subcommand;
  735.     l.param:=ol.param;
  736.     l.when:=convertdati(ol.date,ol.time)
  737.   end;
  738.  
  739. var ol:logrec;
  740.     l:gentypes.logrec;
  741.     olf:file of logrec;
  742.     lf:file of gentypes.logrec;
  743.     k:char;
  744.     lnum:integer;
  745. begin
  746.   topmessage ('Converting system log',true);
  747.   assign (olf,'syslog');
  748.   killfile ('syslog.old');
  749.   {$I-} rename (olf,'syslog.old'); {$I+}
  750.   if ioresult<>0 then begin
  751.     writeln ('I can''t find the system log!');
  752.     writeln ('Press any key to continue...');
  753.     k:=readkey;
  754.     divider;
  755.     exit
  756.   end;
  757.   reset (olf);
  758.   assign (lf,'syslog');
  759.   rewrite (lf);
  760.   lnum:=0;
  761.   while not eof(olf) do begin
  762.     read (olf,ol);
  763.     convertlogrec (ol,l);
  764.     write (lf,l);
  765.     lnum:=lnum+1;
  766.     if (lnum mod 10)=0 then write (lnum,'... ')
  767.   end;
  768.   writeln ('Done!');
  769.   close (lf);
  770.   close (olf);
  771.   if shoulderase then erase (olf);
  772.   divider
  773. end;
  774.  
  775. procedure alldone;
  776. begin
  777.   topmessage ('Conversion is complete!',true);
  778.   writeln ('You should now be able to run ',gentypes.versionnum,'.');
  779.   returntodos
  780. end;
  781.  
  782. begin
  783.   init;
  784.   ensureconfigexists;
  785.   readconfig;
  786.   readstatus;
  787.   ensurenotsecondtime;
  788.   shouldierase;
  789.   convertfeedback;
  790.   convertconfig;
  791.   convertbulletins;
  792.   convertdatabase;
  793.   convertemail;
  794.   convertfilexfer;
  795.   convertlastcallers;
  796.   convertsystemlog;
  797.   convertuserfile;
  798.   alldone
  799.  
  800. {$endif}
  801.  
  802. end.
  803.