module diskio;
{
	A file of diskio routines.

}


procedure getarg(var narg:integer;var arg1,arg2:string);
{
	This procedure gets the arguments from the command line
    and returns them as strings. narg is the number detected
}

const	cpm_buf_adr = $80;
	sp = ' ';

var	p:	^byte;
	sep:	integer;
	cmd_line:
		string;

begin
	arg1:='';
	arg2:='';
	p:=cpm_buf_adr;
	move(p^,cmd_line,sizeof(cmd_line));
	while pos(sp,cmd_line) = 1 do delete(cmd_line,1,1);
	if length(cmd_line) = 0
	    then narg := 0
	    else
		begin
		    sep:=pos(sp,cmd_line);
		    if sep = 0
			then
			    begin
				narg:=1;
				arg1:=cmd_line;
			    end
			else
			    begin
				arg1:=copy(cmd_line,1,sep-1);
				delete(cmd_line,1,sep);
				while copy(cmd_line,1,1)=sp do
				   delete(cmd_line,1,1);
				narg:=2;
				arg2:=cmd_line;
			    end;
		end;
end;

modend.
