ft_strcmp_end.c 1.1 KB

123456789101112131415161718192021222324252627
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strcmp_end.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2016/08/29 03:46:31 by bchanot #+# #+# */
  9. /* Updated: 2018/10/29 12:13:07 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. int ft_strcmp_end(const char *s1, const char *const s2)
  14. {
  15. size_t len;
  16. len = ft_strlen(s2);
  17. if (!s2 || !s1 || len > ft_strlen(s1))
  18. return (false);
  19. while (*(s1 + len))
  20. s1++;
  21. if (!ft_strcmp(s1, s2))
  22. return (true);
  23. return (false);
  24. }