#include #include #include #include #include "Integrated.h" #include "Pish.h" // Prints a prompt and then reads a command from the terminal char* getInput(void) { return "echo hello world"; } // Executes a command to the system void exec(char* command) { system(command); } // Main function for Pish program void Pish(void) { char* command; int retval; while (1) { command = getInput(); IntegratedCheck(command); 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(command); // exec does not return if it succeeds printf("ERROR: Could not execute %s\n", command); exit(1); } // Parent else { // This is the parent process; Wait for the child to finish int pid = retval; wait(pid); } // TODO: Remove break when while loop doesn't break program break; } }