perm filename CSREPT.SAI[MNT,CSR] blob
sn#238553 filedate 1976-09-27 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 CSREPT
C00004 00003 The RESP procedure (handles user responses)
C00006 ENDMK
C⊗;
comment CSREPT;
BEGIN
comment This is the control program through which any of the
subprograms can be reached, and which contains a few useful
subroutines for the other programs;
EXTERNAL PROCEDURE BAIL;
EXTERNAL PROCEDURE LISTUP;
EXTERNAL PROCEDURE MAKEML;
EXTERNAL PROCEDURE CSMAIL;
EXTERNAL PROCEDURE CMONEY;
require "⊂⊃" delimiters;
define # = ⊂;comment⊃;
define crlf = ⊂('15&'12)⊃;
define ttin = ⊂clrbuf; typein←ttyinl(1,brchar);
while typein=" " do dum←lop(typein);⊃;
define prt = ⊂print(crlf⊃;
internal string typein # tty input buffer;
internal integer brchar # break character;
integer i,j,k,dum # miscellaneous;
comment The RESP procedure (handles user responses);
integer procedure RESP(reference string Q,H,R; string array OPTS);
begin comment Q is the question, H is the HELP string, R explains the
allowable answers, and OPTS lists the initial characters of
allowable responses;
comment the output is 0 if the response was <cr>, otherwise
it is the index of the option typed;
integer i;
while true do
begin prt,Q); ttin;
if typein='15 then return(0);
for i←1 step 1 until arrinfo(OPTS,2) do
if equ(typein[1 to length(OPTS[i])],OPTS[i])
then return(i);
if equ(typein[1 to 4],"HELP") then prt,H) else prt,R);
end;
end;