Adjusted naming
This commit is contained in:
parent
31b5a5cbb5
commit
0e2f915c50
14
src/Pish.c
14
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);
|
||||
|
Loading…
Reference in New Issue
Block a user