text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_atoi.c                                          :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: amurtone <marvin@42.fr>                    +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2019/10/21 14:57:22 by amurtone          #+#    #+#             */
  /*   Updated: 2019/10/25 10:24:57 by amurtone         ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  int		ft_atoi(const char *str)
  {
  	int res;
  	int sign;
  
  	res = 0;
  	sign = 1;
  	while (*str && (*str == ' ' || *str == '\n' || *str == '\t' ||
  					*str == '\v' || *str == '\f' || *str == '\r'))
  		++str;
  	if (*str == '-')
  		sign = -1;
  	if (*str == '-' || *str == '+')
  		++str;
  	while (*str && *str >= '0' && *str <= '9')
  	{
  		res = res * 10 + (*str - 48);
  		++str;
  	}
  	return (res * sign);
  }
  