ft_strdup.c 1.1 KB

1234567891011121314151617181920212223242526
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_strdup.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: mazimi <mazimi@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2014/11/08 17:49:42 by mazimi #+# #+# */
  9. /* Updated: 2014/12/26 12:58:54 by mazimi ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "../libft.h"
  13. char *ft_strdup(const char *s1)
  14. {
  15. char *s;
  16. char *sc;
  17. if (s1 == NULL)
  18. return (NULL);
  19. s = (char *)s1;
  20. sc = ft_strnew(ft_strlen(s));
  21. ft_strcpy(sc, (char *)s1);
  22. return (sc);
  23. }