From 487a66394061f2d14a2fa421302966b5442d643f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 27 Jul 2020 18:55:07 +0200 Subject: I couldn't see shit --- src/f_fail.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/f_fail.c (limited to 'src/f_fail.c') diff --git a/src/f_fail.c b/src/f_fail.c new file mode 100644 index 0000000..aae00fb --- /dev/null +++ b/src/f_fail.c @@ -0,0 +1,58 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* f_fail.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include +#include +#include + +#include "d_define.h" +#include "s_struct.h" + +static void + write_fail(const char concern[], + const char msg[], + t_msh *msh) +{ + ft_dprintf(STDERR_FILENO, "%s: %s: %s\n", msh->shname, concern, msg); +} + +void + fail_no_options(const char concern[], + t_msh *msh) +{ + write_fail(concern, FT_FAIL_NO_OPTIONS, msh); +} + +void + fail_identifier(const char concern[], + const char identifier[], + t_msh *msh) +{ + ft_dprintf(STDERR_FILENO, "%s: %s: `%s': not a valid identifier\n", + msh->shname, concern, identifier); +} + +void + fail_too_many_args(const char concern[], + t_msh *msh) +{ + write_fail(concern, FT_FAIL_TOO_MANY_ARGS, msh); +} + +void + fail_alloc(t_msh *msh) +{ + ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); + exit(FT_RET_ALLOC); +} -- cgit v1.2.3 From c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 30 Jul 2020 20:30:58 +0200 Subject: Double exit no more --- src/f_fail.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/f_fail.c') diff --git a/src/f_fail.c b/src/f_fail.c index aae00fb..a3a1df1 100644 --- a/src/f_fail.c +++ b/src/f_fail.c @@ -28,14 +28,14 @@ static void } void - fail_no_options(const char concern[], + f_fail_no_options(const char concern[], t_msh *msh) { write_fail(concern, FT_FAIL_NO_OPTIONS, msh); } void - fail_identifier(const char concern[], + f_fail_identifier(const char concern[], const char identifier[], t_msh *msh) { @@ -44,14 +44,14 @@ void } void - fail_too_many_args(const char concern[], + f_fail_too_many_args(const char concern[], t_msh *msh) { write_fail(concern, FT_FAIL_TOO_MANY_ARGS, msh); } void - fail_alloc(t_msh *msh) + f_fail_alloc(t_msh *msh) { ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); exit(FT_RET_ALLOC); -- cgit v1.2.3 From 8680737a802539f3c21a295ad45eb9be72c73f5f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 1 Aug 2020 21:25:09 +0200 Subject: More UNIX friendly libft --- src/f_fail.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/f_fail.c') diff --git a/src/f_fail.c b/src/f_fail.c index a3a1df1..5e6824f 100644 --- a/src/f_fail.c +++ b/src/f_fail.c @@ -49,10 +49,3 @@ void { write_fail(concern, FT_FAIL_TOO_MANY_ARGS, msh); } - -void - f_fail_alloc(t_msh *msh) -{ - ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); - exit(FT_RET_ALLOC); -} -- cgit v1.2.3 From 48acb01ff5a2cf22adebfc25213c2597911b2fd4 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 4 Aug 2020 13:55:12 +0200 Subject: Unset is fine --- src/f_fail.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/f_fail.c') diff --git a/src/f_fail.c b/src/f_fail.c index 5e6824f..3704b1f 100644 --- a/src/f_fail.c +++ b/src/f_fail.c @@ -36,11 +36,10 @@ void void f_fail_identifier(const char concern[], - const char identifier[], - t_msh *msh) + const char identifier[]) { - ft_dprintf(STDERR_FILENO, "%s: %s: `%s': not a valid identifier\n", - msh->shname, concern, identifier); + ft_dprintf(STDERR_FILENO, "minishell: %s: `%s': not a valid identifier\n", + concern, identifier); } void -- cgit v1.2.3