home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
intelmdsb
/
mdsset.p80
< prev
next >
Wrap
Text File
|
2020-01-01
|
16KB
|
578 lines
$TITLE ('SET MODULE')
set$module:
/* COPYRIGHT (C) 1985, Trustees of Columbia University in the City of New */
/* York. Permission is granted to any individual or institution to use, */
/* copy, or redistribute this software so long as it is not sold for */
/* profit, provided this copyright notice is retained. /*
/* Contains the following public routines: sethelp, set */
do;
/* SET: Process the several variations of the SET command */
declare port byte external;
declare parity byte external;
declare debug byte external;
declare maxtry byte external;
declare escchar byte external;
declare halfduplex byte external; /* true or false */
declare warning$flag byte external; /* how to handle dup file names */
declare take$echo byte external; /* true or false */
declare prompt(20) byte external; /* Kermit command prompt */
declare def$prompt(20) byte external; /* Default command prompt */
declare null literally '000H';
declare true literally '0FFH';
declare false literally '00H';
declare def$drive(5) byte external;
declare subcmd byte;
declare tokptr address;
declare (new$drive based tokptr)(4) byte;
print: procedure(msg) external;
declare msg address;
end print;
/* SPIN: Searches a string for a character greater than blank */
spin: procedure (string) address external;
declare string address;
end spin;
nout: procedure(n) external;
declare n address;
end nout;
newline: procedure external; end newline;
ioinit: procedure external; end ioinit;
token: procedure address external;
end token;
cmdtail: procedure address external;
end cmdtail;
nin: procedure (string) address external;
declare string address;
end nin;
ready: procedure (port) byte external;
declare port byte;
end ready;
procbaud: procedure (newbaud) byte external;
declare newbaud address;
end procbaud;
putc: procedure (c, port) external;
declare (c, port) byte;
end putc;
getc: procedure (port) byte external;
declare port byte;
end getc;
ctl: procedure(char) byte external;
declare char byte;
end ctl;
co: procedure(char) external;
declare char byte;
end co;
movevar: procedure(offset, source, dest) byte external;
declare offset byte;
declare (source, dest) address;
end movevar;
strcmp: procedure (s1,s2) byte external;
declare (s1,s2) address;
end strcmp;
varcmp: procedure (s1,s2) byte external;
declare (s1,s2) address;
end varcmp;
upcase: procedure (addr) external;
declare addr address;
end upcase;
missop: procedure;
call print(.('Missing operand\$'));
end missop;
badop: procedure;
call print(.('Invalid or ambiguous operand\$'));
end badop;
/* ONIN: Octal number input conversion routine */
onin: procedure(string) address public;
declare string address;
declare result address;
declare c based string byte;
result = 0;
if (string <> 0) then do;
string = spin(string);
do while (c >= '0') and (c <= '7');
result = result * 8 + (c - '0');
string = string + 1;
end;
end;
return result;
end onin;
/* Pause for operator input */
pause: procedure;
declare c byte;
call print(.('Press <RETURN> to continue...$'));
c = getc(0);
call newline;
end pause;
set$gen$help: procedure;
call print(.('\SET\\$'));
call print(.(' The SET command is used to set various KERMIT $'));
call print(.('parameters.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET option [value]\\$'));
call print(.('The SET options are:\\$'));
call print(.(' BAUD-RATE DEBUGGING DISK $'));
call print(.('DUPLEX ESCAPE PARITY\$'));
call print(.(' PORT PROMPT RETRY $'));
call print(.('TAKE-ECHO WARNING\\$'));
call print(.('You may request information on all of the $'));
call print (.('options by entering\\$'));
call print(.(' HELP SET ALL\\$'));
end set$gen$help;
baudhelp: procedure;
call print(.('\SET BAUD-RATE\\$'));
call print(.(' The BAUD-RATE option of the SET command is used $'));
call print(.('to set the communication\$'));
call print(.('baud rate.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET BAUD-RATE rate\\$'));
call print(.('Legal values for "rate" are 110, 150, 300, 600, $'));
call print(.('1200, 2400, 4800, 9600,\$'));
call print(.('and 19200.\\$'));
end baudhelp;
debhelp: procedure;
call print(.('\SET DEBUGGING\\$'));
call print(.(' The DEBUGGING option of the SET command is used $'));
call print(.('to control the display\$'));
call print(.('of debugging information.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET DEBUGGING [ON/OFF]\\$'));
call print(.('"SET DEBUGGING ON" will cause various status $'));
call print(.('information to be displayed\$'));
call print(.('while Kermit is executing.\\$'));
end debhelp;
diskhelp: procedure;
call print(.('\SET DISK\\$'));
call print(.(' The DISK option of the SET command is used $'));
call print(.('to set or clear the default\$'));
call print(.('ISIS disk drive. The default disk drive will be $'));
call print(.('prefixed to any ISIS file\$'));
call print(.('name which does not already start with a drive.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET DISK [:Fn:]\$'));
call print(.(' or\$'));
call print(.(' SET DISK [n]\\$'));
call print(.('The letter "n" above must be a digit (i.e., $'));
call print(.('between 0 and 9). If the disk\$'));
call print(.('specification is omitted, there will be no default $'));
call print(.('disk.\\$'));
end diskhelp;
duplhelp: procedure;
call print(.('\SET DUPLEX\\$'));
call print(.(' The DUPLEX option of the SET command controls $'));
call print(.('the display at the local\$'));
call print(.('system of characters entered during CONNECT mode.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET DUPLEX [FULL/HALF]\\$'));
call print(.('Use FULL when the remote system echoes the $'));
call print(.('characters you type. Use HALF\$'));
call print(.('to get the local Kermit to echo them. Half duplex $'));
call print(.('is also called "local echo".\\$'));
end duplhelp;
eschelp: procedure;
call print(.('\SET ESCAPE\\$'));
call print(.(' The ESCAPE option of the SET command is used $'));
call print(.('to change the escape character\$'));
call print(.('for CONNECT mode.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET ESCAPE [octal_value]\\$'));
call print(.('If the new value is not entered with the command, $'));
call print(.('you will be prompted for the\$'));
call print(.('new escape character, which you enter literally.\\$'));
end eschelp;
parhelp: procedure;
call print(.('\SET PARITY\\$'));
call print(.(' The PARITY option of the SET command is used $'));
call print(.('to set the communication\$'));
call print(.('parity.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET PARITY parity\\$'));
call print(.('Legal values for "parity" are NONE, MARK, SPACE, $'));
call print(.('EVEN, and NONE.\\$'));
end parhelp;
porthelp: procedure;
call print(.('\SET PORT\\$'));
call print(.(' The PORT option of the SET command is used $'));
call print(.('to change the I/O port.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET PORT port#\\$'));
call print(.('Permitted values for "port#" are 1 and 2.\\$'));
end porthelp;
promhelp: procedure;
call print(.('\SET PROMPT\\$'));
call print(.(' The PROMPT option of the SET command is used $'));
call print(.('to specify the Kermit command prompt.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET PROMPT [prompt-string]\\$'));
call print(.('The prompt string is limited to 20 characters. $'));
call print(.('If no prompt string is entered,\$'));
call print(.('the prompt is reset to the original value, "$'));
call print(.def$prompt);
call print(.('".\\$'));
end promhelp;
rethelp: procedure;
call print(.('\SET RETRY\\$'));
call print(.(' The RETRY option of the SET command is used $'));
call print(.('to change the number of\$'));
call print(.('times that Kermit will retry packet transmission $'));
call print(.('before giving up.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET RETRY n\\$'));
call print(.('Permitted values for "n" are 1 through 255.\\$'));
end rethelp;
takehelp: procedure;
call print(.('\SET TAKE-ECHO\\$'));
call print(.(' The TAKE-ECHO option of the SET command is used $'));
call print(.('to control the display\$'));
call print(.('of commands read from the "TAKE" file.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET TAKE-ECHO [ON/OFF]\\$'));
call print(.('"SET TAKE-ECHO ON" will cause commands read $'));
call print(.('from the "TAKE" file to be\$'));
call print(.('displayed on the console.\\$'));
end takehelp;
warnhelp: procedure;
call print(.('\SET WARNING\\$'));
call print(.(' The WARNING option of the SET command is used $'));
call print(.('to control the handling\$'));
call print(.('of local file name conflicts.\\$'));
call print(.('Syntax:\\$'));
call print(.(' SET WARNING [ON/OFF]\\$'));
call print(.('"SET WARNING ON" will cause a warning message $'));
call print(.('to be issued when an incoming\$'));
call print(.('file has the same name as an existing local file. $'));
call print(.('Kermit will then rename the\$'));
call print(.('incoming file. "SET WARNING OFF" will cause Kermit $'));
call print(.('to overwrite the existing\$'));
call print(.('file.\\$'));
end warnhelp;
/* Display help for the SET command */
sethelp:procedure public;
tokptr = token;
if tokptr = 0 then call set$gen$help;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('ALL',null)) >= 1) then
do;
call baudhelp;
call pause;
call debhelp;
call pause;
call diskhelp;
call pause;
call duplhelp;
call pause;
call eschelp;
call pause;
call parhelp;
call pause;
call porthelp;
call pause;
call promhelp;
call pause;
call rethelp;
call pause;
call takehelp;
call pause;
call warnhelp;
end;
else
if (varcmp(tokptr,.('BAUD-RATE',null)) >= 1) then call baudhelp;
else
if (varcmp(tokptr,.('DEBUGGING',null)) >= 2) then call debhelp;
else
if (varcmp(tokptr,.('DISK',null)) >= 2) then call diskhelp;
else
if (varcmp(tokptr,.('DUPLEX',null)) >= 2) then call duplhelp;
else
if (varcmp(tokptr,.('ESCAPE',null)) >= 1) then call eschelp;
else
if (varcmp(tokptr,.('PARITY',null)) >= 2) then call parhelp;
else
if (varcmp(tokptr,.('PORT',null)) >= 2) then call porthelp;
else
if (varcmp(tokptr,.('PROMPT',null)) >= 2) then call promhelp;
else
if (varcmp(tokptr,.('RETRY',null)) >= 1) then call rethelp;
else
if (varcmp(tokptr,.('TAKE-ECHO',null)) >= 1) then call takehelp;
else
if (varcmp(tokptr,.('WARNING',null)) >= 1) then call warnhelp;
else
do;
call badop;
call set$gen$help;
end;
end;
end sethelp;
set:
procedure public;
declare newport byte;
declare newbaud address;
declare newtry address;
declare newesc byte;
declare offset byte;
tokptr = token;
if tokptr = 0 then
do;
call missop;
subcmd = 0;
end;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('BAUD-RATE',null)) >= 1) then subcmd = 1;
else
if (varcmp(tokptr,.('DEBUGGING',null)) >= 2) then subcmd = 2;
else
if (varcmp(tokptr,.('DISK',null)) >= 2) then subcmd = 3;
else
if (varcmp(tokptr,.('DUPLEX',null)) >= 2) then subcmd = 4;
else
if (varcmp(tokptr,.('ESCAPE',null)) >= 1) then subcmd = 5;
else
if (varcmp(tokptr,.('PARITY',null)) >= 2) then subcmd = 6;
else
if (varcmp(tokptr,.('PORT',null)) >= 2) then subcmd = 7;
else
if (varcmp(tokptr,.('PROMPT',null)) >= 2) then subcmd = 8;
else
if (varcmp(tokptr,.('RETRY',null)) >= 1) then subcmd = 9;
else
if (varcmp(tokptr,.('TAKE-ECHO',null)) >= 1) then subcmd = 10;
else
if (varcmp(tokptr,.('WARNING',null)) >= 1) then subcmd = 11;
else
do;
call badop;
subcmd = 0;
end;
end;
do case subcmd;
/* 0 = illegal subcommand */
do;
/* Error already reported */
end;
/* 1 = BAUD-RATE subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
newbaud = nin(tokptr);
if (procbaud(newbaud) = true) then
call ioinit;
else
call print(.('Invalid baud rate value entered\$'));
end;
end;
/* 2 = DEBUGGING subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('ON',null)) >= 2) then debug = true;
else
if (varcmp(tokptr,.('OFF',null)) >= 2) then debug = false;
else
call badop;
end;
end;
/* 3 = DISK subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then def$drive(0) = null; /* reset to "no default" */
else do;
call upcase(tokptr); /* Convert to uppercase */
if (new$drive(0) >= '0' and new$drive(0) <= '9' and
new$drive(1) = null) then
do; /* User entered a single digit */
call move(5,.(':F0:',null),.def$drive);
def$drive(2) = new$drive(0);
end;
else
if (new$drive(0) = ':' and new$drive(1) = 'F' and
new$drive(2) >= '0' and new$drive(2) <= '9' and
new$drive(3) = ':' and new$drive(4) = null) then
/* User entered a full drive specification */
call move(4,tokptr,.def$drive);
else
call badop;
end;
end;
/* 4 = DUPLEX subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('HALF',null)) >= 1) then halfduplex = true;
else
if (varcmp(tokptr,.('FULL',null)) >= 1) then halfduplex = false;
else
call badop;
end;
end;
/* 5 = ESCAPE subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr <> 0 then
do; /* escape character value entered */
newesc = onin(tokptr); /* capture as octal value */
if (newesc > 0 and newesc <= 255) then escchar = newesc;
else
call print(.('Invalid escape character value entered\$'));
end;
else
do; /* no value entered */
call print(.('Enter new escape character: $'));
escchar = getc(0); /* read from console */
call newline;
end;
end;
/* 6 = PARITY subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('NONE',null)) >= 1) then parity = 0;
else
if (varcmp(tokptr,.('MARK',null)) >= 1) then parity = 1;
else
if (varcmp(tokptr,.('SPACE',null)) >= 1) then parity = 2;
else
if (varcmp(tokptr,.('EVEN',null)) >= 1) then parity = 3;
else
if (varcmp(tokptr,.('ODD',null)) >= 1) then parity = 4;
else
call badop;
call ioinit;
end;
end;
/* 7 = PORT subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
newport = nin(tokptr);
if (newport = 1 or newport = 2) then
do;
port = newport;
call ioinit;
end;
else
call print(.('Invalid port value entered\$'));
end;
end;
/* 8 = PROMPT subcommand */
do;
tokptr = cmdtail; /* Get the rest of the command line */
if tokptr = 0 then offset = movevar(0,.def$prompt,.prompt);
else offset = movevar(0,tokptr,.prompt);
end;
/* 9 = RETRY subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
newtry = nin(tokptr);
if (newtry > 0 and newtry < 256) then maxtry = newtry;
else
call print(.('Invalid retry value entered$\'));
end;
end;
/* 10 = TAKE-ECHO subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('ON',null)) >= 2) then take$echo = true;
else
if (varcmp(tokptr,.('OFF',null)) >= 2) then take$echo = false;
else
call badop;
end;
end;
/* 11 = WARNING subcommand */
do;
tokptr = token; /* Get the operand */
if tokptr = 0 then call missop;
else
do;
call upcase(tokptr); /* Convert to uppercase */
if (varcmp(tokptr,.('ON',null)) >= 2) then warning$flag = true;
else
if (varcmp(tokptr,.('OFF',null)) >= 2) then warning$flag = false;
else
call badop;
end;
end;
end;
end set;
end set$module;