{***************************************************************************** * * * Menus.Pas - * * Menu Command Execution Routines. * * * * Modification History * * ==================== * * 08/20/91 - 1.00 - E?O - Original Version * * * *****************************************************************************} {$A+,B+,E+,F+,I+,L+,N-,O-,R-,S+,V-} Unit Menus; Interface Uses {rcg11172000 no overlay under Linux.} {Overlay,} Crt, Dos, InitP, Sysop1, Sysop2, Sysop3, Sysop4, Sysop5, Sysop6, Sysop7, Sysop8, Sysop9, Sysop10, Sysop11, Mail0, Mail1, Mail2, Mail3, Mail4, Mail5, Mail6, Mail9, File0, File1, File2, File3, File4, File5, File6, File7, File8, File9, File10, File11, File12, File13, File14, Archive1, Archive2, Archive3, Misc1, Misc2, Misc3, Misc4, MiscX, CUser, Doors, Menus2, Menus3, Menus4, MyIO, Common; Procedure readin2; Procedure mainmenuhandle(var cmd:string); Procedure fcmd(cmd:string; var i:integer; noc:integer; var cmdexists,cmdnothid:boolean); Procedure domenuexec(cmd:string; var newmenucmd:string); Procedure domenucommand(var done:boolean; cmd:string; var newmenucmd:string); Implementation Procedure readin2; var s:string; nacc:boolean; begin readin; nacc:=FALSE; with menur do begin if ((not aacs(acs)) or (password<>'')) then begin nacc:=TRUE; if (password<>'') then begin nl; prt('Password: '); input(s,15); if (s=password) then nacc:=FALSE; end; if (nacc) then begin nl; print('Access denied.'); pausescr; print('Dropping back to fallback menu...'); curmenu:=systat.menupath+fallback+'.mnu'; readin; end; end; if (not nacc) then if (forcehelplevel<>0) then chelplevel:=forcehelplevel else if (novice in thisuser.ac) then chelplevel:=2 else chelplevel:=1; end; end; procedure checkforcelevel; begin if (chelplevel'') then if (copy(buf,1,1)='`') then begin buf:=copy(buf,2,length(buf)-1); i:=pos('`',buf); if (i<>0) then begin s:=allcaps(copy(buf,1,i-1)); buf:=copy(buf,i+1,length(buf)-i); nl; exit; end; end; shas0:='?|'; shas1:=''; has0:=FALSE; has1:=FALSE; has2:=FALSE; { find out what kind of 0:"x", 1:"/x", and 2:"//xxxxxxxx..." commands are in this menu. } for i:=1 to noc do if (aacs(cmdr[i].acs)) then if (cmdr[i].ckeys[0]=#1) then begin has0:=TRUE; shas0:=shas0+cmdr[i].ckeys; end else if ((cmdr[i].ckeys[1]='/') and (cmdr[i].ckeys[0]=#2)) then begin has1:=TRUE; shas1:=shas1+cmdr[i].ckeys[2]; end else has2:=TRUE; oldco:=curco; gotcmd:=FALSE; ss:=''; if (not (onekey in thisuser.ac)) then input(s,60) else begin repeat getkey(c); c:=upcase(c); oss:=ss; if (ss='') then begin if (c=#13) then gotcmd:=TRUE; if ((c='/') and ((has1) or (has2) or (thisuser.sl=255))) then ss:='/'; if ((c='=') and (cso)) then begin gotcmd:=TRUE; ss:=c; end; if (((fqarea) or (mqarea)) and (c in ['0'..'9'])) then ss:=c else if (pos(c,shas0)<>0) then begin gotcmd:=TRUE; ss:=c; end; end else if (ss='/') then begin if (c=^H) then ss:=''; if ((c='/') and ((has2) or (thisuser.sl=255))) then ss:=ss+'/'; if ((pos(c,shas1)<>0) and (has1)) then begin gotcmd:=TRUE; ss:=ss+c; end; end else if (copy(ss,1,2)='//') then begin if (c=#13) then gotcmd:=TRUE else if (c=^H) then ss:=copy(ss,1,length(ss)-1) else if (c=^X) then begin for i:=1 to length(ss)-2 do prompt(^H' '^H); ss:='//'; oss:=ss; end else if ((length(ss)<62) and (c>=#32) and (c<=#127)) then ss:=ss+c; end else if ((length(ss)>=1) and (ss[1] in ['0'..'9']) and ((fqarea) or (mqarea))) then begin if (c=^H) then ss:=copy(ss,1,length(ss)-1); if (c=#13) then gotcmd:=TRUE; if (c in ['0'..'9']) then begin ss:=ss+c; if (length(ss)=3) then gotcmd:=TRUE; end; end; if ((length(ss)=1) and (length(oss)=2)) then setc(oldco); if (oss<>ss) then begin if (length(ss)>length(oss)) then prompt(copy(ss,length(ss),1)); if (length(ss)0) then {* "command macros" *} if (copy(s,1,2)<>'\\') then begin if (onekey in thisuser.ac) then begin s1:=copy(s,2,length(s)-1); if (copy(s1,1,1)='/') then s:=copy(s1,1,2) else s:=copy(s1,1,1); s1:=copy(s1,length(s)+1,length(s1)-length(s)); end else begin s1:=copy(s,pos(';',s)+1,length(s)-pos(';',s)); s:=copy(s,1,pos(';',s)-1); end; while (pos(';',s1)<>0) do s1[pos(';',s1)]:=^M; dm(' '+s1,c); end; end; procedure mainmenuhandle(var cmd:string); var newarea:integer; wantshow:boolean; begin tleft; macok:=TRUE; checkforcelevel; if ((forcepause in menur.menuflags) and (chelplevel>1) and (lastcommandgood)) then pausescr; lastcommandgood:=FALSE; showthismenu; if (not (nomenuprompt in menur.menuflags)) then begin nl; if (autotime in menur.menuflags) then sprint(#3#3+'[