Adjusted comments and added temporary tests for functions

This commit is contained in:
TriantaTV 2022-10-19 21:46:44 -05:00
parent 7cfdc280cf
commit f3f0a2cbf2

View File

@ -2,28 +2,31 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "Integrated.h"
#include "Pish.h" #include "Pish.h"
// Dummy function for Pish to run // Prints a prompt and then reads a command from the terminal
char* getInput(void) char* getInput(void)
{ {
; return "echo hello world";
} }
// Dummy function for Pish to run // Executes a command to the system
void exec(char* command) void exec(char* command)
{ {
; system(command);
} }
// Main function for Pish program
void Pish(void) void Pish(void)
{ {
char* command;
int retval;
while (1) while (1)
{ {
char* command = getInput(); command = getInput();
int retval = fork(); IntegratedCheck(command);
retval = fork();
// Child // Child
if (retval == 0) if (retval == 0)
{ {
@ -42,5 +45,7 @@ void Pish(void)
int pid = retval; int pid = retval;
wait(pid); wait(pid);
} }
// TODO: Remove break when while loop doesn't break program
break;
} }
} }