From 4b0afb250a605ee7a40b1bff8981c2a3a0d7fcf6 Mon Sep 17 00:00:00 2001 From: Michael Ea Date: Thu, 5 May 2022 16:35:23 +0200 Subject: [PATCH] TO-DO list added, fixed empty line, rm useless sig msg --- README.md | 12 +++++++++--- minishell.c | 16 +++++----------- utils.c | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 45ff735..62423c1 100755 --- a/README.md +++ b/README.md @@ -3,10 +3,16 @@ ## TODO : - free stack, -- finish built-ins, +- protect mallocs, +- Norminette +- Finish check_builtin(); -## Notes : +- export : edit datas->env +- unset : idem, +- exit: handle arguments +- setup correct ext_codes + https://wiki.bash-hackers.org/scripting/basics?s[]=variables#exit_codes ## Issues : -- cat | cat | ls crash on linux ? + diff --git a/minishell.c b/minishell.c index 4786702..067bfb3 100755 --- a/minishell.c +++ b/minishell.c @@ -6,7 +6,7 @@ /* By: mea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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; diff --git a/utils.c b/utils.c index 8c6e5d9..2d4da7e 100755 --- a/utils.c +++ b/utils.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* utils.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: narnaud +#+ +:+ +#+ */ +/* By: mea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/03 08:57:53 by narnaud #+# #+# */ -/* Updated: 2022/05/05 09:18:28 by narnaud ### ########.fr */ +/* Updated: 2022/05/05 16:33:21 by mea ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,7 @@ int is_empty(char *line) { while (*line) { - if (*line <= 9 || (*line >= 13 && *line != 32)) + if (*line < 9 || (*line > 13 && *line != 32)) return (0); line++; }