/* ************************************************************************** */1/* */2/* ::: :::::::: */3/* ft_strcmp.c :+: :+: :+: */4/* +:+ +:+ +:+ */5/* By: yabtaour <[email protected]> +#+ +:+ +#+ */6/* +#+#+#+#+#+ +#+ */7/* Created: 2022/07/26 18:12:27 by yabtaour #+# #+# */8/* Updated: 2022/07/26 18:12:41 by yabtaour ### ########.fr */9/* */10/* ************************************************************************** */1112#include "../minishell.h"1314int ft_strcmp(char *s1, char *s2)15{16int i;17int j;1819i = 0;20while (s1 [i] != '\0' && s2 [i] != '\0' && s1[i] == s2[i])21i++;22if (s1 == s2)23j = 0;24else25j = s1 [i] - s2 [i];26return (j);27}2829int ft_strncmp(char *s1, char *s2, size_t n)30{31size_t i;3233i = 0;34while (i < n)35{36if (s1[i] != s2[i])37return ((unsigned char)s1[i] - (unsigned char)s2[i]);38if (s1[i] == '\0' && s2[i] == '\0')39return (0);40i++;41}42return (0);43}444546