From b1805834ecd0b477bfc4e03bcc541519b000523d Mon Sep 17 00:00:00 2001 From: Xamora Date: Tue, 4 Apr 2023 22:03:30 +0200 Subject: [PATCH] =?UTF-8?q?Les=20mendarines=20Lecler,=20en=20vrai=20=C3=A7?= =?UTF-8?q?a=20va,=20Camille=20est=20aigris=20mais=20propre,=20en=20tout?= =?UTF-8?q?=20cas=20h=C3=A2te=20Nathan=20se=20l=C3=A8ve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builtins/env.c | 2 +- builtins/exit.c | 2 +- env/env.h | 1 - env/env1.c | 2 -- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/builtins/env.c b/builtins/env.c index b601555..6b3c038 100644 --- a/builtins/env.c +++ b/builtins/env.c @@ -19,7 +19,7 @@ int print_env(t_list **env, int fd) current = *env; while (current->next != NULL) { - if (((t_env *)(current->content))->original) + if (((t_env *)(current->content))->value) { ft_putstr_fd(((t_env *)(current->content))->key, fd); ft_putstr_fd("=", fd); diff --git a/builtins/exit.c b/builtins/exit.c index bd608fd..e8732de 100644 --- a/builtins/exit.c +++ b/builtins/exit.c @@ -37,7 +37,7 @@ int ft_exit(char **args) if (err == 1) return (error(err, "exit: numeric argument required", args[0])); if (args[1] != NULL) - return (error(1, "exit: too many arguments", NULL)); + return (error(-1, "exit: too many arguments", NULL)); if (err > 0) return (error(err, "exit: numeric argument required", args[0])); write(1, "exit\n", 6); diff --git a/env/env.h b/env/env.h index f10d6f9..3c9fd31 100644 --- a/env/env.h +++ b/env/env.h @@ -20,7 +20,6 @@ typedef struct s_env { char *key; char *value; - bool original; } t_env; char *ft_env_filler(t_data *data, const char *str); diff --git a/env/env1.c b/env/env1.c index 1779321..d6001c9 100644 --- a/env/env1.c +++ b/env/env1.c @@ -82,7 +82,6 @@ int create_value_by_key(char *key, char *value, t_list **head) return (1); content->key = key; content->value = value; - content->original = 0; add_sort(head, content); return (0); } @@ -107,7 +106,6 @@ t_list **init_env(char **env) return (NULL); var->key = get_key(env[i]); var->value = get_value(env[i]); - var->original = 1; add_sort(head, var); } return (head);