home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
TURBOPAS
/
TKERMIT.LBR
/
KCMD.PQS
/
KCMD.PAS
Wrap
Pascal/Delphi Source File
|
2000-06-30
|
4KB
|
110 lines
procedure parse; (* separate the words on the command line *)
begin (* parse *)
line_command := '';
arg1 := '';
arg2 := '';
arg3 := '';
ltrim(line_buffer);
if length(line_buffer) > 0 then
rtrim(line_buffer);
if length(line_buffer) > 0 then
begin
if pos(' ',line_buffer) > 0 then
line_command := copy(line_buffer,1,pos(' ',line_buffer))
else
line_command := line_buffer;
end;
if pos(' ',line_buffer) > 0 then
delete(line_buffer,1,pos(' ',line_buffer))
else
line_buffer := '';
ltrim(line_buffer);
if length(line_buffer) > 0 then
begin
if pos(' ',line_buffer) > 0 then
arg1 := copy(line_buffer,1,pos(' ',line_buffer))
else
arg1 := line_buffer;
end;
if pos(' ', line_buffer) > 0 then
delete(line_buffer,1,pos(' ',line_buffer))
else
line_buffer := '';
ltrim(line_buffer);
if length(line_buffer) > 0 then
begin
if pos(' ',line_buffer) > 0 then
arg2 := copy(line_buffer,1,pos(' ',line_buffer))
else
arg2 := line_buffer;
end;
if pos(' ', line_buffer) > 0 then
delete(line_buffer,1,pos(' ',line_buffer))
else
line_buffer := '';
ltrim(line_buffer);
if length(line_buffer) > 0 then
begin
if pos(' ',line_buffer) > 0 then
arg3 := copy(line_buffer,1,pos(' ',line_buffer))
else
arg3 := line_buffer;
end;
end; (* parse *)
(*----------------------------------------------------------------*)
procedure prompt; (* write the prompt message *)
begin
write('TKermit>');
end;
(*----------------------------------------------------------------*)
procedure get_cmd_line; (* read the command line *)
begin
readln(line_buffer);
if length(line_buffer) > 0 then
begin
parse;
case line_command[1] of
'C','c' : term;
'D','d' : dir;
'E','e' : begin
case line_command[2] of
'R','r' : delfile;
'X','x' : quit;
end; (* case *)
end;
'B','b','L','l','F','f' : finish;
'G','g' : begin
clrscr;
state := get_file;
receive;
end;
'H','h' : help;
'Q','q' : quit;
'R','r' : begin
clrscr;
state := receive_init;
receive;
end;
'S','s' : begin
case line_command[2] of
'E','e' : case line_command[3] of
'N','n' : send;
'T','t' : set_param;
end; (* case *)
'H','h' : show;
end; (* case *)
end; (* case s *)
else
writeln('Unimplemented command, type Help for list of commands.');
end; (* case *)
end;
end;