aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_ext.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-17 16:25:11 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-17 16:25:11 +0100
commit4f207400fd8e6724d321b6f2fa79fba5f16f9d59 (patch)
tree3896037d8a5938044bd6b6d49a18ad6305b948f0 /src/ft_check_ext.c
parentAdded libbsd to linux Makefile (diff)
parentready to merge (diff)
download42-cub3d-4f207400fd8e6724d321b6f2fa79fba5f16f9d59.tar.gz
42-cub3d-4f207400fd8e6724d321b6f2fa79fba5f16f9d59.tar.bz2
42-cub3d-4f207400fd8e6724d321b6f2fa79fba5f16f9d59.tar.xz
42-cub3d-4f207400fd8e6724d321b6f2fa79fba5f16f9d59.tar.zst
42-cub3d-4f207400fd8e6724d321b6f2fa79fba5f16f9d59.zip
Merge branch 'better_parse'
Diffstat (limited to 'src/ft_check_ext.c')
-rw-r--r--src/ft_check_ext.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ft_check_ext.c b/src/ft_check_ext.c
new file mode 100644
index 0000000..9a953d0
--- /dev/null
+++ b/src/ft_check_ext.c
@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_check_ext.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/17 15:33:28 by rbousset #+# #+# */
+/* Updated: 2020/02/17 15:33:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <stdint.h>
+
+int8_t
+ ft_check_ext(const char *filep, const char *ext)
+{
+ const uint8_t extlen = ft_strlen(ext);
+
+ if (ft_strncmp(filep + (ft_strlen(filep) - extlen), ext, extlen))
+ return (-1);
+ else
+ return (0);
+}