summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4916c2)
raw | patch | inline | side by side (parent: f4916c2)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 19 Jul 2020 20:08:43 +0000 (23:08 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 19 Jul 2020 20:08:43 +0000 (23:08 +0300) |
src/posix/generic/Dsw/Mod/HostProcs.cp | patch | blob | history |
index 8516697aa512bd6390d32152d1b2a802e5ea5519..c056a8e68ccf8e56da4916f41b480ec873667e14 100644 (file)
PROCEDURE (p: Process) Execute* (OUT ok: BOOLEAN);
TYPE
UString = POINTER [untagged] TO ARRAY [untagged] OF SHORTCHAR;
- SUString = POINTER [untagged] TO ARRAY [untagged] OF UString;
+ SUString = POINTER TO ARRAY OF UString;
VAR
- i, j, adr: INTEGER; pid: unistd.pid_t; res: unistd.int; argv: SUString;
+ i: INTEGER; pid: unistd.pid_t; res: unistd.int; argv: SUString; s: String;
BEGIN
ASSERT(p.pid = -1, 20);
ASSERT(p.argv # NIL, 21);
- argv := SYSTEM.VAL(SUString, stdlib.malloc((LEN(p.argv) + 1)) * SIZE(UString));
+ NEW(argv, LEN(p.argv) + 2);
FOR i := 0 TO LEN(p.argv) - 1 DO
- argv[i] := SYSTEM.VAL(UString, SYSTEM.ADR(p.argv[i, 0]))
+ s := p.argv[i];
+ argv[i] := SYSTEM.VAL(UString, SYSTEM.ADR(s[0]))
END;
argv[i] := NIL;
pid := unistd.fork();
p.argv := NIL; (* or save it for debugging and reuse? *)
p.pid := pid;
ok := TRUE
- END;
- stdlib.free(SYSTEM.ADR(argv[0]))
+ END
END Execute;
PROCEDURE (p: Process) Terminate* (OUT ok: BOOLEAN);