finish the bonus just need to verify some files i guess

This commit is contained in:
Maoake Teriierooiterai
2026-01-14 10:22:15 +01:00
parent fe69eeb821
commit 68dbe33733
18 changed files with 116 additions and 60 deletions

50
check_error/check_error.c Normal file
View File

@@ -0,0 +1,50 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/09 09:31:50 by mteriier #+# #+# */
/* Updated: 2026/01/09 09:31:51 by mteriier ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "check_error.h"
#include "parsing.h"
int verif_is_number(char **tab)
{
int len;
len = len_split(tab);
if (tab[len - 1][0] == '-' && !ft_isdigit(tab[len - 1][1]))
return (0);
return (1);
}
int check_error_bonus(char **tab)
{
if (!verif_is_digit(tab, 0))
return (0);
if (!verif_overflow(tab, 0))
return (0);
if (!verif_double(tab, 0))
return (0);
return (1);
}
int check_error(char **tab, int mod)
{
if (!verif_flag(tab, mod))
return (0);
if (!verif_is_digit(tab, mod))
return (0);
if (!verif_overflow(tab, mod))
return (0);
if (!verif_double(tab, mod))
return (0);
if (!verif_is_number(tab))
return (0);
return (1);
}