mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
refactoring functions parsing main flags
This commit is contained in:
@@ -19,11 +19,10 @@ int scan_str_is_digit(char *tab)
|
||||
i = 0;
|
||||
while (tab[i])
|
||||
{
|
||||
if (!ft_isdigit(tab[i]) && (tab[i] == '-' && !ft_isdigit(tab[i + 1])))
|
||||
return (0);
|
||||
else if (tab[i] == '+' && !ft_isdigit(tab[i + 1]))
|
||||
return (0);
|
||||
else if (!ft_isdigit(tab[i]))
|
||||
if ((tab[i] == '+' || tab[i] == '-') && ft_isdigit(tab[i + 1])
|
||||
&& tab[i + 1])
|
||||
i++;
|
||||
if (!ft_isdigit(tab[i]))
|
||||
return (0);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ static int verif_atoi(const char *nptr)
|
||||
i = 0;
|
||||
tmp = 0;
|
||||
before = 0;
|
||||
if (ft_strncmp("-2147483648", nptr, 12))
|
||||
if (ft_strncmp("-2147483648", nptr, 15))
|
||||
return (1);
|
||||
while ((nptr[i] >= 9 && nptr[i] <= 13) || nptr[i] == ' ')
|
||||
i++;
|
||||
|
||||
Reference in New Issue
Block a user