Windows.CommandLine.Mod 838 B

1234567891011121314151617181920212223242526272829303132333435
  1. MODULE CommandLine; (** AUTHOR "fof"; PURPOSE "A2 for Windows Command Line Interpreter"; *)
  2. IMPORT
  3. Kernel32,SYSTEM,Streams,FileHandlers;
  4. PROCEDURE Read(VAR commandLine: ARRAY OF CHAR);
  5. VAR adr: ADDRESS; i: LONGINT; ch: CHAR;
  6. BEGIN
  7. adr := Kernel32.GetCommandLine();
  8. SYSTEM.GET(adr,ch);
  9. i := 0;
  10. WHILE (i<LEN(commandLine)-1) & (ch # 0X) DO
  11. commandLine[i] := ch;
  12. INC(adr); INC(i);
  13. SYSTEM.GET(adr,ch);
  14. END;
  15. END Read;
  16. (* open documents specified in the command line *)
  17. PROCEDURE Open*;
  18. VAR commandLine,command,name: ARRAY 512 OF CHAR; reader: Streams.StringReader;
  19. BEGIN
  20. Read(commandLine);
  21. NEW(reader,LEN(commandLine));
  22. reader.Set(commandLine);
  23. reader.String(command);
  24. WHILE reader.GetString(name) DO
  25. FileHandlers.OpenFile(name,NIL, NIL);
  26. END;
  27. END Open;
  28. END CommandLine.
  29. SystemTools.Free CommandLine ~
  30. CommandLine.Open