summaryrefslogtreecommitdiffstats
path: root/src/b_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-12-01 21:35:53 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-12-01 21:35:53 +0100
commit314f8f2c501322717c247fe512093a894244b702 (patch)
tree7542a204ffd719f639624f33cfa079063fc98e8c /src/b_exit.c
parentcommit (diff)
download42-minishell-314f8f2c501322717c247fe512093a894244b702.tar.gz
42-minishell-314f8f2c501322717c247fe512093a894244b702.tar.bz2
42-minishell-314f8f2c501322717c247fe512093a894244b702.tar.xz
42-minishell-314f8f2c501322717c247fe512093a894244b702.tar.zst
42-minishell-314f8f2c501322717c247fe512093a894244b702.zip
Merged shotgunfixes
Diffstat (limited to 'src/b_exit.c')
-rw-r--r--src/b_exit.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/b_exit.c b/src/b_exit.c
index aa3360d..4f395cf 100644
--- a/src/b_exit.c
+++ b/src/b_exit.c
@@ -20,10 +20,6 @@
#include "s_struct.h"
#include "u_utils.h"
-/*
-** TODO: handle non-numeric args[0]
-*/
-
unsigned char b_exit(char *args[], t_msh *msh)
{
unsigned char ret;
@@ -36,7 +32,13 @@ unsigned char b_exit(char *args[], t_msh *msh)
}
if (argc == 1)
{
- ret = ft_atoi(args[0]);
+ if (ft_isfulldigit(args[0]))
+ ret = ft_atoi(args[0]);
+ else
+ {
+ f_fail_non_numeric_arg("exit", args[0]);
+ ret = 2;
+ }
}
else
ret = msh->ret;