Merge branch 'master' of git.chauvet.pro:starnakin/42_minishell

This commit is contained in:
Camille Chauvet 2023-03-30 15:21:54 +02:00
commit 3374d21cad
6 changed files with 14 additions and 23 deletions

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/20 14:27:36 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); return (0);
} }
free(join); free(join);
write(2, "No such file or directory\n", 26); write(2, "cd: No such file or directory\n", 30);
return (1); return (1);
} }
@ -42,7 +42,7 @@ int move_folder(char **args, int fd)
{ {
if (chdir(path) == 0) if (chdir(path) == 0)
return (0); return (0);
write(2, "No such file or directory\n", 26); write(2, "cd: No such file or directory\n", 30);
return (1); return (1);
} }
else else

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 13:09:08 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]) while (str[++i])
if (str[i] != '-' && str[i] != 'n') if (str[i] != '-' && str[i] != 'n')
return (1); return (1);
if (ft_strnstr(str, "n", ft_strlen(str))) if (ft_strnstr(str, "n", ft_strlen(str)) && str[0] == '-')
*check_backslash_n = 1; *check_backslash_n = 1;
else else
return (1); return (1);

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 14:56:02 by cchauvet #+# #+# */ /* Created: 2023/02/14 14:56:02 by cchauvet #+# #+# */
/* Updated: 2023/03/09 15:04:47 by erey-bet ### ########.fr */ /* Updated: 2023/03/30 15:15:04 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -30,12 +30,3 @@ int print_env(t_list **env, int fd)
} }
return (0); return (0);
} }
/*int main(int argc, char *argv[], char **env)
{
t_list **be;
be = init_env(env);
print_env(be, 1);
return (0);
}*/

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/24 10:17:59 by erey-bet #+# #+# */ /* 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]); err = ft_atoi_check(args[0]);
if (err == 1) if (err == 1)
return (error(err, "numeric argument required", args[0])); return (error(err, "exit: numeric argument required", args[0]));
if (args[1] != NULL) if (args[1] != NULL)
return (error(1, "too many arguments", NULL)); return (error(1, "exit: too many arguments", NULL));
if (err > 0) 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); write(1, "exit\n", 6);
return ((ft_atoi(args[0]) % 256 + 256) % 256); return ((ft_atoi(args[0]) % 256 + 256) % 256);
} }

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */ /* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */
/* Updated: 2023/03/30 13:04:53 by erey-bet ### ########.fr */ /* Updated: 2023/03/30 15:05:25 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,7 +14,7 @@
static int error(char *str) static int error(char *str)
{ {
write(2, "bash: export: `", 15); write(2, "bozoshell: export: `", 20);
write(2, str, ft_strlen(str)); write(2, str, ft_strlen(str));
write(2, "': not a valid identifier\n", 26); write(2, "': not a valid identifier\n", 26);
return (1); return (1);

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/22 13:28:27 by erey-bet #+# #+# */ /* 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) int error(char *str, int fd)
{ {
write(fd, "bash: unset: `", 14); write(fd, "bozoshell: unset: `", 19);
write(fd, str, ft_strlen(str)); write(fd, str, ft_strlen(str));
write(fd, "': not a valid identifier", 25); write(fd, "': not a valid identifier", 25);
return (1); return (1);