home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 276.img / FORUM21S.ZIP / BULLETIN.PAS < prev    next >
Pascal/Delphi Source File  |  1988-02-13  |  37KB  |  1,554 lines

  1. {$R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ }
  2. {$M 65500,0,0 }
  3.  
  4. unit bulletin;
  5.  
  6. interface
  7.  
  8. uses crt,
  9.      gentypes,configrt,statret,gensubs,subs1,subs2,
  10.      userret,textret,mainr1,mainr2,overret1,flags;
  11.  
  12. procedure bulletinmenu;
  13.  
  14. implementation
  15.  
  16. procedure bulletinmenu;
  17. var q,curbul,lastreadnum:integer;
  18.     b:bulrec;
  19.  
  20.   procedure makeboard; forward;
  21.  
  22.   function sponsoron:boolean;
  23.   begin
  24.     sponsoron:=match(curboard.sponsor,unam)
  25.   end;
  26.  
  27.   procedure clearorder (var bo:boardorder);
  28.   var cnt:integer;
  29.   begin
  30.     for cnt:=0 to 255 do bo[cnt]:=cnt
  31.   end;
  32.  
  33.   procedure carryout (var bo:boardorder);
  34.   var u:userrec;
  35.       cnt,un:integer;
  36.  
  37.     procedure doone;
  38.     var cnt,q:integer;
  39.         ns,a1,a2:set of byte;
  40.     begin
  41.       fillchar (ns,32,0);
  42.       fillchar (a1,32,0);
  43.       fillchar (a2,32,0);
  44.       for cnt:=0 to 255 do begin
  45.         q:=bo[cnt];
  46.         if q in u.newscanconfig then ns:=ns+[cnt];
  47.         if q in u.access1 then a1:=a1+[cnt];
  48.         if q in u.access2 then a2:=a2+[cnt]
  49.       end;
  50.       u.newscanconfig:=ns;
  51.       u.access1:=a1;
  52.       u.access2:=a2;
  53.       seek (ufile,un);
  54.       write (ufile,u)
  55.     end;
  56.  
  57.   begin
  58.     writeln (^B'Adjusting user access flags...');
  59.     seek (ufile,1);
  60.     for un:=1 to numusers do begin
  61.       if (un mod 10)=0 then write (' ',un);
  62.       read (ufile,u);
  63.       if length(u.handle)>0 then doone
  64.     end
  65.   end;
  66.  
  67.   procedure switchboards (bnum1,bnum2:integer; var bo:boardorder);
  68.   var bd1,bd2:boardrec;
  69.       n1:integer;
  70.   begin
  71.     seekbdfile (bnum1);
  72.     read (bdfile,bd1);
  73.     seekbdfile (bnum2);
  74.     read (bdfile,bd2);
  75.     seekbdfile (bnum1);
  76.     writebdfile (bd2);
  77.     seekbdfile (bnum2);
  78.     writebdfile (bd1);
  79.     n1:=bo[bnum1];
  80.     bo[bnum1]:=bo[bnum2];
  81.     bo[bnum2]:=n1
  82.   end;
  83.  
  84.   procedure setfirstboard; forward;
  85.  
  86.   procedure seekffile (n:integer);
  87.   begin
  88.     seek (ffile,n-1)
  89.   end;
  90.  
  91.   function numfiles:integer;
  92.   begin
  93.     numfiles:=filesize (ffile)
  94.   end;
  95.  
  96.   procedure assignffile;
  97.   begin
  98.     assign (ffile,boarddir+curboardname+'.FIL')
  99.   end;
  100.  
  101.   procedure formatffile;
  102.   begin
  103.     close (ffile);
  104.     assignffile;
  105.     rewrite (ffile)
  106.   end;
  107.  
  108.   procedure openffile;
  109.   var f:filerec;
  110.       i:integer;
  111.   begin
  112.     close (ffile);
  113.     assignffile;
  114.     reset (ffile);
  115.     i:=ioresult;
  116.     if i<>0 then formatffile
  117.   end;
  118.  
  119.   procedure addfile (f:filerec);
  120.   begin
  121.     seekffile (numfiles+1);
  122.     write (ffile,f)
  123.   end;
  124.  
  125.   procedure delfile (fn:integer);
  126.   var f:filerec;
  127.       cnt:integer;
  128.   begin
  129.     for cnt:=fn to numfiles-1 do begin
  130.       seekffile (cnt+1);
  131.       read (ffile,f);
  132.       seekffile (cnt);
  133.       write (ffile,f)
  134.     end;
  135.     seekffile (numfiles);
  136.     truncate (ffile)
  137.   end;
  138.  
  139.   procedure seekbfile (n:integer);
  140.   begin
  141.     seek (bfile,n-1); che
  142.   end;
  143.  
  144.   function numbuls:integer;
  145.   begin
  146.     numbuls:=filesize(bfile)
  147.   end;
  148.  
  149.   procedure getlastreadnum;
  150.   var oldb:boolean;
  151.       b:bulrec;
  152.       lr:word;
  153.   begin
  154.     lastreadnum:=numbuls;
  155.     oldb:=false;
  156.     lr:=urec.lastread[curboardnum];
  157.     if lr=0
  158.       then lastreadnum:=0
  159.       else
  160.         while (lastreadnum>0) and (not oldb) do begin
  161.           seekbfile (lastreadnum);
  162.           read (bfile,b);
  163.           oldb:=b.id=lr;
  164.           if not oldb then lastreadnum:=lastreadnum-1
  165.         end
  166.   end;
  167.  
  168.   procedure assignbfile;
  169.   begin
  170.     assign (bfile,boarddir+curboardname+'.BUL')
  171.   end;
  172.  
  173.   procedure formatbfile;
  174.   begin
  175.     assignbfile;
  176.     rewrite (bfile);
  177.     curboardnum:=searchboard(curboardname);
  178.     if curboardnum=-1 then begin
  179.       curboardnum:=filesize(bdfile);
  180.       fillchar (curboard,sizeof(curboard),0);
  181.       writecurboard
  182.     end
  183.   end;
  184.  
  185.   procedure openbfile;
  186.   var b:bulrec;
  187.       i:integer;
  188.   begin
  189.     curboardnum:=searchboard (curboardname);
  190.     if curboardnum=-1 then begin
  191.       makeboard;
  192.       exit
  193.     end;
  194.     close (bfile);
  195.     assignbfile;
  196.     reset (bfile);
  197.     i:=ioresult;
  198.     if ioresult<>0 then formatbfile;
  199.     seekbdfile (curboardnum);
  200.     read (bdfile,curboard);
  201.     getlastreadnum;
  202.     openffile
  203.   end;
  204.  
  205.   function boardexist(n:sstr):boolean;
  206.   begin
  207.     boardexist:=not (searchboard(n)=-1)
  208.   end;
  209.  
  210.   procedure addbul (var b:bulrec);
  211.   var b2:bulrec;
  212.   begin
  213.     if numbuls=0 then b.id:=1 else begin
  214.       seekbfile (numbuls);
  215.       read (bfile,b2);
  216.       if b2.id=65535
  217.         then b.id:=1
  218.         else b.id:=b2.id+1
  219.     end;
  220.     seekbfile (numbuls+1);
  221.     write (bfile,b)
  222.   end;
  223.  
  224.   function checkcurbul:boolean;
  225.   begin
  226.     if (curbul<1) or (curbul>numbuls) then begin
  227.       checkcurbul:=false;
  228.       curbul:=0
  229.     end else checkcurbul:=true
  230.   end;
  231.  
  232.   procedure getbrec;
  233.   begin
  234.     if checkcurbul then begin
  235.       seekbfile (curbul);
  236.       read (bfile,b); che
  237.     end
  238.   end;
  239.  
  240.   procedure delbul (bn:integer; deltext:boolean);
  241.   var c,un:integer;
  242.       b:bulrec;
  243.       u:userrec;
  244.   begin
  245.     if (bn<1) or (bn>numbuls) then exit;
  246.     seekbfile (bn);
  247.     read (bfile,b);
  248.     if deltext then deletetext (b.line);
  249.     for c:=bn to numbuls-1 do begin
  250.       seekbfile (c+1);
  251.       read (bfile,b);
  252.       seekbfile (c);
  253.       write (bfile,b)
  254.     end;
  255.     seekbfile (numbuls);
  256.     truncate (bfile);
  257.     getlastreadnum
  258.   end;
  259.  
  260.   procedure delboard (bdn:integer);
  261.   var bd1:boardrec;
  262.       cnt,nbds:integer;
  263.       bo:boardorder;
  264.   begin
  265.     clearorder (bo);
  266.     nbds:=filesize(bdfile)-1;
  267.     if nbds=0 then begin
  268.       close (bdfile);
  269.       rewrite (bdfile);
  270.       exit
  271.     end;
  272.     for cnt:=bdn to nbds-1 do begin
  273.       seekbdfile (cnt+1);
  274.       read (bdfile,bd1);
  275.       seekbdfile (cnt);
  276.       writebdfile (bd1);
  277.       bo[cnt]:=cnt+1
  278.     end;
  279.     seek (bdfile,nbds);
  280.     truncate (bdfile);
  281.     seek (bifile,nbds);
  282.     truncate (bifile);
  283.     carryout (bo)
  284.   end;
  285.  
  286.   procedure sendfile (fn:integer);
  287.   var f:filerec;
  288.       cnt:integer;
  289.       k:char;
  290.       q:file of byte;
  291.   label exit;
  292.   begin
  293.     seekffile (fn);
  294.     read (ffile,f);
  295.     assign (q,f.fname);
  296.     reset (q);
  297.     iocode:=ioresult;
  298.     if iocode<>0 then begin
  299.       fileerror (f.fname,'SENDFILE (Ascii download)');
  300.       goto exit
  301.     end;
  302.     writelog (4,1,f.descrip);
  303.     writeln ('File:        '^S,f.descrip);
  304.     writeln ('Uploaded by: '^S,f.sentby);
  305.     writeln ('Downloaded:  '^s,f.downloaded);
  306.     writeln ('File size:   '^S,filesize(q),' characters'^M);
  307.     writeln (^B'Press space when you''re ready, or [X] to abort...');
  308.     repeat
  309.       repeat until charready;
  310.       k:=readchar;
  311.       if hungupon then goto exit;
  312.       if upcase(k)='X' then goto exit
  313.     until k=' ';
  314.     if not hungupon
  315.       then
  316.         begin
  317.           printfile (f.fname);
  318.           f.downloaded:=f.downloaded+1;
  319.           seekffile (fn);
  320.           write (ffile,f);
  321.           writeln (^B^M+asciidownload+^M'Press a key...');
  322.           repeat until charready;
  323.           k:=readchar
  324.         end;
  325.     exit:
  326.     close (q)
  327.   end;
  328.  
  329.   procedure receivefile (f:filerec);
  330.   var fn:lstr;
  331.       cnt,timeul:integer;
  332.       k:char;
  333.       done:boolean;
  334.       fff:text;
  335.       last3:array [1..3] of char;
  336.  
  337.     procedure putchar (k:char);
  338.     begin
  339.       write (fff,k);
  340.       write (usr,k)
  341.     end;
  342.  
  343.   begin
  344.     fn:='';
  345.     cnt:=1;
  346.     timeul:=timer;
  347.     repeat
  348.       if cnt<=length(f.descrip) then begin
  349.         k:=upcase(f.descrip[cnt]);
  350.         if k in ['A'..'Z'] then fn:=fn+k
  351.       end;
  352.       cnt:=cnt+1
  353.     until cnt>length(f.descrip);
  354.     if fn='' then fn:='Noname';
  355.     fn:=copy(fn,1,8);
  356.     while devicename(fn) do fn:=fn+chr(random(26)+64);
  357.     fn:=uploaddir+fn+'.';
  358.     cnt:=0;
  359.     repeat
  360.       cnt:=cnt+1
  361.     until (cnt=1000) or (not exist(fn+strr(cnt)));
  362.     if cnt=1000 then begin
  363.       writeln ('Please try another description!');
  364.       exit
  365.     end;
  366.     fn:=fn+strr(cnt);
  367.     assign (fff,fn);
  368.     rewrite (fff);
  369.     iocode:=ioresult;
  370.     if iocode<>0 then begin
  371.       error ('%I opening %1 in RECEIVEFILE (ASCII upload)','',fn);
  372.       exit
  373.     end;
  374.     f.fname:=fn;
  375.     f.sentby:=unam;
  376.     f.downloaded:=0;
  377.     f.when:=now;
  378.     writeln (^B'ASCII receive ready.'^M,
  379.              'Press [CR] and /E to end, /X to abort.'^M);
  380.     textcolor (outlockcolor);
  381.     repeat
  382.       repeat until charready;
  383.       if hungupon
  384.         then done:=true
  385.         else
  386.           begin
  387.             k:=chr(ord(readchar) and 127);
  388.             last3[1]:=last3[2];
  389.             last3[2]:=last3[3];
  390.             last3[3]:=upcase(k);
  391.             done:=((last3[1]=^M) or (last3[1]=^J))
  392.                   and (last3[2]='/') and ((last3[3]='E') or (last3[3]='X'));
  393.             if not done then begin
  394.               if (last3[2]=^M) and (k<>^J) then putchar (^J);
  395.               if last3[2]='/' then putchar ('/');
  396.               if k<>'/'
  397.                 then putchar (k)
  398.             end
  399.           end
  400.     until done;
  401.     textclose (fff);
  402.     textcolor (normbotcolor);
  403.     if last3[3]='E' then begin
  404.       addfile (f);
  405.       timeul:=timer-timeul;
  406.       if timeul<0 then timeul:=timeul+1440;
  407.       writeln (^B^M'That upload took ',timeul,' minutes.');
  408.       logontime:=logontime+timeul;
  409.       writelog (4,2,f.descrip)
  410.     end else begin
  411.       writestr (^M^M'Upload aborted!');
  412.       erase (fff);
  413.       iocode:=ioresult
  414.     end
  415.   end;
  416.  
  417.   procedure readcurbul;
  418.   var q:anystr;
  419.       t:sstr;
  420.       cnt:integer;
  421.   begin
  422.     if checkcurbul then begin
  423.       getbrec;
  424.       writeln (^B'Bulletin '^S,curbul,^M'Title:   '^S,b.title);
  425.       q:='Left by  '^S;
  426.       if b.anon
  427.         then
  428.           begin
  429.             q:=q+anonymousstr;
  430.             if issysop then q:=q+' ('+b.leftby+')'
  431.           end
  432.         else
  433.           begin
  434.             if b.plevel=-1
  435.               then t:='unknown'
  436.               else t:=strr(b.plevel);
  437.             q:=q+b.leftby+' (Level '+t+')'
  438.           end;
  439.       if issysop or (not b.anon)
  440.         then writeln ('When:    '^S,datestr(b.when),' at ',timestr(b.when));
  441.       writeln (q);
  442.       if break then exit;
  443.       printtext (b.line)
  444.     end;
  445.     if curbul>lastreadnum then begin
  446.       lastreadnum:=curbul;
  447.       urec.lastread[curboardnum]:=b.id
  448.     end
  449.   end;
  450.  
  451.   function queryaccess:accesstype;
  452.   begin
  453.     queryaccess:=getuseraccflag (urec,curboardnum)
  454.   end;
  455.  
  456.   procedure autodelete;
  457.   var cnt:integer;
  458.   begin
  459.     writeln ('Erasing first five posts...');
  460.     for cnt:=6 downto 2 do delbul (cnt,true)
  461.   end;
  462.  
  463.   procedure postbul;
  464.   var l:integer;
  465.       m:message;
  466.       b:bulrec;
  467.   begin
  468.     if ulvl<postlevel then begin
  469.       reqlevel(postlevel);
  470.       exit
  471.     end;
  472.     l:=editor(m,true);
  473.     if l>=0 then
  474.       begin
  475.         urec.nbu:=urec.nbu+1;
  476.         writeurec;
  477.         b.anon:=m.anon;
  478.         b.title:=m.title;
  479.         b.when:=now;
  480.         b.leftby:=unam;
  481.         b.line:=l;
  482.         b.plevel:=ulvl;
  483.         addbul (b);
  484.         newposts:=newposts+1;
  485.         with curboard do
  486.           if autodel<=numbuls then autodelete
  487.       end
  488.   end;
  489.  
  490.   procedure getbnum (txt:mstr);
  491.   var q:boolean;
  492.   begin
  493.     if length(input)>1
  494.       then curbul:=valu(copy(input,2,255))
  495.       else begin
  496.         writestr (^M'Bulletin to '+txt+':');
  497.         curbul:=valu(input)
  498.       end;
  499.     q:=checkcurbul
  500.   end;
  501.  
  502.   procedure readbul;
  503.   begin
  504.     getbnum ('read');
  505.     readcurbul
  506.   end;
  507.  
  508.   procedure readnextbul;
  509.   var t:integer;
  510.   begin
  511.     t:=curbul;
  512.     curbul:=curbul+1;
  513.     readcurbul;
  514.     if curbul=0 then curbul:=t
  515.   end;
  516.  
  517.   procedure readnum (n:integer);
  518.   begin
  519.     curbul:=n;
  520.     readcurbul
  521.   end;
  522.  
  523.   function haveaccess (n:integer):boolean;
  524.   var a:accesstype;
  525.   begin
  526.     curboardnum:=n;
  527.     seekbdfile (n);
  528.     read (bdfile,curboard);
  529.     a:=queryaccess;
  530.     if a=bylevel
  531.       then haveaccess:=ulvl>=curboard.level
  532.       else haveaccess:=a=letin
  533.   end;
  534.  
  535.   procedure makeboard;
  536.   begin
  537.     formatbfile;
  538.     formatffile;
  539.     with curboard do begin
  540.       shortname:=curboardname;
  541.       buflen:=30;
  542.       writestr (^M'Board name: &');
  543.       boardname:=input;
  544.       buflen:=30;
  545.       writestr ('Sponsor (C/R for '+unam+'):');
  546.       if input='' then input:=unam;
  547.       sponsor:=input;
  548.       writestr ('Minimum level for entry:');
  549.       level:=valu(input);
  550.       writestr ('Autodelete after:');
  551.       autodel:=valu(input);
  552.       if autodel<10 then begin
  553.         writeln ('Must be at least 10!');
  554.         autodel:=10
  555.       end;
  556.       setallflags (curboardnum,bylevel);
  557.       writecurboard;
  558.       writeln ('Board created.');
  559.       writelog (4,4,boardname+' ['+shortname+']')
  560.     end
  561.   end;
  562.  
  563.   procedure setactive (nn:sstr);
  564.  
  565.     procedure doswitch;
  566.     begin
  567.       openbfile;
  568.       curbul:=lastreadnum;
  569.       with curboard do
  570.         writeln (^M'Sub-board: '^S,boardname,
  571.                  ^M'Sponsor:   '^S,sponsor,
  572.                  ^M'Bulletins: '^S,numbuls,
  573.                  ^M'Last read: '^S,lastreadnum,
  574.                  ^M'Files:     '^S,numfiles,^M)
  575.     end;
  576.  
  577.     procedure tryswitch;
  578.     var n,s:integer;
  579.  
  580.       procedure denyaccess;
  581.       var b:bulrec;
  582.       begin
  583.         reqlevel (curboard.level);
  584.         setfirstboard
  585.       end;
  586.  
  587.     begin
  588.       curboardname:=nn;
  589.       curboardnum:=searchboard(nn);
  590.       if haveaccess(curboardnum)
  591.         then doswitch
  592.         else denyaccess
  593.     end;
  594.  
  595.   var b:bulrec;
  596.   begin
  597.     curbul:=0;
  598.     close (bfile);
  599.     close (ffile);
  600.     curboardname:=nn;
  601.     if boardexist(nn) then tryswitch else begin
  602.       writeln ('No such board: ',curboardname,'!');
  603.       if issysop
  604.         then
  605.           begin
  606.             writestr (^M'Create one (Y/N)? *');
  607.             if yes
  608.               then
  609.                 begin
  610.                   makeboard;
  611.                   setactive (curboardname)
  612.                 end
  613.               else setfirstboard
  614.           end
  615.         else setfirstboard
  616.     end
  617.   end;
  618.  
  619.   function validbname (n:sstr):boolean;
  620.   var cnt:integer;
  621.   begin
  622.     validbname:=false;
  623.     if (length(n)=0) or (length(n)>8) then exit;
  624.     for cnt:=1 to length(n) do
  625.       if not (upcase(n[cnt]) in ['0'..'9','A'..'Z']) then exit;
  626.     validbname:=true
  627.   end;
  628.  
  629.   procedure listboards;
  630.   var cnt,oldcurboard:integer;
  631.       printed:boolean;
  632.   begin
  633.     oldcurboard:=curboardnum;
  634.     writeln (^M'Number   Name                      Level'^M);
  635.     if break then exit;
  636.     for cnt:=0 to filesize(bdfile)-1 do
  637.       if haveaccess(cnt) then
  638.         with curboard do begin
  639.           tab (shortname,9);
  640.           tab (boardname,26);
  641.           writeln (level);
  642.           if break then exit
  643.         end;
  644.     curboardnum:=oldcurboard;
  645.     seekbdfile (curboardnum);
  646.     read (bdfile,curboard)
  647.   end;
  648.  
  649.   procedure activeboard;
  650.   begin
  651.     if length(input)>1
  652.       then input:=copy(input,2,255)
  653.       else
  654.         repeat
  655.           writestr (^M^M'Board number [?=List]:');
  656.           if input='?' then listboards
  657.         until (input<>'?') or hungupon;
  658.     if hungupon or (length(input)=0) then exit;
  659.     if input[1]='*' then input:=copy(input,2,255);
  660.     if validbname(input)
  661.       then setactive (input)
  662.       else
  663.         begin
  664.           writeln (^M'Invalid board name!');
  665.           setfirstboard
  666.         end
  667.   end;
  668.  
  669.   procedure setfirstboard; { FORWARD }
  670.   var fbn:sstr;
  671.   begin
  672.     if filesize(bdfile)=0 then exit;
  673.     if not haveaccess(0)
  674.       then error ('User can''t access first board','','');
  675.     seek (bifile,0);
  676.     read (bifile,fbn);
  677.     setactive (fbn)
  678.   end;
  679.  
  680.   procedure listbuls;
  681.   var cnt,bn:integer;
  682.       q:boolean;
  683.   begin
  684.     if length(input)>1 then begin
  685.       curbul:=valu(copy(input,2,255));
  686.       q:=checkcurbul
  687.     end;
  688.     if curbul=0
  689.       then
  690.         begin
  691.           writestr (^M'List titles starting at #*');
  692.           curbul:=valu(input)
  693.         end
  694.       else
  695.         if length(input)>1
  696.           then curbul:=valu(input)
  697.           else curbul:=curbul+10;
  698.     if not checkcurbul then curbul:=1;
  699.     writeln ('Titles:'^M);
  700.     for cnt:=0 to 9 do
  701.       begin
  702.         bn:=curbul+cnt;
  703.         if (bn>0) and (bn<=numbuls) then
  704.           begin
  705.             seekbfile (bn);
  706.             read (bfile,b);
  707.             write (bn,'. ',b.title,' by ');
  708.             if b.anon
  709.               then writeln (anonymousstr)
  710.               else writeln (b.leftby);
  711.             if break then exit
  712.           end
  713.       end
  714.   end;
  715.  
  716.   procedure killbul;
  717.   var un:integer;
  718.       u:userrec;
  719.   begin
  720.     writehdr ('Bulletin Deletion');
  721.     getbnum ('delete');
  722.     if not checkcurbul then exit;
  723.     getbrec;
  724.     if (not match(b.leftby,unam)) and (not issysop) and (not sponsoron)
  725.       then begin
  726.         writeln ('You didn''t post that!');
  727.         exit
  728.       end;
  729.     writeln ('Title:   ',b.title,
  730.              ^M'Left by: ',b.leftby,^M^M);
  731.     writestr ('Delete this? *');
  732.     if not yes then exit;
  733.     un:=lookupuser (b.leftby);
  734.     if un<>0 then begin
  735.       writeurec;
  736.       seek (ufile,un);
  737.       read (ufile,u);
  738.       u.nbu:=u.nbu-1;
  739.       seek (ufile,un);
  740.       write (ufile,u);
  741.       readurec
  742.     end;
  743.     delbul (curbul,true);
  744.     writeln ('Bulletin deleted.');
  745.     writelog (4,5,b.title)
  746.   end;
  747.  
  748.   procedure editbul;
  749.   var me:message;
  750.   begin
  751.     getbnum ('edit');
  752.     if not checkcurbul then exit;
  753.     getbrec;
  754.     if (not match(b.leftby,unam)) and (not issysop) and (not sponsoron)
  755.       then begin
  756.         writeln ('You didn''t post that!');
  757.         exit
  758.       end;
  759.     reloadtext (b.line,me);
  760.     me.title:=b.title;
  761.     me.anon:=b.anon;
  762.     if reedit (me,true) then begin
  763.       writelog (4,6,b.title);
  764.       deletetext (b.line);
  765.       b.line:=maketext (me);
  766.       if b.line<0 then begin
  767.         writestr (^M'Deleting bulletin...');
  768.         delbul (curbul,false)
  769.       end else begin
  770.         seekbfile (curbul);
  771.         write (bfile,b)
  772.       end
  773.     end
  774.   end;
  775.  
  776.  
  777.   procedure sendbreply;
  778.   begin
  779.     if checkcurbul then begin
  780.       getbrec;
  781.       sendmailto (b.leftby,b.anon)
  782.     end else begin
  783.       getbnum ('reply to');
  784.       if checkcurbul then sendbreply
  785.     end
  786.   end;
  787.  
  788.   procedure listfiles;
  789.   var cnt,r1,r2,nfiles:integer;
  790.       f:filerec;
  791.   begin
  792.     nfiles:=numfiles;
  793.     thereare (nfiles,'file','files');
  794.     if nfiles=0 then exit;
  795.     parserange (nfiles,r1,r2);
  796.     if r1=0 then exit;
  797.     for cnt:=r1 to r2 do begin
  798.       seekffile (cnt);
  799.       read (ffile,f); che;
  800.       writeln (cnt,'. ',f.descrip);
  801.       if break then exit
  802.     end
  803.   end;
  804.  
  805.   function getfilenumber (txt:lstr):integer;
  806.   var fn:integer;
  807.       gotten:boolean;
  808.   begin
  809.     getfilenumber:=0;
  810.     input:=copy(input,2,255);
  811.     if length(input)=0 then
  812.       repeat
  813.         gotten:=true;
  814.         writestr (^M'File number to '+txt+' [?=List]:');
  815.         if input='?' then
  816.           begin
  817.             writeln;
  818.             listfiles;
  819.             writeln;
  820.             gotten:=false
  821.           end
  822.       until gotten;
  823.     fn:=valu(input);
  824.     if (fn<1) or (fn>numfiles) then fn:=0;
  825.     getfilenumber:=fn
  826.   end;
  827.  
  828.   procedure downloadfile;
  829.   var fn:integer;
  830.   begin
  831.     fn:=getfilenumber ('download');
  832.     if fn<>0 then
  833.       begin
  834.         sendfile (fn);
  835.         urec.ndn:=urec.ndn+1
  836.       end;
  837.   end;
  838.  
  839.   procedure uploadfile;
  840.   var f:filerec;
  841.   begin
  842.     writestr ('Describe the file'+^M+'=> *');
  843.     if length(input)<>0 then begin
  844.       f.descrip:=input;
  845.       receivefile (f);
  846.       urec.nup:=urec.nup+1
  847.     end
  848.   end;
  849.  
  850.   procedure boardsponsor;
  851.  
  852.     procedure getbgen (txt:mstr; var q);
  853.     var s:lstr absolute q;
  854.     begin
  855.       writeln (^B'Current ',txt,': ',s);
  856.       buflen:=30;
  857.       writestr ('Enter new '+txt+':');
  858.       if length(input)>0 then s:=input
  859.     end;
  860.  
  861.     procedure getbint (txt:mstr; var i:integer);
  862.     var a:anystr;
  863.     begin
  864.       a:=strr(i);
  865.       getbgen (txt,a);
  866.       i:=valu(a);
  867.       writecurboard
  868.     end;
  869.  
  870.     procedure getbstr (txt:mstr; var q);
  871.     begin
  872.       getbgen (txt,q);
  873.       writecurboard
  874.     end;
  875.  
  876.     procedure setacc (ac:accesstype; un:integer);
  877.     var u:userrec;
  878.     begin
  879.       seek (ufile,un);
  880.       read (ufile,u);
  881.       setuseraccflag (u,curboardnum,ac);
  882.       seek (ufile,un);
  883.       write (ufile,u)
  884.     end;
  885.  
  886.     function queryacc (un:integer):accesstype;
  887.     var u:userrec;
  888.     begin
  889.       seek (ufile,un);
  890.       read (ufile,u);
  891.       queryacc:=getuseraccflag (u,curboardnum)
  892.     end;
  893.  
  894.     procedure setnameaccess;
  895.     var un,n:integer;
  896.         ac:accesstype;
  897.         q,unm:mstr;
  898.     begin
  899.       writestr (^M'Change access for user:');
  900.       un:=lookupuser(input);
  901.       if un=0 then begin
  902.         writeln ('No such user!');
  903.         exit
  904.       end;
  905.       unm:=input;
  906.       ac:=queryacc(un);
  907.       writeln (^B^M'Current access: ',accessstr[ac]);
  908.       getacflag (ac,q);
  909.       if ac=invalid then exit;
  910.       if un=unum then writeurec;
  911.       setacc (ac,un);
  912.       if un=unum then readurec;
  913.       case ac of
  914.         letin:n:=1;
  915.         keepout:n:=2;
  916.         bylevel:n:=3
  917.       end;
  918.       writelog (5,n,unm)
  919.     end;
  920.  
  921.     procedure setallaccess;
  922.     var cnt:integer;
  923.         ac:accesstype;
  924.         q:mstr;
  925.     begin
  926.       writehdr ('Set Everyone''s Access');
  927.       getacflag (ac,q);
  928.       if ac=invalid then exit;
  929.       writeurec;
  930.       setallflags (curboardnum,ac);
  931.       readurec;
  932.       writeln ('Done.');
  933.       writelog (5,4,accessstr[ac])
  934.     end;
  935.  
  936.     procedure listaccess;
  937.  
  938.       procedure listacc (all:boolean);
  939.       var cnt:integer;
  940.           a:accesstype;
  941.           u:userrec;
  942.  
  943.         procedure writeuser;
  944.         begin
  945.           if all
  946.             then
  947.               begin
  948.                 tab (u.handle,30);
  949.                 if a=bylevel
  950.                   then writeln ('Level='+strr(u.level))
  951.                   else writeln ('Let in')
  952.               end
  953.             else writeln (u.handle)
  954.         end;
  955.  
  956.       begin
  957.         seek (ufile,1);
  958.         for cnt:=1 to numusers do begin
  959.           read (ufile,u);
  960.           a:=getuseraccflag (u,curboardnum);
  961.           case a of
  962.             letin:writeuser;
  963.             bylevel:if all and (u.level>=curboard.level) then writeuser
  964.           end;
  965.           if break then exit
  966.         end
  967.       end;
  968.  
  969.     begin
  970.       writestr (
  971. 'List A)ll users who have access, or only those with S)pecial access? *');
  972.       if length(input)=0 then exit;
  973.       case upcase(input[1]) of
  974.         'A':listacc (true);
  975.         'S':listacc (false)
  976.       end
  977.     end;
  978.  
  979.     procedure getblevel;
  980.     var b:bulrec;
  981.     begin
  982.       getbint ('level',curboard.level);
  983.       writelog (5,12,strr(curboard.level))
  984.     end;
  985.  
  986.     procedure getautodel;
  987.     var b:bulrec;
  988.     begin
  989.       with curboard do begin
  990.         getbint ('auto-delete',autodel);
  991.         if autodel<10
  992.           then
  993.             begin
  994.               writeln (^B'HEY!  It can''t be less than ten!');
  995.               autodel:=numbuls+1;
  996.               if autodel<10 then autodel:=10;
  997.               writeln (^B'Setting autodelete to ',autodel);
  998.               writecurboard
  999.             end
  1000.           else
  1001.             if autodel<=numbuls
  1002.               then
  1003.                 begin
  1004.                   writeln (^B'Deleting bulletins...');
  1005.                   while autodel<=numbuls do delbul (2,true)
  1006.                 end
  1007.       end;
  1008.       writelog (5,11,strr(curboard.autodel))
  1009.     end;
  1010.  
  1011.     procedure getfiletitle;
  1012.     var fn:integer;
  1013.         f:filerec;
  1014.     begin
  1015.       fn:=getfilenumber ('change the title of');
  1016.       if fn<>0 then begin
  1017.         seekffile (fn);
  1018.         read (ffile,f); che;
  1019.         writeln (^B'Old description: ',f.descrip);
  1020.         writestr ('New description [or CR]:');
  1021.         if length(input)>0 then begin
  1022.           f.descrip:=input;
  1023.           seekffile (fn);
  1024.           write (ffile,f);
  1025.           writelog (5,9,f.descrip)
  1026.         end
  1027.       end
  1028.     end;
  1029.  
  1030.     procedure movefile;
  1031.     var f:filerec;
  1032.         tcb:boardrec;
  1033.         tcbn,dbn,fn:integer;
  1034.         tcbname:sstr;
  1035.     begin
  1036.       writehdr ('File Move');
  1037.       fn:=getfilenumber ('move');
  1038.       if fn=0 then exit;
  1039.       seekffile (fn);
  1040.       read (ffile,f);
  1041.       writestr ('Move "'+f.descrip+'" to which board? *');
  1042.       if length(input)=0 then exit;
  1043.       tcb:=curboard;
  1044.       tcbn:=curboardnum;
  1045.       tcbname:=curboardname;
  1046.       dbn:=searchboard(input);
  1047.       if dbn=-1 then begin
  1048.         writeln ('No such board!');
  1049.         exit
  1050.       end;
  1051.       writeln ('Moving...');
  1052.       delfile (fn);
  1053.       close (bfile);
  1054.       close (ffile);
  1055.       seek (bdfile,dbn);
  1056.       read (bdfile,curboard);
  1057.       curboardnum:=dbn;
  1058.       curboardname:=curboard.shortname;
  1059.       openbfile;
  1060.       addfile (f);
  1061.       close (bfile);
  1062.       close (ffile);
  1063.       curboard:=tcb;
  1064.       curboardname:=tcbname;
  1065.       curboardnum:=tcbn;
  1066.       openbfile;
  1067.       writelog (5,6,f.descrip);
  1068.       writeln (^B'Done!')
  1069.     end;
  1070.  
  1071.     procedure movebulletin;
  1072.     var b:bulrec;
  1073.         tcb:boardrec;
  1074.         tcbn,dbn,bnum:integer;
  1075.         tcbname,dbname:sstr;
  1076.     begin
  1077.       writehdr ('Bulletin Move');
  1078.       getbnum ('move');
  1079.       if not checkcurbul then exit;
  1080.       bnum:=curbul;
  1081.       seekbfile (bnum);
  1082.       read (bfile,b);
  1083.       writestr ('Move "'+b.title+'" posted by '+b.leftby+
  1084.         ' to which board? *');
  1085.       if length(input)=0 then exit;
  1086.       tcbname:=curboardname;
  1087.       dbname:=input;
  1088.       dbn:=searchboard(dbname);
  1089.       if dbn=-1 then begin
  1090.         writeln ('No such board!');
  1091.         exit
  1092.       end;
  1093.       writeln ('Moving...');
  1094.       delbul (bnum,false);
  1095.       close (bfile);
  1096.       close (ffile);
  1097.       curboardname:=dbname;
  1098.       openbfile;
  1099.       addbul (b);
  1100.       close (bfile);
  1101.       close (ffile);
  1102.       curboardname:=tcbname;
  1103.       openbfile;
  1104.       writelog (5,13,b.title);
  1105.       writeln (^B'Done!')
  1106.     end;
  1107.  
  1108.     procedure wipeoutfile;
  1109.     var un,fn:integer;
  1110.         f:filerec;
  1111.         q:file;
  1112.         n:mstr;
  1113.         u:userrec;
  1114.     begin
  1115.       writehdr ('File Wipe-out');
  1116.       fn:=getfilenumber ('wipe out');
  1117.       if fn=0 then exit;
  1118.       seekffile (fn);
  1119.       read (ffile,f);
  1120.       writestr ('Wipe out: "'+f.descrip+'" ? *');
  1121.       if not yes then exit;
  1122.       writestr ('Erase disk file '+f.fname+'? *');
  1123.       if yes then begin
  1124.         assign (q,f.fname);
  1125.         erase (q);
  1126.         un:=ioresult
  1127.       end;
  1128.       delfile (fn);
  1129.       writelog (5,7,f.descrip);
  1130.       n:=f.sentby;
  1131.       un:=lookupuser(n);
  1132.       if un<>0
  1133.         then
  1134.           begin
  1135.             seek (ufile,un);
  1136.             read (ufile,u);
  1137.             u.nup:=u.nup-1;
  1138.             writeln (n,' now has ',u.nup,' uploads.');
  1139.             seek (ufile,un);
  1140.             write (ufile,u)
  1141.           end
  1142.     end;
  1143.  
  1144.     procedure setsponsor;
  1145.     var un:integer;
  1146.         b:bulrec;
  1147.     begin
  1148.       writestr ('New sponsor:');
  1149.       if length(input)=0 then exit;
  1150.       un:=lookupuser (input);
  1151.       if un=0
  1152.         then writeln ('No such user.')
  1153.         else
  1154.           begin
  1155.             curboard.sponsor:=input;
  1156.             writelog (5,8,input);
  1157.             writecurboard
  1158.           end
  1159.     end;
  1160.  
  1161.     procedure renameboard;
  1162.     var sn:sstr;
  1163.         nfp,nbf,nff:lstr;
  1164.         qf:file;
  1165.         d:integer;
  1166.     begin
  1167.       getbstr ('board name',curboard.boardname);
  1168.       sn:=curboard.shortname;
  1169.       getbgen ('access name/number',sn);
  1170.       writelog (5,5,curboard.boardname+' ['+sn+']');
  1171.       if match(sn,curboard.shortname) then exit;
  1172.       if not validbname(sn) then begin
  1173.         writeln ('Invalid board name!');
  1174.         exit
  1175.       end;
  1176.       if boardexist(sn) then begin
  1177.         writeln ('Sorry!  Board already exists!');
  1178.         exit
  1179.       end;
  1180.       curboard.shortname:=sn;
  1181.       writecurboard;
  1182.       close (bfile);
  1183.       close (ffile);
  1184.       nfp:=boarddir+sn+'.';
  1185.       nbf:=nfp+'BUL';
  1186.       nff:=nfp+'FIL';
  1187.       assign (qf,nbf);
  1188.       erase (qf);
  1189.       d:=ioresult;
  1190.       assign (qf,nff);
  1191.       erase (qf);
  1192.       d:=ioresult;
  1193.       rename (bfile,nbf);
  1194.       rename (ffile,nff);
  1195.       setfirstboard;
  1196.       q:=9
  1197.     end;
  1198.  
  1199.     procedure killboard;
  1200.     var cnt:integer;
  1201.         f:file;
  1202.         fr:filerec;
  1203.         bd:boardrec;
  1204.     begin
  1205.       writestr ('Kill board:  Are you sure? *');
  1206.       if not yes then exit;
  1207.       writelog (5,10,'');
  1208.       writeln (^B^M'Deleting messages...');
  1209.       for cnt:=numbuls downto 1 do
  1210.         begin
  1211.           delbul(cnt,true);
  1212.           write (cnt,' ')
  1213.         end;
  1214.       writeln (^B^M'Deleting files...');
  1215.       for cnt:=numfiles downto 1 do
  1216.         begin
  1217.           seekffile (cnt);
  1218.           read (ffile,fr);
  1219.           assign (f,fr.fname);
  1220.           erase (f);
  1221.           if ioresult<>0 then writeln (^B'Error erasing ',fr.fname);
  1222.           delfile (cnt);
  1223.           write (cnt,' ')
  1224.         end;
  1225.       writeln (^B^M'Deleting sub-board files...');
  1226.       close (bfile);
  1227.       assignbfile;
  1228.       erase (bfile);
  1229.       if ioresult<>0 then writeln (^B'Error erasing board file.');
  1230.       close (ffile);
  1231.       assignffile;
  1232.       erase (ffile);
  1233.       if ioresult<>0 then writeln (^B'Error erasing file directory file.');
  1234.       writeln (^M'Removing sub-board...');
  1235.       delboard (curboardnum);
  1236.       writeln (^B'Sub-board erased!');
  1237.       setfirstboard;
  1238.       q:=9
  1239.     end;
  1240.  
  1241.     procedure sortboards;
  1242.     var cnt,mark,temp:integer;
  1243.         bd1,bd2:boardrec;
  1244.         bn1,bn2:sstr;
  1245.         bo:boardorder;
  1246.     begin
  1247.       writestr ('Sort sub-boards: Are you sure? *');
  1248.       if not yes then exit;
  1249.       clearorder (bo);
  1250.       mark:=filesize(bdfile)-1;
  1251.       repeat
  1252.         if mark<>0 then begin
  1253.           temp:=mark;
  1254.           mark:=0;
  1255.           for cnt:=0 to temp-1 do begin
  1256.             seek (bifile,cnt);
  1257.             read (bifile,bn1);
  1258.             read (bifile,bn2);
  1259.             if upstring(bn1)>upstring(bn2) then begin
  1260.               mark:=cnt;
  1261.               switchboards (cnt,cnt+1,bo)
  1262.             end
  1263.           end
  1264.         end
  1265.       until mark=0;
  1266.       carryout (bo);
  1267.       writelog (5,16,'');
  1268.       setfirstboard;
  1269.       q:=9
  1270.     end;
  1271.  
  1272.     procedure orderboards;
  1273.     var numb,curb,newb:integer;
  1274.         bo:boardorder;
  1275.     label exit;
  1276.     begin
  1277.       clearorder (bo);
  1278.       writehdr ('Re-order sub-boards');
  1279.       numb:=filesize (bdfile);
  1280.       thereare (numb,'sub-board','sub-boards');
  1281.       for curb:=0 to numb-2 do begin
  1282.         repeat
  1283.           writestr ('New board #'+strr(curb+1)+' [?=List, CR to quit]:');
  1284.           if length(input)=0 then goto exit;
  1285.           if input='?'
  1286.             then
  1287.               begin
  1288.                 listboards;
  1289.                 newb:=-1
  1290.               end
  1291.             else
  1292.               begin
  1293.                 newb:=searchboard(input);
  1294.                 if newb<0 then writeln ('Not found!  Please re-enter...')
  1295.               end
  1296.         until (newb>=0);
  1297.         switchboards (curb,newb,bo)
  1298.       end;
  1299.       exit:
  1300.       carryout (bo);
  1301.       writelog (5,14,'');
  1302.       q:=9;
  1303.       setfirstboard
  1304.     end;
  1305.  
  1306.     procedure addresident;
  1307.     var f:filerec;
  1308.     begin
  1309.       writestr ('Filename (including path):');
  1310.       if hungupon or (length(input)=0) then exit;
  1311.       if devicename(input) then begin
  1312.         writeln ('That''s a DOS device name !');
  1313.         exit
  1314.       end;
  1315.       if not exist(input) then begin
  1316.         writeln ('File not found.');
  1317.         exit
  1318.       end;
  1319.       f.sentby:=unam;
  1320.       f.fname:=input;
  1321.       writestr ('Description:');
  1322.       if length(input)=0 then exit;
  1323.       f.descrip:=input;
  1324.       f.downloaded:=0;
  1325.       f.when:=now;
  1326.       addfile (f);
  1327.       writelog (5,15,f.fname)
  1328.     end;
  1329.  
  1330.   begin
  1331.     if (not sponsoron) and (not issysop) then begin
  1332.       writeln ('Nice try, except you aren''t the sponsor.');
  1333.       exit
  1334.     end;
  1335.     writelog (4,3,curboard.boardname+' ['+curboard.shortname+']');
  1336.     repeat
  1337.       q:=menu ('Sponsor','SPONSOR','DLSTMWUEQRKC@BO@VA@H');
  1338.       case q of
  1339.         1:getautodel;
  1340.         2:getblevel;
  1341.         3:setsponsor;
  1342.         4:getfiletitle;
  1343.         5:movefile;
  1344.         6:wipeoutfile;
  1345.         7:setnameaccess;
  1346.         8:setallaccess;
  1347.         10:renameboard;
  1348.         11:killboard;
  1349.         12:sortboards;
  1350.         13:movebulletin;
  1351.         14:orderboards;
  1352.         15:listaccess;
  1353.         16:addresident;
  1354.         17:help ('Sponsor.hlp')
  1355.       end
  1356.     until (q=9) or hungupon
  1357.   end;
  1358.  
  1359.   var beenaborted:boolean;
  1360.  
  1361.   function aborted:boolean;
  1362.   begin
  1363.     if beenaborted then begin
  1364.       aborted:=true;
  1365.       exit
  1366.     end;
  1367.     aborted:=xpressed or hungupon;
  1368.     if xpressed then begin
  1369.       beenaborted:=true;
  1370.       writeln (^B'Newscan aborted!')
  1371.     end
  1372.   end;
  1373.  
  1374.   procedure newscanboard;
  1375.  
  1376.     procedure shownewfiles;
  1377.     var cnt,first,numf:integer;
  1378.         f:filerec;
  1379.         nf:boolean;
  1380.     begin
  1381.       numf:=numfiles;
  1382.       cnt:=numf;
  1383.       nf:=true;
  1384.       while (cnt>0) and nf do begin
  1385.         seekffile (cnt);
  1386.         read (ffile,f);
  1387.         nf:=f.when>laston;
  1388.         if nf then cnt:=cnt-1
  1389.       end;
  1390.       first:=cnt+1;
  1391.       if first>numf then exit;
  1392.       writehdr ('New files');
  1393.       if aborted or break then exit;
  1394.       for cnt:=first to numf do begin
  1395.         seekffile (cnt);
  1396.         read (ffile,f);
  1397.         writeln (cnt,'. ',f.descrip);
  1398.         if aborted or break then exit
  1399.       end
  1400.     end;
  1401.  
  1402.   var newmsgs:boolean;
  1403.       oldb:boolean;
  1404.   begin
  1405.     beenaborted:=false;
  1406.     newmsgs:=false;
  1407.     curbul:=lastreadnum+1;
  1408.     while curbul<=numbuls do begin
  1409.       getbrec;
  1410.       if b.when>laston then begin
  1411.         readnum (curbul);
  1412.         newmsgs:=true
  1413.       end;
  1414.       curbul:=curbul+1;
  1415.       if aborted then exit
  1416.     end;
  1417.     shownewfiles;
  1418.     if (postprompts in urec.config) and newmsgs and (ulvl>=postlevel)
  1419.       then begin
  1420.         writestr (^M'Post now? *');
  1421.         writeln;
  1422.         if yes then postbul
  1423.       end
  1424.   end;
  1425.  
  1426.   procedure newscanall;
  1427.   var cb:integer;
  1428.   begin
  1429.     beenaborted:=false;
  1430.     writehdr ('New-scanning. [X] to abort.');
  1431.     if aborted then exit;
  1432.     for cb:=0 to filesize(bdfile)-1 do begin
  1433.       if aborted then exit;
  1434.       if haveaccess(cb) and (not (cb in urec.newscanconfig)) then begin
  1435.         curboardname:=curboard.shortname;
  1436.         openbfile;
  1437.         if aborted then exit;
  1438.         writeln (^B^M'Scanning ',curboard.boardname,'...'^M);
  1439.         if aborted then exit;
  1440.         newscanboard
  1441.       end
  1442.     end;
  1443.     writeln (^B^M'Newscan complete!'^G);
  1444.     setfirstboard
  1445.   end;
  1446.  
  1447.   procedure noboards;
  1448.   begin
  1449.     writeln ('No sub-boards exist!');
  1450.     if not issysop then exit;
  1451.     writestr ('Create the first sub-board now? *');
  1452.     if not yes then exit;
  1453.     writestr ('Enter its access name/number:');
  1454.     if not validbname(input) then writeln (^B'Invalid board name!') else begin
  1455.       curboardname:=input;
  1456.       makeboard
  1457.     end
  1458.   end;
  1459.  
  1460.   procedure togglenewscan;
  1461.   begin
  1462.     write ('Newscan this board: ');
  1463.     if curboardnum in urec.newscanconfig
  1464.       then
  1465.         begin
  1466.           writeln ('Yes');
  1467.           urec.newscanconfig:=urec.newscanconfig-[curboardnum]
  1468.         end
  1469.       else
  1470.         begin
  1471.           writeln ('No');
  1472.           urec.newscanconfig:=urec.newscanconfig+[curboardnum]
  1473.         end
  1474.   end;
  1475.  
  1476.   procedure nextsubboard;
  1477.   var cb:integer;
  1478.       obn:sstr;
  1479.   begin
  1480.     obn:=curboardname;
  1481.     cb:=curboardnum;
  1482.     while cb<filesize(bdfile)-1 do begin
  1483.       cb:=cb+1;
  1484.       if haveaccess (cb) then begin
  1485.         seek (bifile,cb);
  1486.         read (bifile,obn);
  1487.         setactive (obn);
  1488.         exit
  1489.       end
  1490.     end;
  1491.     writestr ('This is the last sub-board!');
  1492.     setactive (obn)
  1493.   end;
  1494.  
  1495. var boo:boolean;
  1496. label exit;
  1497. begin
  1498.   cursection:=bulletinsysop;
  1499.   openbdfile;
  1500.   if filesize(bdfile)=0 then begin
  1501.     noboards;
  1502.     if filesize(bdfile)=0 then begin
  1503.       closebdfile;
  1504.       goto exit
  1505.     end
  1506.   end;
  1507.   if not haveaccess(0)
  1508.     then
  1509.       begin
  1510.         writeln (^B'You do not have access to the first sub-board!');
  1511.         closebdfile;
  1512.         goto exit
  1513.       end;
  1514.   setfirstboard;
  1515.   repeat
  1516.     boo:=checkcurbul;
  1517.     with curboard do
  1518.       writeln (^M,boardname,' [',shortname,']: ',curbul,' of ',numbuls);
  1519.     if sponsoron or issysop
  1520.       then writeln ('%: Board sponsor commands');
  1521.     q:=menu ('Bulletin','BULLET','PRDFUKT*MQ#_%LNBAVCHES+W');
  1522.     case q of
  1523.       1:postbul;
  1524.       2:readbul;
  1525.       3:downloadfile;
  1526.       4,22:sendmailto (curboard.sponsor,false);
  1527.       5:uploadfile;
  1528.       6:killbul;
  1529.       8,16,17:activeboard;
  1530.       7:listbuls;
  1531.       9:sendbreply;
  1532.       12:if not hungupon then readnextbul;
  1533.       13:boardsponsor;
  1534.       14:listfiles;
  1535.       15:newscanall;
  1536.       18:newscanboard;
  1537.       19:togglenewscan;
  1538.       20:help ('Bulletin.hlp');
  1539.       21:editbul;
  1540.       23:nextsubboard;
  1541.       24:readnum (lastreadnum+1);
  1542.       else if q<0 then readnum (-q)
  1543.     end
  1544.   until (q=10) or hungupon or (filesize(bdfile)=0);
  1545.   exit:
  1546.   close (bfile);
  1547.   close (ffile);
  1548.   closebdfile
  1549. end;
  1550.  
  1551.  
  1552. begin
  1553. end.
  1554.