summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--src/b_sqb.c3
-rw-r--r--src/b_sqb_str.c29
-rw-r--r--src/b_sqb_str.h20
4 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2cb1b03..95a5d4a 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ SRCS_NAME += b_export_mute
SRCS_NAME += b_pwd
SRCS_NAME += b_sqb
SRCS_NAME += b_sqb_file
+SRCS_NAME += b_sqb_str
SRCS_NAME += b_type
SRCS_NAME += b_unset
SRCS_NAME += e_builtins
diff --git a/src/b_sqb.c b/src/b_sqb.c
index adfad0f..8ac1f16 100644
--- a/src/b_sqb.c
+++ b/src/b_sqb.c
@@ -15,6 +15,7 @@
#include <unistd.h>
#include "b_sqb_file.h"
+#include "b_sqb_str.h"
#include "d_define.h"
#include "s_struct.h"
#include "u_utils.h"
@@ -68,6 +69,8 @@ static uint8_t
ret = b_sqb_file_tests(id, argv);
else if (id == FT_ID_SQB_NT || id == FT_ID_SQB_OT)
ret = b_sqb_double_file_tests(id, argv);
+ else if (id == FT_ID_SQB_Z || id == FT_ID_SQB_EQUA || id == FT_ID_SQB_DIFF)
+ ret = b_sqb_str(id, argv);
return (ret);
}
diff --git a/src/b_sqb_str.c b/src/b_sqb_str.c
new file mode 100644
index 0000000..0b23d7b
--- /dev/null
+++ b/src/b_sqb_str.c
@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* 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 <stdint.h>
+
+#include "d_define.h"
+
+uint8_t
+ b_sqb_str(uint8_t id,
+ char *argv[])
+{
+ if (id == FT_ID_SQB_Z)
+ {
+ if (argv[1][0] != '\0')
+ return (0);
+ else
+ return (1);
+ }
+ return (1);
+}
diff --git a/src/b_sqb_str.h b/src/b_sqb_str.h
new file mode 100644
index 0000000..9e27973
--- /dev/null
+++ b/src/b_sqb_str.h
@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* b_sqb_str.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* 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 */
+/* */
+/* ************************************************************************** */
+
+#ifndef B_SQB_STR_H
+#define B_SQB_STR_H
+
+#include <stdint.h>
+
+uint8_t b_sqb_str(uint8_t id, char *argv[]);
+
+#endif