aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_ext.c
diff options
context:
space:
mode:
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);
+}