home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
PASCAL
/
MADTRB21.ZIP
/
PARSTAIL.SRC
< prev
next >
Wrap
Text File
|
1985-01-19
|
2KB
|
36 lines
{--------------------------------------------------}
{ PARSE_TAIL }
{ Parses the command tail into up to ten strings. }
{ By Jeff Duntemann }
{ }
{ ASSUMES: }
{ TYPE PARM_ARRAY = ARRAY[0..10] OF STRING[80] }
{ VAR }
{ dos: RAM_TAIL : STRING[128] ABSOLUTE CSEG : $80 }
{ cp/m:RAM_TAIL : STRING[128] ABSOLUTE $80; }
{ also, that function STRIP_WHITE is present }
{ }
{ Turbo Pascal V2.0 }
{ Last update: 12/11/84 }
{--------------------------------------------------}
PROCEDURE PARSE_TAIL(VAR COUNT : INTEGER; VAR PARMS : PARM_ARRAY);
VAR MARKER : INTEGER;
TAIL : STRING[128]; { The command tail is never over 128 bytes long }
BEGIN
TAIL := RAM_TAIL; { An absolute variable containing the command tail }
COUNT := 0;
TAIL := STRIP_WHITE(TAIL);
IF LENGTH(TAIL) > 0 THEN
REPEAT { Until 10 parms parsed or tail is all gone }
MARKER := POS(' ',TAIL) - 1;
IF MARKER <= 0 THEN MARKER := LENGTH(TAIL);
COUNT := COUNT + 1;
PARMS[COUNT] := COPY(TAIL,1,MARKER);
DELETE(TAIL,1,MARKER);
TAIL := STRIP_WHITE(TAIL)
UNTIL (COUNT >= 10) OR (LENGTH(TAIL) = 0)
END;