mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 03:16:51 +01:00
「🔨」 fix(prints): fixed prints to error output
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */
|
/* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */
|
||||||
/* Updated: 2024/08/14 10:18:44 by mmoussou ### ########.fr */
|
/* Updated: 2024/08/14 10:20:57 by mmoussou ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ int exec_fork_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
|
|||||||
if (exec.status == -1 || !input || check_file(cmd->cmd, input))
|
if (exec.status == -1 || !input || check_file(cmd->cmd, input))
|
||||||
{
|
{
|
||||||
if (exec.status == -1)
|
if (exec.status == -1)
|
||||||
ft_printf("%s%s\n", ERROR_NO_CMD, input, get_exit_code(127));
|
ft_printf_fd(2, "%s%s\n", ERROR_NO_CMD, input, get_exit_code(127));
|
||||||
free(input);
|
free(input);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ int exec_single_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
|
|||||||
if (exec.status == -1)
|
if (exec.status == -1)
|
||||||
get_exit_code(127);
|
get_exit_code(127);
|
||||||
if (exec.status == -1)
|
if (exec.status == -1)
|
||||||
printf("minishell : command not found: %s\n", input);
|
ft_printf_fd(2, "minishell : command not found: %s\n", input);
|
||||||
free(input);
|
free(input);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/09 19:25:18 by adjoly #+# #+# */
|
/* Created: 2024/07/09 19:25:18 by adjoly #+# #+# */
|
||||||
/* Updated: 2024/08/14 08:07:55 by mmoussou ### ########.fr */
|
/* Updated: 2024/08/14 10:23:48 by mmoussou ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ int check_file(char *cmd, char *input)
|
|||||||
if (status || !cmd || !*cmd)
|
if (status || !cmd || !*cmd)
|
||||||
{
|
{
|
||||||
get_exit_code(127);
|
get_exit_code(127);
|
||||||
printf("minishell : command not found: %s\n", input);
|
ft_printf_fd(2, "minishell : command not found: %s\n", input);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if (!S_ISDIR(entry.st_mode) && !access(cmd, X_OK))
|
if (!S_ISDIR(entry.st_mode) && !access(cmd, X_OK))
|
||||||
@ -111,12 +111,12 @@ int check_file(char *cmd, char *input)
|
|||||||
if (S_ISDIR(entry.st_mode))
|
if (S_ISDIR(entry.st_mode))
|
||||||
{
|
{
|
||||||
get_exit_code(126);
|
get_exit_code(126);
|
||||||
printf("minishell : %s is a directory.\n", input);
|
ft_printf_fd(2, "minishell : %s is a directory.\n", input);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
get_exit_code(127);
|
get_exit_code(127);
|
||||||
printf("minishell : command not found: %s\n", input);
|
ft_printf_fd(2, "minishell : command not found: %s\n", input);
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user