|
|
@ -6,7 +6,7 @@ |
|
|
|
/* By: mea <marvin@42.fr> +#+ +:+ +#+ */ |
|
|
|
/* +#+#+#+#+#+ +#+ */ |
|
|
|
/* Created: 2022/05/02 12:14:09 by narnaud #+# #+# */ |
|
|
|
/* Updated: 2022/05/05 15:31:45 by mea ### ########.fr */ |
|
|
|
/* Updated: 2022/05/05 16:28:15 by mea ### ########.fr */ |
|
|
|
/* */ |
|
|
|
/* ************************************************************************** */ |
|
|
|
|
|
|
@ -16,13 +16,9 @@ void handle_status(t_datas *datas, int status) |
|
|
|
{ |
|
|
|
if (WIFSIGNALED(status)) |
|
|
|
{ |
|
|
|
datas->exit_code = WTERMSIG(status); |
|
|
|
if (datas->exit_code == 3) |
|
|
|
datas->exit_code = 128 + WTERMSIG(status); |
|
|
|
if (datas->exit_code == 131) |
|
|
|
printf("Quit: 3\n"); |
|
|
|
if (datas->exit_code == 9) |
|
|
|
printf("Kill: 15\n"); |
|
|
|
if (datas->exit_code == 15) |
|
|
|
printf("Terminated: 15\n"); |
|
|
|
} |
|
|
|
else |
|
|
|
datas->exit_code = WEXITSTATUS(status); |
|
|
@ -40,7 +36,8 @@ int caller(t_datas *datas, t_command *cmd) |
|
|
|
cmd->fd[1] = pip[1]; |
|
|
|
cmd->next->fd[0] = pip[0]; |
|
|
|
} |
|
|
|
if (!cmd->prev && !cmd->next && command_call(datas, cmd) != -1) |
|
|
|
|
|
|
|
if (!cmd->prev && !cmd->next && command_call(datas, cmd) != -1)//check_builtin(cmd->argv[0]))
|
|
|
|
return (1); |
|
|
|
pid = fork(); |
|
|
|
if (!pid) |
|
|
@ -108,10 +105,7 @@ t_token *lexer(t_datas *datas, char *line) |
|
|
|
if (check_state(lex, &line)) |
|
|
|
continue; |
|
|
|
if (lex->state != S_QUOTE_ST && *line == '$') |
|
|
|
{ |
|
|
|
tmp_i = replace_var(datas, &line, tmp, tmp_i); |
|
|
|
printf("TEST tmpi %d\n", tmp_i); |
|
|
|
} |
|
|
|
if (check_register(lex, &line, tmp)) |
|
|
|
{ |
|
|
|
tmp_i = 0; |
|
|
|