|
@@ -114,7 +114,6 @@ int get_command(Command* c, char* line){
|
|
|
c->error = STDERR;
|
|
|
c->erase[0] = false;
|
|
|
c->erase[1] = false;
|
|
|
- c->bck = false;
|
|
|
//Trim et supprime l'ancienne chaine
|
|
|
old = c->cmd;
|
|
|
c->cmd = rtrim(c->cmd, ' ');
|
|
@@ -436,11 +435,6 @@ int split_command(Command* c, char* cmd){
|
|
|
c->argv[i] = malloc(sizeof(char) * length);
|
|
|
strncpy(c->argv[i++], deb, length);
|
|
|
}
|
|
|
- //Regarde si le caractère de fin est &
|
|
|
- if(*cmd == '&'){
|
|
|
- //Alors en fond
|
|
|
- c->bck = true;
|
|
|
- }
|
|
|
//Set la dernière case du tableau à null
|
|
|
c->argv[i] = NULL;
|
|
|
return SHELL_OK;
|
|
@@ -460,6 +454,7 @@ int parse_line(CommandTab* ct, char* line){
|
|
|
//Initialisation structure
|
|
|
ct->cmd = malloc(sizeof(Command*) * compteur);
|
|
|
ct->length = compteur;
|
|
|
+ ct->bck = line[strlen(line) - 1] == '&';
|
|
|
//Recupération de chaque commande
|
|
|
for(int i = 0; i < compteur; i++){
|
|
|
ct->cmd[i] = malloc(sizeof(Command));
|