ft_strdup.c 1.1 KB

12345678910111213141516171819202122232425
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strdup.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@students.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2015/11/23 14:55:16 by bchanot #+# #+# */
  9. /* Updated: 2018/10/13 21:20:06 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. char *ft_strdup(const char *src)
  14. {
  15. char *s;
  16. if (!src)
  17. return (NULL);
  18. if (!(s = ft_strnew(ft_strlen(src))))
  19. return (NULL);
  20. ft_strcpy(s, src);
  21. return (s);
  22. }