add: exit cmd
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
|
||||
static int error(int err, char *reason, char *problem, int fd)
|
||||
{
|
||||
write(fd, "bash: exit: ", 12);
|
||||
ft_putstr_fd("minishell: exit ", fd);
|
||||
if (problem != NULL)
|
||||
{
|
||||
ft_putstr_fd(problem, fd);
|
||||
@ -36,11 +36,11 @@ int ft_exit(char **args, int fd)
|
||||
return (error(2, "numeric argument required", args[0], fd));
|
||||
if (args[1] != NULL)
|
||||
return (error(-1, "too many arguments", NULL, fd));
|
||||
return (0);
|
||||
return (ft_atoi(args[0]));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
return(ft_exit(argv + 1, 1));
|
||||
}
|
||||
/* int main(int argc, char *argv[]) */
|
||||
/* { */
|
||||
/* (void)argc; */
|
||||
/* return(ft_exit(argv + 1, 1)); */
|
||||
/* } */
|
||||
|
@ -10,6 +10,8 @@
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../minishell.h"
|
||||
|
||||
int error(char *str, int fd)
|
||||
{
|
||||
write(fd, "bash: unset: `", 14);
|
||||
|
Reference in New Issue
Block a user