ft_check_last.c 1.1 KB

1234567891011121314151617181920212223242526272829
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_check_last.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2016/08/29 03:46:31 by bchanot #+# #+# */
  9. /* Updated: 2016/11/08 11:03:19 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. int ft_check_last(char *src, char *str)
  14. {
  15. int cpt;
  16. size_t c;
  17. c = ft_strlen(str);
  18. cpt = 0;
  19. if (c > ft_strlen(src))
  20. return (0);
  21. while (src[cpt + c])
  22. cpt++;
  23. if (ft_strcmp(&src[cpt], str) == 0)
  24. return (1);
  25. return (0);
  26. }