{ Determine length of string. } function LenString(var tempStr : string80) : integer; var i : integer; endofstring : boolean; begin i := 80; endofstring := false; while ((i >= 1) and not(endofstring)) do if (tempStr[i] = ' ') then i := i - 1 else endofstring := true; LenString := i; end; { Copy command line into temporary string until either EOS or blank } procedure SkipBlanks(var command : string80; var commandLen : integer); var i, k, j, oldComLen : integer; endOfString : boolean; begin i := 1; endofString := false; oldComLen := commandLen; while ((i <= commandLen) and (not(endofString))) do if (command[i] = ' ') then i := i + 1 else endofString := true; k := 1; for j:=i to commandLen do begin command[k] := command[j]; k := k + 1; end; if ((oldComLen = 1) and (i <> 1)) then commandLen := commandLen - i else commandLen := commandLen - (i-1); end; { Copy command line into temporary string until either EOS or blank } procedure CopyToken(var command : string80; var commandLen : integer; var tempStr : string13; var totChars : integer); const %include 'kermdir:pglobal.pas/nolist' var i, j, k : integer; noBlank : boolean; tempToken : string80; begin for i:=1 to SMALLSIZE do tempStr[i] := ' '; i := 1; noblank := true; while ((i <= commandLen) and (noblank)) do if (command[i] <> ' ') then begin tempToken[i] := command[i]; i := i + 1; end else noBlank := false; totChars := i - 1; if (totChars <= SMALLSIZE) then for i:=1 to totChars do tempStr[i] := tempToken[i] else begin totChars := 2; tempStr := cBADTOKEN; end; k := 1; for j:=(totChars+1) to commandLen do begin command[k] := command[j]; k := k + 1; end; commandLen := commandLen - totChars; end; { Routine to compare strings for symbol comparison. } function CompareStr(command, symbol : string13; commandLen, symbolLen : integer) : boolean; var i : integer; sameStr : boolean; begin sameStr := true; i := 1; while (sameStr and (i <= commandLen)) do if command[i] <> symbol[i] then sameStr := false else i := i + 1; i := i - 1; CompareStr := sameStr and (i >= symbolLen); end; procedure StrUpcase(var command : string80; commandLen : integer); var i, diff : integer; begin diff := ord('a') - ord('A'); for i:=1 to commandLen do if ((command[i] >= 'a') and (command[i] <= 'z')) then command[i] := chr(ord(command[i]) - diff); end; function IsNumeric( token : string13; var tokLen, value : integer; typeToken : integer) : boolean; const %include 'kermdir:pglobal.pas/nolist' var goodChar : boolean; upBound : char; base, i : integer; begin value := 0; i := 1; goodChar := true; upBound := '9'; base := 10; if (typeToken = OCTAL) then begin upBound := '7'; base := 8; end; while ((i <= tokLen) and (goodChar)) do if ((token[i] >= '0') and (token[i] <= upBound)) then begin value := (value*base) + (ord(token[i]) - ord('0')); i := i + 1; end else begin goodChar := false; value := 0; end; goodChar := goodChar and (tokLen > 0); if (typeToken = OCTAL) then IsNumeric := goodChar and ((value >= 0) and (value <= 31)) else if (typeToken = SDECIMAL) then IsNumeric := goodChar and ((value >= MINPACKETSIZE) and (value <= MAXPACKETSIZE)) else if (typeToken = IDECIMAL) then IsNumeric := goodChar and ((value = o300BAUD) or (value = o600BAUD) or (value = o1200BAUD) or (value = o2400BAUD) or (value = o4800BAUD) or (value = o9600BAUD)) else IsNumeric := goodChar and ((value >= 0) and (value <= 99)) end; { Print the ? help message for main menu. } procedure PrintMainHelp; begin writeln(' send '); writeln(' receive []'); writeln(' status'); writeln(' connect'); writeln(' set