aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_ext.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_check_ext.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ft_check_ext.c b/src/ft_check_ext.c
new file mode 100644
index 0000000..f4a1e92
--- /dev/null
+++ b/src/ft_check_ext.c
@@ -0,0 +1,13 @@
+#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);
+}