summaryrefslogtreecommitdiffstats
path: root/src/b_sqb_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_sqb_str.c')
-rw-r--r--src/b_sqb_str.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/b_sqb_str.c b/src/b_sqb_str.c
new file mode 100644
index 0000000..d3a1978
--- /dev/null
+++ b/src/b_sqb_str.c
@@ -0,0 +1,53 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* b_sqb_str.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <stdint.h>
+
+#include "d_define.h"
+
+static t_bool
+ b_sqb_str_comp(uint8_t id,
+ const char s1[],
+ const char s2[])
+{
+ if (id == FT_ID_SQB_EQUA &&
+ ft_strncmp(s1, s2, ft_strlen(s1) + 1) == 0)
+ return (TRUE);
+ else if (id == FT_ID_SQB_EQUA &&
+ ft_strncmp(s1, s2, ft_strlen(s1) + 1) != 0)
+ return (TRUE);
+ return (FALSE);
+}
+
+uint8_t
+ b_sqb_str(uint8_t id,
+ char *argv[])
+{
+ if (id == FT_ID_SQB_N)
+ {
+ if (argv[1][0] != '\0')
+ return (0);
+ else
+ return (1);
+ }
+ else if (id == FT_ID_SQB_Z)
+ {
+ if (argv[1][0] == '\0')
+ return (0);
+ else
+ return (1);
+ }
+ if (b_sqb_str_comp(id, argv[0], argv[2]) == TRUE)
+ return (0);
+ return (1);
+}