From 314f8f2c501322717c247fe512093a894244b702 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 1 Dec 2020 21:35:53 +0100 Subject: Merged shotgunfixes --- src/b_exit.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/b_exit.c') 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; -- cgit v1.2.3