summaryrefslogtreecommitdiffstats
path: root/src/ft_f_fail.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_f_fail.c27
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);
}