Category : Modula II Source Code
Archive   : FLXCPY10.ZIP
Filename : CMDLINE.MOD

 
Output of file : CMDLINE.MOD contained in archive : FLXCPY10.ZIP
IMPLEMENTATION MODULE CmdLine;

FROM GetEnvName IMPORT GetEnvName;
FROM SYSTEM IMPORT ADDRESS, ADR;
FROM Loader IMPORT ProgPrefixAddress;


VAR
i, cnt, l : CARDINAL; (* counters, length of command line *)

(* Break command line, return count and pointers to variables *)
PROCEDURE ReadCmdLine( VAR ArgC : CARDINAL;
VAR ArgV : ARRAY OF ParmPtr);

BEGIN (* ReadCmdLine *)
l := ORD( ProgPrefixAddress^.CommText[-1]);
i := 0;
cnt := 0;
WITH ProgPrefixAddress^ DO
LOOP
WHILE (CommText[i] = ' ') DO (* skip over spaces *)
INC( i);
END; (* WHILE (CommText[i] = ' ') *)
IF (CommText[i] = 0x) THEN
EXIT;
ELSE
ArgV[cnt] := ADR( CommText[i]);
INC( cnt);
IF (cnt >= HIGH( ArgV)+1) THEN
EXIT;
END;
END;
WHILE (CommText[i] <> ' ') DO
INC( i);
IF (CommText[i] = 0x) THEN
EXIT;
END;
END; (* WHILE (CommText[i] <> ' ') *)
CommText[i] := 0x; (* terminate this argument *)
INC( i);
END; (* LOOP *)
CommText[-1] := 0x; (* only parse once *)
END; (* WITH *)
ArgC := cnt;
END ReadCmdLine;

END CmdLine.


  3 Responses to “Category : Modula II Source Code
Archive   : FLXCPY10.ZIP
Filename : CMDLINE.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/