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"
|
#include "Pish.h"
|
||||||
|
|
||||||
// Dummy function for Pish to run
|
// Dummy function for Pish to run
|
||||||
char* getcmd(void)
|
char* getInput(void)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -22,18 +22,22 @@ void Pish(void)
|
|||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
char *cmd = getcmd();
|
char* command = getInput();
|
||||||
int retval = fork();
|
int retval = fork();
|
||||||
|
// Child
|
||||||
if (retval == 0)
|
if (retval == 0)
|
||||||
{
|
{
|
||||||
// This is the child process
|
// This is the child process
|
||||||
// Setup the child's process environment here
|
// Setup the child's process environment here
|
||||||
// E.g., where is standard I/O, how to handle signals?
|
// E.g., where is standard I/O, how to handle signals?
|
||||||
exec(cmd);
|
exec(command);
|
||||||
// exec does not return if it succeeds
|
// 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);
|
exit(1);
|
||||||
} else {
|
}
|
||||||
|
// Parent
|
||||||
|
else
|
||||||
|
{
|
||||||
// This is the parent process; Wait for the child to finish
|
// This is the parent process; Wait for the child to finish
|
||||||
int pid = retval;
|
int pid = retval;
|
||||||
wait(pid);
|
wait(pid);
|
||||||
|
Loading…
Reference in New Issue
Block a user