summaryrefslogtreecommitdiffstats
path: root/src/ft_f_fail.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-21 17:26:12 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-21 17:26:12 +0200
commitcc4ede7ead7622c096bc598aad3e10baf93c4350 (patch)
treeb21c1c5137968306462c67542f7e622c11d2a5a7 /src/ft_f_fail.c
parentNo more leaks (diff)
download42-minishell-cc4ede7ead7622c096bc598aad3e10baf93c4350.tar.gz
42-minishell-cc4ede7ead7622c096bc598aad3e10baf93c4350.tar.bz2
42-minishell-cc4ede7ead7622c096bc598aad3e10baf93c4350.tar.xz
42-minishell-cc4ede7ead7622c096bc598aad3e10baf93c4350.tar.zst
42-minishell-cc4ede7ead7622c096bc598aad3e10baf93c4350.zip
Good so far
Diffstat (limited to '')
-rw-r--r--src/ft_f_fail.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ft_f_fail.c b/src/ft_f_fail.c
new file mode 100644
index 0000000..aed16d0
--- /dev/null
+++ b/src/ft_f_fail.c
@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_f_fail.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "ft_d_define.h"
+
+static void
+ ft_write_fail(const char concern[],
+ const char msg[])
+{
+ ft_dprintf(STDERR_FILENO, "%s: %s\n", concern, msg);
+}
+
+void
+ ft_fail_no_options(const char concern[])
+{
+ ft_write_fail(concern, FT_FAIL_NO_OPTIONS);
+}
+
+void
+ ft_fail_alloc(void)
+{
+ ft_write_fail("minishell", FT_FAIL_ALLOC);
+ exit(FT_RET_ALLOC);
+}