summaryrefslogtreecommitdiffstats
path: root/src/b_sqb_file.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-26 01:26:34 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-26 01:26:34 +0200
commitd85db55d30ce3ec53055206903757e1c318b6843 (patch)
treec7d6205edcee59470082c62c9d66b6336942822d /src/b_sqb_file.c
parentCoolio (diff)
download42-minishell-d85db55d30ce3ec53055206903757e1c318b6843.tar.gz
42-minishell-d85db55d30ce3ec53055206903757e1c318b6843.tar.bz2
42-minishell-d85db55d30ce3ec53055206903757e1c318b6843.tar.xz
42-minishell-d85db55d30ce3ec53055206903757e1c318b6843.tar.zst
42-minishell-d85db55d30ce3ec53055206903757e1c318b6843.zip
Commit
Diffstat (limited to '')
-rw-r--r--src/b_sqb_file.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/b_sqb_file.c b/src/b_sqb_file.c
new file mode 100644
index 0000000..d6d07e0
--- /dev/null
+++ b/src/b_sqb_file.c
@@ -0,0 +1,39 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* b_sqb_file.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 <sys/stat.h>
+#include <stdint.h>
+
+static uint8_t
+ b_file_tests_one(uint8_t id,
+ struct stat *st)
+{
+ if (id == FT_ID_SQB_B && S_st->st_mode)
+ return (0);
+}
+
+uint8_t
+ b_sqb_file(uint8_t id,
+ char *argv[])
+{
+ struct stat st;
+ int32_t fd;
+ uint8_t ret;
+
+ ret = 0;
+ if ((fd = open(argv[1])) == -1)
+ return (1);
+ fstat(fd, &st);
+ ret = b_file_tests_one(id, &st);
+ close(fd);
+ return (ret);
+}