From e42601eb5acc07417b217dfed4e9ab8cbb91794f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 25 Apr 2020 16:40:34 +0200 Subject: Stupid bash rule --- src/ft_f_fail.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/ft_f_fail.c') diff --git a/src/ft_f_fail.c b/src/ft_f_fail.c index b43281d..3f43bae 100644 --- a/src/ft_f_fail.c +++ b/src/ft_f_fail.c @@ -17,37 +17,42 @@ #include #include "ft_d_define.h" +#include "ft_s_struct.h" static void ft_write_fail(const char concern[], - const char msg[]) + const char msg[], + t_msh *msh) { - ft_dprintf(STDERR_FILENO, "minishell: %s: %s\n", concern, msg); + ft_dprintf(STDERR_FILENO, "%s: %s: %s\n", msh->shname, concern, msg); } void - ft_fail_no_options(const char concern[]) + ft_fail_no_options(const char concern[], + t_msh *msh) { - ft_write_fail(concern, FT_FAIL_NO_OPTIONS); + ft_write_fail(concern, FT_FAIL_NO_OPTIONS, msh); } void ft_fail_identifier(const char concern[], - const char identifier[]) + const char identifier[], + t_msh *msh) { - ft_dprintf(STDERR_FILENO, - "minishell: %s: `%s': not a valid identifier\n", concern, identifier); + ft_dprintf(STDERR_FILENO, "%s: %s: `%s': not a valid identifier\n", + msh->shname, concern, identifier); } void - ft_fail_too_many_args(const char concern[]) + ft_fail_too_many_args(const char concern[], + t_msh *msh) { - ft_write_fail(concern, FT_FAIL_TOO_MANY_ARGS); + ft_write_fail(concern, FT_FAIL_TOO_MANY_ARGS, msh); } void - ft_fail_alloc(void) + ft_fail_alloc(t_msh *msh) { - ft_write_fail("minishell", strerror(errno)); + ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); exit(FT_RET_ALLOC); } -- cgit v1.2.3