merge main.c
This commit is contained in:
parent
bea145636d
commit
f58c73258b
@ -1,3 +1,4 @@
|
|||||||
|
#include <sys/wait.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -21,6 +22,10 @@ int execute(cmd** input, char** env)
|
|||||||
// on tue l'enfant (l'enfant devient la commande entrée par l'utilisateur)
|
// on tue l'enfant (l'enfant devient la commande entrée par l'utilisateur)
|
||||||
exitcode = execve(input[i]->executable, input[i]->args, env);
|
exitcode = execve(input[i]->executable, input[i]->args, env);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waitpid(pid, &exitcode, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return exitcode;
|
return exitcode;
|
||||||
}
|
}
|
||||||
@ -66,5 +71,3 @@ int builtin_execute(cmd** input, char** env)
|
|||||||
}
|
}
|
||||||
return exitcode;
|
return exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
4
src/exec/exec.h
Normal file
4
src/exec/exec.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
int execute(cmd** input, char** env);
|
||||||
|
int builtin_execute(cmd** input, char** env);
|
@ -1,6 +1,8 @@
|
|||||||
#include "./env/env.h"
|
#include "./env/env.h"
|
||||||
#include "./input/input.h"
|
#include "./input/input.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "cmd/cmd.h"
|
||||||
|
#include "./exec/exec.h"
|
||||||
|
|
||||||
int main(int ac, char **av, char **env_str)
|
int main(int ac, char **av, char **env_str)
|
||||||
{
|
{
|
||||||
@ -20,4 +22,5 @@ int main(int ac, char **av, char **env_str)
|
|||||||
}
|
}
|
||||||
lst_clear(env, &env_del);
|
lst_clear(env, &env_del);
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user