aboutsummaryrefslogtreecommitdiff
path: root/src/error.c
diff options
context:
space:
mode:
authornass1pro <nass1pro@gmail.com>2020-09-13 09:17:35 +0200
committernass1pro <nass1pro@gmail.com>2020-09-13 09:17:35 +0200
commit935d1ed5ad3d20dd901a4c3cfbb8453626460f18 (patch)
tree247b7059873131f047337dd468ab00a3be2a9d41 /src/error.c
parent5146be239d6ab71db602ec7b6826b6484aa0f178 (diff)
parent65006d0c14d3efa647b3c866ab54bdb1749fa31d (diff)
downloadminishell-935d1ed5ad3d20dd901a4c3cfbb8453626460f18.tar.gz
minishell-935d1ed5ad3d20dd901a4c3cfbb8453626460f18.tar.bz2
minishell-935d1ed5ad3d20dd901a4c3cfbb8453626460f18.zip
Merge branch 'master' of https://github.com/ouaisbrefbams/minishell
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/error.c b/src/error.c
index e19a9ed..2e56117 100644
--- a/src/error.c
+++ b/src/error.c
@@ -6,7 +6,7 @@
/* By: charles <charles@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/14 11:02:52 by charles #+# #+# */
-/* Updated: 2020/08/27 10:44:08 by charles ### ########.fr */
+/* Updated: 2020/09/10 20:29:41 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,7 @@
** \note NULL arguments are ignored
*/
-void errorf(const char *format, ...)
+void errorf(const char *format, ...)
{
va_list ap;
@@ -28,7 +28,11 @@ void errorf(const char *format, ...)
va_end(ap);
}
-void verrorf(const char *format, va_list ap)
+/*
+** \brief errorf with an argument pointer (ap) instead of arguments
+*/
+
+void verrorf(const char *format, va_list ap)
{
char *arg;
@@ -49,3 +53,17 @@ void verrorf(const char *format, va_list ap)
}
}
}
+
+/*
+** \brief errorf helper to return an status code and print the error
+*/
+
+int errorf_ret(int status, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ verrorf(format, ap);
+ va_end(ap);
+ return (status);
+}