exit status Macro

This commit is contained in:
LuckyLaszlo
2021-11-29 12:42:52 +01:00
parent cb5c2dcb30
commit 33f4878f36
3 changed files with 11 additions and 11 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/11 18:46:43 by lperrey #+# #+# */
/* Updated: 2021/11/26 21:45:17 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:38:58 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -93,7 +93,7 @@ static int here_doc_write(char *delimiter, int doc_fd)
line = NULL;
line = readline("> ");
if (g_switch_heredoc_sigint == 1)
return (set_last_exit_status(128 + SIGINT)); // TODO Macro for error
return (set_last_exit_status(EXIT_SIGNAL + SIGINT));
if (!line)
{ // TODO : error print wrapper
ft_putstr_fd("minishell: ", 2);

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/11 18:46:43 by lperrey #+# #+# */
/* Updated: 2021/11/29 12:28:25 by lperrey ### ########.fr */
/* Updated: 2021/11/29 12:39:05 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -60,7 +60,7 @@ static int redirect_cmd_input(t_token *t, t_cmd *cmd)
if (cmd->fd_in == -1)
{
ft_perror_io("open() ", t->next->content); // todo error
cmd->error = 42; // WIP error status
cmd->error = EXIT_REDIRECTION;
}
}
else if (t->id == T_DLESS)
@@ -69,9 +69,9 @@ static int redirect_cmd_input(t_token *t, t_cmd *cmd)
if (cmd->fd_in == -1)
{
ft_putstr_fd("minishell: heredoc error\n", 2);
cmd->error = 42; // WIP error status
cmd->error = EXIT_REDIRECTION;
}
else if (cmd->fd_in > 128) // TODO Macro
else if (cmd->fd_in > EXIT_SIGNAL)
return (0);
}
return (1);
@@ -98,7 +98,7 @@ static int redirect_cmd_output(t_token *t, t_cmd *cmd)
if (cmd->fd_out == -1)
{
ft_perror_io("open() ", t->next->content);
cmd->error = 42; // WIP error status
cmd->error = EXIT_REDIRECTION;
}
return (1);
}