From 0bf045d4ab5619aae2793fb9c5e6b05aefbfcd7d Mon Sep 17 00:00:00 2001 From: Etienne Rey-bethbeder Date: Tue, 4 Apr 2023 13:46:32 +0200 Subject: [PATCH] KAN RP SEX CHATGPT SUR --- builtins/export.c | 5 +++-- utils/ft_atoi_check.c | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/builtins/export.c b/builtins/export.c index c6c1c9f..8ab199f 100644 --- a/builtins/export.c +++ b/builtins/export.c @@ -6,7 +6,7 @@ /* By: cchauvet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/07/21 08:21:05 by erey-bet #+# #+# */ -/* Updated: 2023/02/28 13:52:13 by erey-bet ### ########.fr */ +/* Updated: 2023/04/04 13:40:43 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,7 @@ static int ft_isspace(char c) int ft_atoi_check(const char *nptr) { - long result; + int64_t result; int sign; while (ft_isspace(*nptr)) @@ -37,9 +37,9 @@ int ft_atoi_check(const char *nptr) result = 0; while (*nptr >= '0' && *nptr <= '9') { - result = result * 10 + *nptr++ - '0'; - if ((result > 2147483647 && sign == 1) - || (result > 2147483647 && sign == 1)) + result = result * 10 + (*nptr++ - '0') * sign; + if ((result < 0 && sign == 1) + || (result > 0 && sign == -1)) return (2); } if (*nptr--)