fprintf->ft_printf_fd

This commit is contained in:
2024-04-23 16:42:13 +02:00
parent b7755111f6
commit 905bbc659b
7 changed files with 21 additions and 21 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/16 21:02:54 by marde-vr #+# #+# */
/* Updated: 2024/04/22 13:28:52 by marde-vr ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,7 +18,7 @@ int cd(t_token *args)
if (args->next && args->next->next)
{
fprintf(stderr, "minishell: cd: too many arguments\n");
ft_printf_fd(2, "minishell: cd: too many arguments\n");
return (1);
}
if (!args->next)

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/24 17:44:32 by marde-vr #+# #+# */
/* Updated: 2024/04/19 20:00:04 by tomoron ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,8 +24,8 @@ void get_here_doc_input(t_msh *msh, char *eof)
line = readline("> ");
if (!line)
{
fprintf(stderr, "\nminishell: warning: here-document delimited by");
fprintf(stderr, " end-of-file, wanted %s", eof);
ft_printf_fd(2, "\nminishell: warning: here-document delimited by");
ft_printf_fd(2, " end-of-file, (wanted `%s')", eof);
break ;
}
if (line && !ft_strncmp(line, eof, ft_strlen(eof)))

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */
/* Updated: 2024/04/22 19:50:00 by marde-vr ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -53,7 +53,7 @@ int open_input_file(t_msh *msh, t_cmd **cur_token)
filename = parse_tokens((*cur_token)->value, msh->env);
if (!filename)
ft_exit(msh, 1);
fprintf(stderr, "minishell: %s: ", filename->value);
ft_printf_fd(2, "minishell: %s: ", filename->value);
perror("");
free_token(filename);
return (1);

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 17:31:53 by marde-vr #+# #+# */
/* Updated: 2024/04/18 20:48:54 by marde-vr ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,9 +16,9 @@ int is_fd_open(int fd)
{
if (fcntl(fd, F_GETFL) == -1)
{
fprintf(stderr, "%d:closed\n", fd);
ft_printf_fd(2, "%d:closed\n", fd);
return (0);
}
fprintf(stderr, "%d:open\n", fd);
ft_printf_fd(2, "%d:open\n", fd);
return (1);
}

View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 14:40:44 by tomoron #+# #+# */
/* Updated: 2024/04/23 16:34:20 by tomoron ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -131,14 +131,14 @@ void print_syntax_error_bonus(t_cmd *cmd)
{
if (cmd->cmd_type == CMD || cmd->cmd_type == PAREN)
return ;
fprintf(stderr, "minishell : syntax error near unexpected token `");
ft_printf_fd(2, "minishell : syntax error near unexpected token `");
if (cmd->cmd_type == AND)
fprintf(stderr, "&&");
ft_printf_fd(2, "&&");
if (cmd->cmd_type == OR)
fprintf(stderr, "||");
ft_printf_fd(2, "||");
if (cmd->cmd_type == PIPE)
fprintf(stderr, "|");
fprintf(stderr, "'\n");
ft_printf_fd(2, "|");
ft_printf_fd(2, "'\n");
}

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/21 21:47:15 by marde-vr #+# #+# */
/* Updated: 2024/04/22 14:33:46 by marde-vr ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -94,7 +94,7 @@ void get_cmd_path(t_msh *msh)
get_path(msh, &found);
if (!found)
{
fprintf(stderr, "%s: command not found\n", msh->tokens->value);
ft_printf_fd(2, "%s: command not found\n", msh->tokens->value);
free(msh->tokens->value);
msh->tokens->value = 0;
g_return_code = 127;

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:19:26 by marde-vr #+# #+# */
/* Updated: 2024/04/22 19:53:16 by marde-vr ### ########.fr */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -87,7 +87,7 @@ int file_access(t_msh *msh, int *found)
if (fd != -1)
{
close(fd);
fprintf(stderr, "minishell: %s: Is a directory\n", msh->tokens->value);
ft_printf_fd(2, "minishell: %s: Is a directory\n", msh->tokens->value);
g_return_code = 126;
return (0);
}
@ -95,7 +95,7 @@ int file_access(t_msh *msh, int *found)
*found = 1;
else
{
fprintf(stderr, "minishell: %s: ", msh->tokens->value);
ft_printf_fd(2, "minishell: %s: ", msh->tokens->value);
perror("");
g_return_code = 127;
if (access(msh->tokens->value, F_OK) != -1)