From 0e2f915c5058761b02c6680b25256b83d34f5a87 Mon Sep 17 00:00:00 2001 From: TriantaTV Date: Wed, 19 Oct 2022 21:14:59 -0500 Subject: [PATCH] Adjusted naming --- src/Pish.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Pish.c b/src/Pish.c index 576a2e7..a1f5d20 100644 --- a/src/Pish.c +++ b/src/Pish.c @@ -5,7 +5,7 @@ #include "Pish.h" // Dummy function for Pish to run -char* getcmd(void) +char* getInput(void) { ; } @@ -22,18 +22,22 @@ void Pish(void) { while (1) { - char *cmd = getcmd(); + char* command = getInput(); int retval = fork(); + // Child if (retval == 0) { // This is the child process // Setup the child's process environment here // E.g., where is standard I/O, how to handle signals? - exec(cmd); + exec(command); // exec does not return if it succeeds - printf("ERROR: Could not execute %s\n", cmd); + printf("ERROR: Could not execute %s\n", command); exit(1); - } else { + } + // Parent + else + { // This is the parent process; Wait for the child to finish int pid = retval; wait(pid);