From 63d4df1fbb5ac13cd388a1a0069ab82a13f81069 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 26 Aug 2020 17:54:40 +0200 Subject: Numbers are goodio, now errcheck --- src/b_sqb_nbr.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/b_sqb_nbr.c (limited to 'src/b_sqb_nbr.c') diff --git a/src/b_sqb_nbr.c b/src/b_sqb_nbr.c new file mode 100644 index 0000000..6ea2456 --- /dev/null +++ b/src/b_sqb_nbr.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* b_sqb_nbr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +#include "d_define.h" + +static t_bool + b_sqb_nbr_tests(uint8_t id, + int32_t n1, + int32_t n2) +{ + if (id == FT_ID_SQB_EQ && n1 == n2) + return (TRUE); + else if (id == FT_ID_SQB_NE && n1 != n2) + return (TRUE); + else if (id == FT_ID_SQB_GT && n1 > n2) + return (TRUE); + else if (id == FT_ID_SQB_GE && n1 >= n2) + return (TRUE); + else if (id == FT_ID_SQB_LT && n1 < n2) + return (TRUE); + else if (id == FT_ID_SQB_LE && n1 <= n2) + return (TRUE); + return (FALSE); +} + +uint8_t + b_sqb_nbr(uint8_t id, + char *argv[]) +{ + if (b_sqb_nbr_tests(id, ft_atoi(argv[0]), ft_atoi(argv[2])) == TRUE) + return (0); + return (1); +} -- cgit v1.2.3