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);