From 5b751b22faa06734dd42a787d07fe1ee8cd3f608 Mon Sep 17 00:00:00 2001 From: mcolonna Date: Fri, 28 Jun 2024 11:45:42 +0200 Subject: [PATCH] little fixes --- include/builtins.h | 3 ++- src/builtin.c | 4 ++-- src/main.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/builtins.h b/include/builtins.h index d927d41..9621e51 100644 --- a/include/builtins.h +++ b/include/builtins.h @@ -6,7 +6,7 @@ /* By: jschaft +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */ -/* Updated: 2024/06/27 14:36:14 by jschaft ### ########.fr */ +/* Updated: 2024/06/28 11:35:07 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,6 +24,7 @@ int exec_builtin(t_call call, char *const envp[]); // Execute echo builtin int echo_builtin(const char **argv); +// Execute cd builtin int cd_builtin(char *const *path, char *const envp[]); #endif diff --git a/src/builtin.c b/src/builtin.c index 63d1581..9893ab2 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -6,7 +6,7 @@ /* By: jschaft +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/03 12:02:45 by jschaft #+# #+# */ -/* Updated: 2024/06/27 13:52:00 by jschaft ### ########.fr */ +/* Updated: 2024/06/28 11:37:24 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ bool is_builtin(const char *str) || ft_strncmp(str, "unset", 6) == 0); } -//Execute the builtin pwd for the current directory. +// Execute the builtin pwd for the current directory. // Return 0 for the sake of returning something for exec_builtin static int pwd_builtin(void) { diff --git a/src/main.c b/src/main.c index f1b8d14..033dc2a 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: jschaft +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/23 14:33:45 by mcolonna #+# #+# */ -/* Updated: 2024/06/27 14:09:18 by jschaft ### ########.fr */ +/* Updated: 2024/06/28 11:39:45 by mcolonna ### ########.fr */ /* */ /* ************************************************************************** */ @@ -81,8 +81,8 @@ int main(const int argc, const char *argv[], char *const envp[]) (void)argv; if (argc != 1) { - printf("Error: No argument needed\n"); - return (0); + minishell_error("Takes no argument"); + return (2); } env.exit = false; env.mc_global = mem_newclass(fatal_error);