summaryrefslogtreecommitdiffstats
path: root/src/b_exit.c
diff options
context:
space:
mode:
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;