fix: support only > 0 number

This commit is contained in:
Camille Chauvet 2023-05-17 13:44:38 +02:00
parent 008b30e12c
commit 7e5d4af478

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 11:34:57 by cchauvet #+# #+# */ /* Created: 2023/04/27 11:34:57 by cchauvet #+# #+# */
/* Updated: 2023/04/27 11:34:58 by cchauvet ### ########.fr */ /* Updated: 2023/05/17 13:43:29 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -23,13 +23,15 @@ static bool check_amount_of_argument(size_t n)
static bool check_value(char **av, size_t n) static bool check_value(char **av, size_t n)
{ {
size_t i; size_t i;
i = 0; i = 0;
while (i < n) while (i < n)
{ {
if (ft_isnum(av[i]) == 0) if (ft_isnum(av[i]) == 0)
return (1); return (1);
if (!(ft_atoi(av[i]) > 0))
return (1);
i++; i++;
} }
return (0); return (0);