home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TRIDV230.ZIP / READBBS.DOC < prev    next >
Encoding:
Text File  |  1992-05-25  |  5.0 KB  |  169 lines

  1.  
  2.  
  3.    This is  a copy  of  the readquick() and  readpcb() functions  which are
  4.  incorporated directly into the TriDoor package.  They are supplied  to you
  5.  as a reference for creating your own BBS support functions.
  6.  
  7.    For further  information on  creating  door support  functions, read the
  8.  main TriDoor documentation included with this package.
  9.  
  10.       {* * * * * * * * *}
  11.  
  12.       function readquick : boolean;
  13.  
  14.       { reads a users stats from the file DORINFO1.DEF and returns
  15.         false if there was an error.                               }
  16.  
  17.       var
  18.         deffile : text;
  19.         i,
  20.         loop,
  21.         loop2   : integer;
  22.         comst,
  23.         filler  : string;
  24.         work1,
  25.         work2   : string[40];
  26.  
  27.       begin { readquick }
  28.  
  29.         if fsearch(mainpath+'DORINFO1.DEF','') <> '' then
  30.           begin
  31.             assign(deffile,mainpath+'DORINFO1.DEF');
  32.             reset(deffile);
  33.             for loop := 1 to 4 do
  34.               readln(deffile,filler);
  35.             case filler[4] of
  36.               '0' : stats.comport := 0;
  37.               '1' : stats.comport := COM1;
  38.               '2' : stats.comport := COM2;
  39.               '3' : stats.comport := COM3;
  40.               '4' : stats.comport := COM4;
  41.             end;
  42.             readln(deffile,stats.comstr);
  43.             readln(deffile,filler);
  44.             readln(deffile,work1);
  45.             readln(deffile,work2);
  46.             readln(deffile,filler);
  47.             readln(deffile,i);
  48.             readln(deffile,filler);
  49.             readln(deffile,stats.time);
  50.             close(deffile);
  51.  
  52.             stats.name := work1 + ' ' + work2;
  53.  
  54.             work1 := '';
  55.             loop2 := 0;
  56.             loop := length(stats.comstr);
  57.  
  58.             while (loop2<loop) and (ord(stats.comstr[loop2+1]) <> 32) do
  59.               begin
  60.                 loop2 := loop2 + 1;
  61.                 work1 := work1 + stats.comstr[loop2];
  62.               end;
  63.  
  64.             val(work1,stats.real_baud,loop);
  65.  
  66.             if i = 1 then stats.ansi := TRUE
  67.               else stats.ansi := FALSE;
  68.  
  69.             i := pos('BAUD',stats.comstr);
  70.             i := i + 5;
  71.  
  72.             work1 := copy(stats.comstr,i,1);
  73.             case work1[1] of
  74.                  'N' : stats.comp_parity := NONE;
  75.                  'E' : stats.comp_parity := EVEN;
  76.                  'O' : stats.comp_parity := ODD;
  77.                  'M' : stats.comp_parity := MARK;
  78.                  'S' : stats.comp_parity := SPACE;
  79.             end;
  80.  
  81.             val(copy(stats.comstr,i + 3,1),loop,loop2);
  82.             stats.comp_dbits := loop;
  83.             val(copy(stats.comstr,i + 5,1),loop,loop2);
  84.             stats.comp_sbits := loop;
  85.  
  86.             readquick := true;
  87.           end
  88.         else
  89.           readquick := false;
  90.  
  91.       end;  { readquick }
  92.  
  93.       {* * * * * * * * *}
  94.  
  95.       function readpcb : boolean;
  96.  
  97.       { This function will get all crucial information from the PCBoard     }
  98.       { PCBOARD.SYS file, directed to by <mainpath>.                        }
  99.  
  100.       var
  101.         deffile : file of pcbreaderrec;
  102.         defrec  : pcbreaderrec;
  103.         err     : integer;
  104.         tempstr : string;
  105.  
  106.       begin { readpcb }
  107.  
  108.         if fsearch( mainpath+'PCBOARD.SYS', '' ) <> '' then
  109.           begin
  110.  
  111.             assign( deffile, mainpath+'PCBOARD.SYS' );
  112.             reset( deffile );
  113.             read( deffile, defrec );
  114.             close( deffile );
  115.  
  116.             if (pos('  ',defrec.name) > 0) then
  117.               stats.name := copy(defrec.name,1,pos('  ',defrec.name)-1)
  118.             else stats.name := defrec.name;
  119.  
  120.             tempstr := copy(defrec.baud,1,5);
  121.  
  122.             if (pos(' ',tempstr) > 0) then
  123.               tempstr := copy( tempstr, 1, pos(' ',tempstr)-1);
  124.  
  125.             val(tempstr,stats.lock_baud,err);
  126.  
  127.             tempstr := copy(defrec.baud,6,5);
  128.  
  129.             if (pos(' ',tempstr) > 0) then
  130.               tempstr := copy( tempstr, 1, pos(' ',tempstr)-1);
  131.  
  132.             if ucase(tempstr) = 'LOCAL' then
  133.               begin
  134.                 stats.real_baud := 0;
  135.                 stats.lock_baud := 0;
  136.                 local := TRUE;
  137.               end
  138.             else val(tempstr,stats.real_baud,err);
  139.  
  140.             stats.time := defrec.time;
  141.  
  142.             case defrec.comport of
  143.               '0' : stats.comport := 0;
  144.               '1' : stats.comport := COM1;
  145.               '2' : stats.comport := COM2;
  146.               '3' : stats.comport := COM3;
  147.               '4' : stats.comport := COM4;
  148.             end;
  149.  
  150.             if (stats.lock_baud > 0) then
  151.               stats.comstr := strg(stats.lock_baud)+',N,8,1'
  152.             else stats.comstr := strg(stats.real_baud)+'N,8,1';
  153.  
  154.             if (defrec.ansi = 1) then stats.ansi := TRUE
  155.               else stats.ansi := FALSE;
  156.  
  157.             stats.comp_parity := NONE;
  158.             stats.comp_sbits := 1;
  159.             stats.comp_dbits := 8;
  160.  
  161.             readpcb := true;
  162.           end
  163.         else
  164.           readpcb := false;
  165.  
  166.       end;  { readpcb }
  167.  
  168.       {* * * * * * * * *}
  169.