diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-25 16:40:34 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-25 16:40:34 +0200 |
commit | e42601eb5acc07417b217dfed4e9ab8cbb91794f (patch) | |
tree | 76e7dacd2e8d93012fecf2c29fcb4d14e6d1baed /src/ft_f_fail.c | |
parent | (fd)>qwe fd agregation redir works (diff) | |
download | 42-minishell-e42601eb5acc07417b217dfed4e9ab8cbb91794f.tar.gz 42-minishell-e42601eb5acc07417b217dfed4e9ab8cbb91794f.tar.bz2 42-minishell-e42601eb5acc07417b217dfed4e9ab8cbb91794f.tar.xz 42-minishell-e42601eb5acc07417b217dfed4e9ab8cbb91794f.tar.zst 42-minishell-e42601eb5acc07417b217dfed4e9ab8cbb91794f.zip |
Stupid bash rule
Diffstat (limited to 'src/ft_f_fail.c')
-rw-r--r-- | src/ft_f_fail.c | 27 |
1 files changed, 16 insertions, 11 deletions
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 <errno.h> #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); } |