Seluj78/Minishell

View on GitHub
libft/ft_strnequ.c

Summary

Maintainability
Test Coverage
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_strnequ.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: jlasne <marvin@42.fr>                      +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2016/11/03 16:16:12 by jlasne            #+#    #+#             */
/*   Updated: 2016/11/03 16:16:26 by jlasne           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft.h"

int        ft_strnequ(char const *s1, char const *s2, size_t n)
{
    if (s1 && s2)
    {
        if (ft_strncmp(s1, s2, n) == 0)
            return (1);
    }
    else if (s1 == s2)
        return (1);
    return (0);
}