aboutsummaryrefslogtreecommitdiff
path: root/src/error.c
diff options
context:
space:
mode:
authorChristopher Uhlig2025-01-22 02:40:27 +0100
committerChristopher Uhlig2025-01-22 02:40:27 +0100
commitf6e474d27a1398c6d4f2e88c7f2d3797b85217da (patch)
tree7dd7bd5f2a151b39498991b567ae51cff8242782 /src/error.c
parent78dc50a2bce3c6e31405437189e2990d8fc720ac (diff)
downloadminishell-f6e474d27a1398c6d4f2e88c7f2d3797b85217da.tar.gz
minishell-f6e474d27a1398c6d4f2e88c7f2d3797b85217da.zip
kinda fix for pipe error and again.vs for you db just chnage workfolder gn
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/error.c b/src/error.c
new file mode 100644
index 0000000..2ca60b2
--- /dev/null
+++ b/src/error.c
@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* error.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2025/01/15 16:35:53 by dkaiser #+# #+# */
+/* Updated: 2025/01/20 18:12:40 by dkaiser ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "minishell.h"
+#include <errno.h>
+
+void *error(int err_code, char *err_text, int exit_code, int *ret_code)
+{
+ errno = err_code;
+ perror(err_text);
+ if (ret_code != NULL)
+ *ret_code = exit_code;
+ return (NULL);
+}
+
+void command_not_found_error(char *cmd)
+{
+ ft_printf("%s:", cmd);
+ ft_putstr_fd(" command not found", 2);
+ ft_printf("\n");
+}