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

This commit is contained in:
Camille Chauvet 2023-02-28 14:41:28 +01:00
commit 4342d9a015
2 changed files with 14 additions and 15 deletions

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/02/28 14:28:18 by erey-bet ### ########.fr */ /* Updated: 2023/02/28 14:40:05 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,14 +14,13 @@
static int error(int err, char *reason, char *problem, int fd) static int error(int err, char *reason, char *problem, int fd)
{ {
ft_putstr_fd("minishell: exit ", fd); ft_putstr_fd("minishell: exit ", 2);
if (problem != NULL) if (problem != NULL)
{ {
ft_putstr_fd(problem, fd); ft_putstr_fd(problem, 2);
write(fd, ": ", 2); write(fd, ": ", 2);
} }
ft_putstr_fd(reason, fd); ft_putstr_fd(reason, 2);
write(fd, "\n", 1);
return (err); return (err);
} }
@ -36,13 +35,13 @@ int ft_exit(char **args, int fd)
return (error(err, "numeric argument required", args[0], fd)); return (error(err, "numeric argument required", args[0], fd));
if (args[1] != NULL) if (args[1] != NULL)
return (error(-1, "too many arguments", NULL, fd)); return (error(-1, "too many arguments", NULL, fd));
if (error > 0) if (err > 0)
error(err, "numeric argument required", args[0], fd); return(error(err, "numeric argument required", args[0], fd));
return (ft_atoi(args[0]) % 256); return (ft_atoi(args[0]) % 256);
} }
/* int main(int argc, char *argv[]) */ int main(int argc, char *argv[])
/* { */ {
/* (void)argc; */ (void)argc;
/* return(ft_exit(argv + 1, 1)); */ return(ft_exit(argv + 1, 1));
/* } */ }

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/02/28 14:27:46 by erey-bet ### ########.fr */ /* Updated: 2023/02/28 14:37:38 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -82,7 +82,7 @@ int export(t_list **env, char **args, int fd)
} }
return (err); return (err);
} }
/*
int main(int argc, char *argv[], char **env) int main(int argc, char *argv[], char **env)
{ {
t_list **n_env; t_list **n_env;
@ -91,4 +91,4 @@ int main(int argc, char *argv[], char **env)
n_env = init_env(env); n_env = init_env(env);
export(n_env, argv + 1, 1); export(n_env, argv + 1, 1);
return (0); return (0);
} }*/