replaced occurrences of last exit_status

+ deleted envp comments
+ WIP Macro exit status
+ TODO : Invalid free of environ in readline
This commit is contained in:
LuckyLaszlo
2021-11-27 12:59:16 +01:00
parent 843b6d84c5
commit 3baf91afb3
16 changed files with 59 additions and 65 deletions

View File

@@ -1,9 +1,6 @@
#include "minishell.h"
// a integrer dans header
char *init_prompt(char *prompt_base);
int builtin_cd(int argc, char *argv[], t_all *c)
{
(void)argc;

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 05:01:26 by lperrey #+# #+# */
/* Updated: 2021/11/26 21:51:48 by lperrey ### ########.fr */
/* Updated: 2021/11/27 11:18:55 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,7 +16,6 @@ int builtin_env(int argc, char *argv[], t_all *c) // WIP
{
(void)argc;
(void)argv;
//ft_putendl_arr_fd(c->envp, 1);
ft_putendl_arr_fd(environ, 1);
return (0);
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 05:01:22 by lperrey #+# #+# */
/* Updated: 2021/10/22 14:49:01 by lperrey ### ########.fr */
/* Updated: 2021/11/27 10:47:32 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,7 +17,7 @@ int builtin_exit(int argc, char *argv[], t_all *c) // WIP
unsigned char status;
int i;
status = c->last_exit_status;
status = get_last_exit_status();
if (argc > 2)
return (ft_reti_print(1, "exit: too many arguments\n", 2));
if (argc == 2)

View File

@@ -1,7 +1,7 @@
#include "minishell.h"
int getenv_position(char **envp, char *name)
int getenv_position(char **envp, char *name) // TODO : virer arg envp et utiliser "extern **environ" à la place
{
int i;
@@ -26,7 +26,7 @@ int builtin_export(int argc, char *argv[], t_all *c)
environ = ft_resize_2d_arr(environ, 1);
environ[env_position] = ft_strdup(argv[1]);
if (!ft_strncmp(var[0], "PATH", 4 + 1))
c->path = retrieve_path(environ);
c->path = retrieve_path();
// free var
return (0);
}