aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_ext.c
blob: 0abc9b4191961099e37daab79c8c815b26e6af89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_check_ext.c                                     :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: joelecle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/17 15:33:28 by joelecle          #+#    #+#             */
/*   Updated: 2020/02/17 15:33:29 by joelecle         ###   ########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);
}