From 27b8874f756f51fd66cf5074ca76c08edef949dd Mon Sep 17 00:00:00 2001 From: Etienne Rey-bethbeder Date: Thu, 30 Mar 2023 13:56:16 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Tient=20Adrien=20aufaite=20comment=20va=20t?= =?UTF-8?q?on=20ptit=20fr=C3=A8re=20yummi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builtins/echo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtins/echo.c b/builtins/echo.c index f05d199..865392d 100644 --- a/builtins/echo.c +++ b/builtins/echo.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/17 13:09:08 by erey-bet #+# #+# */ -/* Updated: 2023/03/28 15:53:52 by cchauvet ### ########.fr */ +/* Updated: 2023/03/30 13:55:40 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ int check_argument(char *str, int *check_backslash_n) while (str[++i]) if (str[i] != '-' && str[i] != 'n') return (1); - if (ft_strnstr(str, "n", ft_strlen(str))) + if (ft_strnstr(str, "n", ft_strlen(str)) && str[0] == '-') *check_backslash_n = 1; else return (1); From 94f55af0be04db3285e7a546d36f0fcfe7b90c03 Mon Sep 17 00:00:00 2001 From: Etienne Rey-bethbeder Date: Thu, 30 Mar 2023 15:16:21 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Mon=20builtins=20est=20parfait,=20tout=20pe?= =?UTF-8?q?rsonne=20disant=20l'inverse=20m=C3=A9rit=C3=A9=20la=20p=C3=A9ni?= =?UTF-8?q?tence=20=C3=A0=20vie=20et=20faire=20tomber=20le=20savon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builtins/cd.c | 6 +++--- builtins/env.c | 11 +---------- builtins/exit.c | 8 ++++---- builtins/export.c | 4 ++-- builtins/unset.c | 4 ++-- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/builtins/cd.c b/builtins/cd.c index 336b3ea..30eab3a 100644 --- a/builtins/cd.c +++ b/builtins/cd.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/20 14:27:36 by erey-bet #+# #+# */ -/* Updated: 2023/03/21 13:16:24 by erey-bet ### ########.fr */ +/* Updated: 2023/03/30 15:04:09 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,7 +24,7 @@ int make_move(char *path, int fd) return (0); } free(join); - write(2, "No such file or directory\n", 26); + write(2, "cd: No such file or directory\n", 30); return (1); } @@ -42,7 +42,7 @@ int move_folder(char **args, int fd) { if (chdir(path) == 0) return (0); - write(2, "No such file or directory\n", 26); + write(2, "cd: No such file or directory\n", 30); return (1); } else diff --git a/builtins/env.c b/builtins/env.c index 7d6786d..b601555 100644 --- a/builtins/env.c +++ b/builtins/env.c @@ -6,7 +6,7 @@ /* By: cchauvet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/24 10:17:59 by erey-bet #+# #+# */ -/* Updated: 2023/03/10 14:52:22 by erey-bet ### ########.fr */ +/* Updated: 2023/03/30 15:04:47 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,11 +35,11 @@ int ft_exit(char **args) } err = ft_atoi_check(args[0]); if (err == 1) - return (error(err, "numeric argument required", args[0])); + return (error(err, "exit: numeric argument required", args[0])); if (args[1] != NULL) - return (error(1, "too many arguments", NULL)); + return (error(1, "exit: too many arguments", NULL)); if (err > 0) - return (error(err, "numeric argument required", args[0])); + return (error(err, "exit: numeric argument required", args[0])); write(1, "exit\n", 6); return ((ft_atoi(args[0]) % 256 + 256) % 256); } diff --git a/builtins/export.c b/builtins/export.c index b8bd135..3617a7e 100644 --- a/builtins/export.c +++ b/builtins/export.c @@ -6,7 +6,7 @@ /* By: cchauvet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/22 13:28:27 by erey-bet #+# #+# */ -/* Updated: 2023/02/23 15:49:21 by erey-bet ### ########.fr */ +/* Updated: 2023/03/30 15:07:10 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ int error(char *str, int fd) { - write(fd, "bash: unset: `", 14); + write(fd, "bozoshell: unset: `", 19); write(fd, str, ft_strlen(str)); write(fd, "': not a valid identifier", 25); return (1);