LibC+Shell: Make system() actually work.

system() will now fork off a child process and execute the command via
/bin/sh -c. There are probably some things to fix here, but it's a start.
This commit is contained in:
Andreas Kling 2019-05-13 04:52:55 +02:00
commit 43604bf71a
Notes: sideshowbarker 2024-07-19 14:09:39 +09:00
2 changed files with 14 additions and 4 deletions

View file

@ -413,9 +413,10 @@ int main(int argc, char** argv)
endpwent();
}
if (argc > 1 && !strcmp(argv[1], "-c")) {
fprintf(stderr, "FIXME: Implement /bin/sh -c\n");
return 1;
if (argc > 2 && !strcmp(argv[1], "-c")) {
dbgprintf("sh -c '%s'\n", argv[2]);
run_command(argv[2]);
return 0;
}
{