fix: minishell rework
This commit is contained in:
parent
a20fa2a4c6
commit
d7032849d6
BIN
.execution.c.swp
BIN
.execution.c.swp
Binary file not shown.
11
execution.c
11
execution.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/21 12:45:16 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/21 15:06:12 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/21 15:31:02 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -20,6 +20,8 @@ static char *ft_get_executable_path(char *executable_name, t_list **env)
|
||||
char **tab;
|
||||
size_t i;
|
||||
|
||||
if (executable_name == NULL)
|
||||
return (NULL);
|
||||
path = NULL;
|
||||
if (executable_name[0] == '.' || executable_name[0] == '/')
|
||||
{
|
||||
@ -108,11 +110,12 @@ static int ft_own_cmd(t_list **env, t_cmd *cmd)
|
||||
return_code = (move_folder(cmd->args[0], cmd->fd_out));
|
||||
/* if (ft_strcmp(cmd->executable, "unset") == 0) */
|
||||
/* return_code = (unset(env, cmd->args, cmd->fd_out)); */
|
||||
else if (ft_strcmp(cmd->executable, "echo") == 0)
|
||||
return_code = (echo(cmd->fd_out, cmd->args + 1));
|
||||
/* else if (ft_strcmp(cmd->executable, "echo") == 0) */
|
||||
/* return_code = (echo(cmd->fd_out, cmd->args + 1)); */
|
||||
else if (ft_strcmp(cmd->executable, "exit") == 0)
|
||||
return_code = -2;
|
||||
cmd->executable = NULL;
|
||||
if (return_code != -1)
|
||||
cmd->executable = NULL;
|
||||
return (return_code);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/14 13:45:30 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/21 15:05:50 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/21 15:10:50 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -60,7 +60,7 @@ char *get_value(char *str);
|
||||
char *get_key(char *str);
|
||||
|
||||
/* Echo */
|
||||
int echo(int fd, char **args);
|
||||
int echo(int fd, char *str);
|
||||
/* PWD */
|
||||
int pwd(int fd);
|
||||
char *get_pwd(int fd);
|
||||
|
Loading…
Reference in New Issue
Block a user