text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_strdup.c                                        :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: vlaroque <vlaroque@student.42.fr>          +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2018/11/12 13:02:14 by vlaroque          #+#    #+#             */
  /*   Updated: 2018/11/24 11:37:00 by vlaroque         ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  #include <stdlib.h>
  
  char	*ft_strdup(const char *s1)
  {
  	int		i;
  	char	*newstr;
  
  	i = 0;
  	if (!(newstr = (char *)malloc(sizeof(char) * (ft_strlen(s1) + 1))))
  		return (NULL);
  	while (s1[i])
  	{
  		newstr[i] = s1[i];
  		i++;
  	}
  	newstr[i] = 0;
  	return (newstr);
  }
  