summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 17:16:04 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 17:16:04 +0100
commitca997f07f58bba79220b968f8acf5cd3863685c7 (patch)
tree4e6c4051f23f6e9f52b603a0c2ebf177ce67779c
parentexit function works (diff)
download42-minishell-ca997f07f58bba79220b968f8acf5cd3863685c7.tar.gz
42-minishell-ca997f07f58bba79220b968f8acf5cd3863685c7.tar.bz2
42-minishell-ca997f07f58bba79220b968f8acf5cd3863685c7.tar.xz
42-minishell-ca997f07f58bba79220b968f8acf5cd3863685c7.tar.zst
42-minishell-ca997f07f58bba79220b968f8acf5cd3863685c7.zip
changes
-rw-r--r--Makefile4
-rw-r--r--src/ft_exit.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index fea1e29..1e0ea0a 100644
--- a/Makefile
+++ b/Makefile
@@ -50,11 +50,11 @@ $(NAME): ${OBJS}
all: ${NAME}
clean:
- ${RM} ${OBJS} ${B_OBJS}
+ ${RM} ${OBJS_DIR}
xclean:
${RM} ${NAME}
- ${RM} ${NAME}.dSYM
+ ${RM} ${NAME}.dSYM/
fclean: clean xclean
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 513b4d1..f91183d 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -24,17 +24,17 @@ ft_exit(char **com)
ft_putendl("exit");
while (com[i])
i++;
- if (i > 2)
- return (ft_error(com[0], 1));
- else if (com[1])
+ if (i == 2)
{
i = 0;
while (ft_isdigit(com[1][i]))
i++;
if (i != ft_strlen(com[1]))
- return (ft_error(com[0], 255));
+ exit(ft_error(com[0], 255));
else
exit((uint8_t)ft_atoi(com[1]));
}
+ else if (i > 2)
+ return (ft_error(com[0], 1));
exit(0);
}