Browse Source

Add libft

Moul 5 years ago
parent
commit
f241b3ef83
68 changed files with 1895 additions and 3 deletions
  1. 97 0
      Makefile
  2. 0 3
      README.md
  3. 1 0
      auteur
  4. 36 0
      ft_atoi.c
  5. 24 0
      ft_bzero.c
  6. 18 0
      ft_isalnum.c
  7. 18 0
      ft_isalpha.c
  8. 18 0
      ft_isascii.c
  9. 18 0
      ft_isdigit.c
  10. 18 0
      ft_isprint.c
  11. 71 0
      ft_itoa.c
  12. 22 0
      ft_lstadd.c
  13. 23 0
      ft_lstdel.c
  14. 23 0
      ft_lstdelone.c
  15. 20 0
      ft_lstiter.c
  16. 29 0
      ft_lstmap.c
  17. 29 0
      ft_lstnew.c
  18. 22 0
      ft_memalloc.c
  19. 25 0
      ft_memccpy.c
  20. 26 0
      ft_memchr.c
  21. 30 0
      ft_memcmp.c
  22. 27 0
      ft_memcpy.c
  23. 22 0
      ft_memdel.c
  24. 25 0
      ft_memmove.c
  25. 26 0
      ft_memset.c
  26. 18 0
      ft_putchar.c
  27. 18 0
      ft_putchar_fd.c
  28. 19 0
      ft_putendl.c
  29. 19 0
      ft_putendl_fd.c
  30. 34 0
      ft_putnbr.c
  31. 34 0
      ft_putnbr_fd.c
  32. 19 0
      ft_putnbrn.c
  33. 18 0
      ft_putstr.c
  34. 20 0
      ft_putstr_fd.c
  35. 22 0
      ft_puttab.c
  36. 26 0
      ft_strcat.c
  37. 26 0
      ft_strchr.c
  38. 23 0
      ft_strclr.c
  39. 27 0
      ft_strcmp.c
  40. 26 0
      ft_strcpy.c
  41. 22 0
      ft_strdel.c
  42. 24 0
      ft_strdup.c
  43. 26 0
      ft_strequ.c
  44. 20 0
      ft_striter.c
  45. 23 0
      ft_striteri.c
  46. 24 0
      ft_strjoin.c
  47. 26 0
      ft_strjoinf.c
  48. 31 0
      ft_strlcat.c
  49. 23 0
      ft_strlen.c
  50. 29 0
      ft_strmap.c
  51. 29 0
      ft_strmapi.c
  52. 27 0
      ft_strncat.c
  53. 27 0
      ft_strncmp.c
  54. 28 0
      ft_strncpy.c
  55. 28 0
      ft_strnequ.c
  56. 26 0
      ft_strnew.c
  57. 25 0
      ft_strnstr.c
  58. 24 0
      ft_strrchr.c
  59. 63 0
      ft_strsplit.c
  60. 42 0
      ft_strstr.c
  61. 32 0
      ft_strsub.c
  62. 30 0
      ft_strtrim.c
  63. 23 0
      ft_tabsize.c
  64. 20 0
      ft_tolower.c
  65. 20 0
      ft_toupper.c
  66. 66 0
      get_next_line.c
  67. 28 0
      get_next_line.h
  68. 92 0
      libft.h

+ 97 - 0
Makefile

@@ -0,0 +1,97 @@
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2014/11/05 11:09:24 by mazimi            #+#    #+#              #
+#    Updated: 2015/09/25 13:48:00 by mazimi           ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+NAME = libft.a
+
+SRC = ft_memset.c \
+ft_bzero.c \
+ft_memcpy.c \
+ft_memccpy.c \
+ft_memmove.c \
+ft_memchr.c \
+ft_memcmp.c \
+ft_strlen.c \
+ft_strdup.c \
+ft_strcpy.c \
+ft_strncpy.c \
+ft_strcat.c \
+ft_strncat.c \
+ft_strlcat.c \
+ft_strchr.c \
+ft_strrchr.c \
+ft_strstr.c \
+ft_strnstr.c \
+ft_strcmp.c \
+ft_strncmp.c \
+ft_atoi.c \
+ft_isalpha.c \
+ft_isdigit.c \
+ft_isalnum.c \
+ft_isascii.c \
+ft_isprint.c \
+ft_toupper.c \
+ft_tolower.c \
+ft_memalloc.c \
+ft_memdel.c \
+ft_strnew.c \
+ft_strdel.c \
+ft_strclr.c \
+ft_striter.c \
+ft_striteri.c \
+ft_strmap.c \
+ft_strmapi.c \
+ft_strequ.c \
+ft_strnequ.c \
+ft_strsub.c \
+ft_strjoin.c \
+ft_strjoinf.c \
+ft_strsplit.c \
+ft_tabsize.c \
+ft_itoa.c \
+ft_strtrim.c \
+ft_putchar.c \
+ft_putstr.c \
+ft_putendl.c \
+ft_puttab.c \
+ft_putnbr.c \
+ft_putnbrn.c \
+ft_putchar_fd.c \
+ft_putstr_fd.c \
+ft_putendl_fd.c \
+ft_putnbr_fd.c \
+ft_lstnew.c \
+ft_lstdelone.c \
+ft_lstdel.c \
+ft_lstadd.c \
+ft_lstiter.c \
+ft_lstmap.c \
+get_next_line.c
+
+OBJ = $(SRC:.c=.o)
+
+all: $(NAME)
+
+$(NAME):
+	@gcc -Wall -Werror -Wextra -c $(SRC)
+	@ar rc $(NAME) $(OBJ)
+	@rm -f $(OBJ)
+	@echo "libft make."
+
+clean:
+	@rm -f $(OBJ)
+	@echo "libft cleaned."
+
+fclean: clean
+	@rm -f $(NAME)
+	@echo "libft fcleaned"
+
+re: fclean all

+ 0 - 3
README.md

@@ -1,3 +0,0 @@
-# libft
-
-Lib of C functions

+ 1 - 0
auteur

@@ -0,0 +1 @@
+mazimi

+ 36 - 0
ft_atoi.c

@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_atoi.c                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/03 15:35:21 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 23:38:04 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_atoi(char *str)
+{
+	int		nb;
+	int		i;
+	int		neg;
+
+	nb = 0;
+	i = 0;
+	neg = 1;
+	while ((str[i] >= 9 && str[i] <= 13) || str[i] == ' ')
+		i++;
+	if (str[i] == '-')
+	{
+		neg = -1;
+		i++;
+	}
+	else if (str[i] == '+')
+		i++;
+	while (str[i] && ft_isdigit(str[i]) == 1)
+		nb = nb * 10 + str[i++] - 48;
+	return (neg * nb);
+}

+ 24 - 0
ft_bzero.c

@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_bzero.c                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/08 15:24:30 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:54:20 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_bzero(void *s, size_t n)
+{
+	char	*tmp;
+	size_t	i;
+
+	i = -1;
+	tmp = s;
+	while (++i < n)
+		tmp[i] = 0;
+}

+ 18 - 0
ft_isalnum.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_isalnum.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 18:18:09 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 21:54:30 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int	ft_isalnum(int c)
+{
+	return (ft_isalpha(c) == 1 || ft_isdigit(c) == 1) ? 1 : 0;
+}

+ 18 - 0
ft_isalpha.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_isalpha.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 16:57:29 by mazimi            #+#    #+#             */
+/*   Updated: 2015/04/17 14:07:35 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int	ft_isalpha(int c)
+{
+	return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ? 1 : 0);
+}

+ 18 - 0
ft_isascii.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_isascii.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 18:39:39 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 21:55:15 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int	ft_isascii(int c)
+{
+	return (c >= 0 && c <= 127 ? 1 : 0);
+}

+ 18 - 0
ft_isdigit.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_isdigit.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 18:03:57 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 21:52:54 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_isdigit(int c)
+{
+	return (c >= '0' && c <= '9' ? 1 : 0);
+}

+ 18 - 0
ft_isprint.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_isprint.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 18:52:25 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 21:55:55 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_isprint(int c)
+{
+	return (c >= 32 && c <= 126 ? 1 : 0);
+}

+ 71 - 0
ft_itoa.c

@@ -0,0 +1,71 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_itoa.c                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/09 14:15:57 by mazimi            #+#    #+#             */
+/*   Updated: 2015/03/04 12:00:31 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+static char		*ft_turn(char *src, int lon)
+{
+	char	*dest;
+	int		i;
+	int		j;
+
+	dest = ft_strnew(lon);
+	j = lon;
+	i = -1;
+	while (++i < lon)
+		dest[i] = src[--j];
+	return (dest);
+}
+
+static int		intlen(int c)
+{
+	int		i;
+	int		lon;
+
+	i = 1;
+	if (c < 0)
+		i++;
+	lon = c;
+	while (lon >= 10 || lon <= -10)
+	{
+		lon = lon / 10;
+		i++;
+	}
+	return (i);
+}
+
+char			*ft_itoa(int c)
+{
+	int		lon;
+	char	*str;
+	char	*dst;
+	int		cc;
+	int		i;
+
+	if (c == -2147483648)
+		return (ft_strdup("-2147483648"));
+	cc = c;
+	lon = intlen(c);
+	str = ft_strnew(lon);
+	if (c < 0)
+		c = -c;
+	i = -1;
+	while (++i < lon)
+	{
+		str[i] = (c % 10) + 48;
+		c = c / 10;
+	}
+	if (cc < 0)
+		str[i - 1] = '-';
+	dst = ft_turn(str, lon);
+	return (dst);
+}

+ 22 - 0
ft_lstadd.c

@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lstadd.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/09 21:04:20 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/10 14:17:25 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_lstadd(t_list **alst, t_list *new)
+{
+	if (new != NULL)
+	{
+		new->next = *alst;
+		*alst = new;
+	}
+}

+ 23 - 0
ft_lstdel.c

@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lstdel.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/09 20:33:56 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/10 20:19:17 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_lstdel(t_list **alst, void (*del)(void *, size_t))
+{
+	if (alst)
+	{
+		if ((*alst)->next)
+			ft_lstdel(&(*alst)->next, del);
+		ft_lstdelone(alst, del);
+	}
+}

+ 23 - 0
ft_lstdelone.c

@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lstdelone.c                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/09 19:19:06 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 21:58:36 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_lstdelone(t_list **alst, void (*del)(void*, size_t))
+{
+	if (alst)
+	{
+		del((*alst), (*alst)->content_size);
+		free(*alst);
+		*alst = NULL;
+	}
+}

+ 20 - 0
ft_lstiter.c

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lstiter.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/10 14:34:01 by mazimi            #+#    #+#             */
+/*   Updated: 2015/05/05 20:06:42 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_lstiter(t_list *lst, void (*f)(t_list *elem))
+{
+	f(lst);
+	if (lst->next)
+		ft_lstiter(lst->next, f);
+}

+ 29 - 0
ft_lstmap.c

@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lstmap.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/10 15:38:49 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/11 16:13:50 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+t_list		*ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem))
+{
+	t_list *ret;
+
+	if (lst != NULL)
+	{
+		ret = (t_list*)malloc(sizeof(f(lst)));
+		if (ret == NULL)
+			return (NULL);
+		ret = f(lst);
+		ret->next = ft_lstmap(lst->next, f);
+		return (ret);
+	}
+	return (NULL);
+}

+ 29 - 0
ft_lstnew.c

@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lstnew.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/09 15:18:05 by mazimi            #+#    #+#             */
+/*   Updated: 2015/05/08 15:51:53 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+t_list		*ft_lstnew(void const *content, size_t content_size)
+{
+	t_list	*list;
+
+	list = (t_list *)malloc(sizeof(t_list));
+	if (list == NULL)
+		return (NULL);
+	if (content != NULL)
+	{
+		list->content = (void*)content;
+		list->content_size = content_size;
+	}
+	list->next = NULL;
+	return (list);
+}

+ 22 - 0
ft_memalloc.c

@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memalloc.c                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/08 15:58:54 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/04 21:18:12 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	*ft_memalloc(size_t size)
+{
+	void	*mem;
+
+	if ((mem = malloc(size)))
+		return (mem);
+	return (NULL);
+}

+ 25 - 0
ft_memccpy.c

@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memccpy.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/21 15:29:02 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:55:41 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	*ft_memccpy(void *dst, const void *src, int c, size_t n)
+{
+	if (n != 0)
+	{
+		*(unsigned char *)dst = *(unsigned char *)src;
+		if (*(unsigned char *)src == (unsigned char)c)
+			return (dst + 1);
+		return (ft_memccpy(dst + 1, src + 1, c, --n));
+	}
+	return (NULL);
+}

+ 26 - 0
ft_memchr.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memchr.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/12 16:03:22 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:55:54 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	*ft_memchr(const void *s, int c, size_t n)
+{
+	size_t	i;
+
+	i = -1;
+	if (s == NULL)
+		return (NULL);
+	while (++i < n)
+		if (((unsigned char *)s)[i] == (unsigned char)c)
+			return ((void *)s + i);
+	return (NULL);
+}

+ 30 - 0
ft_memcmp.c

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memcmp.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/24 18:26:36 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:56:02 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_memcmp(const void *s1, const void *s2, size_t n)
+{
+	size_t			i;
+	unsigned char	*str1;
+	unsigned char	*str2;
+
+	if (s1 == NULL || s2 == NULL)
+		return (0);
+	str1 = (unsigned char *)s1;
+	str2 = (unsigned char *)s2;
+	i = -1;
+	while (++i < n)
+		if (str1[i] != str2[i])
+			return (str1[i] - str2[i]);
+	return (0);
+}

+ 27 - 0
ft_memcpy.c

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memcpy.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/08 17:31:08 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:56:19 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	*ft_memcpy(void *dst, const void *src, size_t n)
+{
+	size_t	i;
+	char	*dst2;
+	char	*src2;
+
+	dst2 = dst;
+	src2 = (char *)src;
+	i = -1;
+	while (++i < n)
+		dst2[i] = src2[i];
+	return ((void *)dst2);
+}

+ 22 - 0
ft_memdel.c

@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memdel.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/21 14:35:21 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:56:28 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_memdel(void **ap)
+{
+	if (ap)
+	{
+		free(*ap);
+		*ap = NULL;
+	}
+}

+ 25 - 0
ft_memmove.c

@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memmove.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/12 17:19:17 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:56:41 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	*ft_memmove(void *dest, const void *src, size_t n)
+{
+	if (dest == NULL)
+		return (NULL);
+	if (src <= dest)
+		while (n--)
+			((unsigned char *)dest)[n] = ((unsigned char *)src)[n];
+	else
+		ft_memcpy(dest, src, n);
+	return ((void *)dest);
+}

+ 26 - 0
ft_memset.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_memset.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/03 15:24:07 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:56:51 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	*ft_memset(void *b, int c, size_t len)
+{
+	size_t	i;
+	char	*e;
+
+	e = b;
+	i = -1;
+	while (++i < len)
+		e[i] = (unsigned char)c;
+	b = e;
+	return (b);
+}

+ 18 - 0
ft_putchar.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putchar.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/04 14:53:51 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:57:06 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putchar(char c)
+{
+	write(1, &c, 1);
+}

+ 18 - 0
ft_putchar_fd.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putchar_fd.c                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 17:58:41 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:57:15 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putchar_fd(char c, int fd)
+{
+	write(fd, &c, 1);
+}

+ 19 - 0
ft_putendl.c

@@ -0,0 +1,19 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putendl.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 17:21:20 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/30 19:17:11 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putendl(char const *s)
+{
+	write(1, s, ft_strlen(s));
+	ft_putchar('\n');
+}

+ 19 - 0
ft_putendl_fd.c

@@ -0,0 +1,19 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putendl_fd.c                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 17:21:20 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/30 18:06:53 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putendl_fd(char const *s, int fd)
+{
+	write(fd, s, ft_strlen(s));
+	write(fd, "\n", 1);
+}

+ 34 - 0
ft_putnbr.c

@@ -0,0 +1,34 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putnbr.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 12:01:26 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:58:13 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putnbr(int n)
+{
+	if (n == -2147483648)
+	{
+		ft_putstr("-2147483648");
+		return ;
+	}
+	if (n < 0)
+	{
+		ft_putchar('-');
+		n = -n;
+	}
+	if (n >= 10)
+	{
+		ft_putnbr(n / 10);
+		ft_putnbr(n % 10);
+	}
+	else
+		ft_putchar(n + 48);
+}

+ 34 - 0
ft_putnbr_fd.c

@@ -0,0 +1,34 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putnbr_fd.c                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 12:01:26 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:58:23 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putnbr_fd(int n, int fd)
+{
+	if (n == -2147483648)
+	{
+		ft_putstr_fd("-2147483648", fd);
+		return ;
+	}
+	if (n < 0)
+	{
+		ft_putchar_fd('-', fd);
+		n = -n;
+	}
+	if (n >= 10)
+	{
+		ft_putnbr_fd(n / 10, fd);
+		ft_putnbr_fd(n % 10, fd);
+	}
+	else
+		ft_putchar_fd(n + 48, fd);
+}

+ 19 - 0
ft_putnbrn.c

@@ -0,0 +1,19 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putnbrn.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/05 12:01:26 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/19 20:56:40 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putnbrn(int n)
+{
+	ft_putnbr(n);
+	ft_putchar('\n');
+}

+ 18 - 0
ft_putstr.c

@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putstr.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/04 15:15:03 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/29 14:09:02 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putstr(char const *s)
+{
+	write(1, s, ft_strlen(s));
+}

+ 20 - 0
ft_putstr_fd.c

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_putstr_fd.c                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 18:15:07 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/29 14:08:48 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_putstr_fd(char const *s, int fd)
+{
+	if (s == NULL)
+		return ;
+	write(fd, s, ft_strlen(s));
+}

+ 22 - 0
ft_puttab.c

@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_puttab.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2015/02/18 20:54:35 by mazimi            #+#    #+#             */
+/*   Updated: 2015/02/18 21:29:48 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_puttab(char **tab)
+{
+	int	i;
+
+	i = -1;
+	while (tab[++i] != NULL)
+		ft_putendl(tab[i]);
+}

+ 26 - 0
ft_strcat.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strcat.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/21 11:40:49 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/26 18:11:07 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strcat(char *dest, const char *src)
+{
+	int		i;
+	int		j;
+
+	j = 0;
+	i = ft_strlen(dest);
+	while (src[j])
+		dest[i++] = src[j++];
+	dest[i] = '\0';
+	return ((char *)dest);
+}

+ 26 - 0
ft_strchr.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strchr.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/21 16:01:42 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 15:59:57 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strchr(const char *s1, int c)
+{
+	int		i;
+
+	i = -1;
+	while (s1[++i])
+		if (s1[i] == c)
+			return ((char *)&(s1[i]));
+	if (s1[i] == c)
+		return ((char *)&(s1[i]));
+	return (NULL);
+}

+ 23 - 0
ft_strclr.c

@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strclr.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 20:14:34 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:00:11 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_strclr(char *s)
+{
+	int		i;
+
+	i = -1;
+	if (s)
+		while (s[++i])
+			s[i] = '\0';
+}

+ 27 - 0
ft_strcmp.c

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strcmp.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/07 17:14:39 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:00:19 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_strcmp(const char *s1, const char *s2)
+{
+	unsigned char s11;
+	unsigned char s22;
+
+	s11 = *s1;
+	s22 = *s2;
+	if (!s11 && !s22)
+		return (0);
+	else if (s11 != s22)
+		return (s11 - s22);
+	return (ft_strcmp(++s1, ++s2));
+}

+ 26 - 0
ft_strcpy.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strcpy.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/04 16:28:55 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:00:26 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strcpy(char *dest, const char *src)
+{
+	int		i;
+
+	i = -1;
+	if (dest == NULL)
+		return (NULL);
+	while (src[++i])
+		dest[i] = src[i];
+	dest[i] = '\0';
+	return (dest);
+}

+ 22 - 0
ft_strdel.c

@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strdel.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/10 15:33:33 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:00:41 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_strdel(char **as)
+{
+	if (as && *as)
+	{
+		free(*as);
+		*as = NULL;
+	}
+}

+ 24 - 0
ft_strdup.c

@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strdup.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/08 17:49:42 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/26 12:58:54 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strdup(const char *s1)
+{
+	char	*s;
+	char	*sc;
+
+	s = (char *)s1;
+	sc = ft_strnew(ft_strlen(s));
+	ft_strcpy(sc, (char *)s1);
+	return (sc);
+}

+ 26 - 0
ft_strequ.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strequ.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 18:27:18 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/08 15:50:48 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_strequ(char const *s1, char const *s2)
+{
+	int i;
+
+	i = -1;
+	if (s1 == NULL || s2 == NULL)
+		return (0);
+	while (s1[++i] || s2[i])
+		if (s1[i] != s2[i])
+			return (0);
+	return (1);
+}

+ 20 - 0
ft_striter.c

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_striter.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 20:36:37 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:03:28 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_striter(char *s, void (*f)(char *))
+{
+	if (s && f)
+		while (*s)
+			f(s++);
+}

+ 23 - 0
ft_striteri.c

@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_striteri.c                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 20:45:58 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:03:35 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void	ft_striteri(char *s, void (*f)(unsigned int, char *))
+{
+	unsigned int i;
+
+	i = -1;
+	if (s && f)
+		while (*s)
+			f(++i, s++);
+}

+ 24 - 0
ft_strjoin.c

@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strjoin.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/10 17:27:47 by mazimi            #+#    #+#             */
+/*   Updated: 2015/06/25 16:03:01 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strjoin(char const *s1, char const *s2)
+{
+	char	*str;
+
+	if (s1 == NULL || s2 == NULL)
+		return (NULL);
+	str = ft_strnew(ft_strlen(s1) + ft_strlen(s2));
+	ft_strcpy(str, s1);
+	return (ft_strcat(str, s2));
+}

+ 26 - 0
ft_strjoinf.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strjoinf.c                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/10 17:27:47 by mazimi            #+#    #+#             */
+/*   Updated: 2015/06/25 16:02:57 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strjoinf(char const *s1, char const *s2, int p)
+{
+	char	*str;
+
+	if (s1 == NULL || s2 == NULL)
+		return (NULL);
+	str = ft_strnew(ft_strlen(s1) + ft_strlen(s2));
+	ft_strcpy(str, s1);
+	str = ft_strcat(str, s2);
+	(p == 1) ? ft_strdel((char **)&s1) : ft_strdel((char **)&s2);
+	return (str);
+}

+ 31 - 0
ft_strlcat.c

@@ -0,0 +1,31 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strlcat.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/25 13:09:33 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/26 14:54:13 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+size_t	ft_strlcat(char *dst, const char *src, size_t size)
+{
+	size_t	i;
+	size_t	j;
+	size_t	k;
+
+	i = 0;
+	j = -1;
+	while (dst[i] && i < size)
+		i++;
+	k = ft_strlen(src);
+	while ((src[++j]) && ((i + j + 1) < size))
+		dst[i + j] = src[j];
+	if (i != size)
+		dst[i + j] = '\0';
+	return (i + k);
+}

+ 23 - 0
ft_strlen.c

@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strlen.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/03 15:02:39 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/21 13:11:04 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+size_t	ft_strlen(char const *str)
+{
+	int i;
+
+	i = 0;
+	while (str[i])
+		i++;
+	return (i);
+}

+ 29 - 0
ft_strmap.c

@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strmap.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/10 16:23:57 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:04:38 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strmap(char const *s, char (*f)(char))
+{
+	size_t	i;
+	char	*str;
+
+	if (s != NULL && f != NULL)
+	{
+		str = ft_strdup(s);
+		i = -1;
+		while (s[++i])
+			str[i] = f(s[i]);
+		return (str);
+	}
+	return (NULL);
+}

+ 29 - 0
ft_strmapi.c

@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strmapi.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/26 12:17:15 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:04:59 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strmapi(char const *s, char (*f)(unsigned int, char))
+{
+	unsigned int	i;
+	char			*str;
+
+	if (s != NULL && f != NULL)
+	{
+		str = ft_strdup(s);
+		i = -1;
+		while (s[++i])
+			str[i] = f(i, s[i]);
+		return (str);
+	}
+	return (NULL);
+}

+ 27 - 0
ft_strncat.c

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strncat.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/21 11:41:39 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:05:11 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strncat(char *dest, const char *src, size_t n)
+{
+	int		i;
+	size_t	j;
+
+	i = 0;
+	j = 0;
+	while (dest[i])
+		i++;
+	while (src[j] && j < n)
+		dest[i++] = src[j++];
+	return ((char *)dest);
+}

+ 27 - 0
ft_strncmp.c

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strncmp.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/25 14:13:10 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:05:23 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_strncmp(const char *s1, const char *s2, size_t n)
+{
+	unsigned char s11;
+	unsigned char s22;
+
+	s11 = *s1;
+	s22 = *s2;
+	if (!n || (!s11 && !s22))
+		return (0);
+	else if (s11 != s22)
+		return (s11 - s22);
+	return (ft_strncmp(++s1, ++s2, --n));
+}

+ 28 - 0
ft_strncpy.c

@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strncpy.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/04 16:28:55 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:05:34 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strncpy(char *dest, char *src, unsigned int n)
+{
+	unsigned int	i;
+
+	i = -1;
+	if (dest == NULL)
+		return (NULL);
+	while (src[++i] != '\0' && i < n)
+		dest[i] = src[i];
+	if (i < n)
+		while (i < n)
+			dest[i++] = '\0';
+	return (dest);
+}

+ 28 - 0
ft_strnequ.c

@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strnequ.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 18:27:18 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/08 15:50:50 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_strnequ(char const *s1, char const *s2, size_t n)
+{
+	if (s1 == NULL || s2 == NULL)
+		return (0);
+	if (n == 0)
+		return (1);
+	if (*s1 == '\0' && *s2 == '\0')
+		return (1);
+	if (n == 1 && *s1 == *s2)
+		return (1);
+	if (*s1 == *s2 && n)
+		return (ft_strnequ(s1 + 1, s2 + 1, n - 1));
+	return (0);
+}

+ 26 - 0
ft_strnew.c

@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strnew.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/10 14:26:38 by mazimi            #+#    #+#             */
+/*   Updated: 2015/01/27 00:57:52 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strnew(size_t size)
+{
+	char	*str;
+	size_t	i;
+
+	i = -1;
+	if (!(str = (char *)malloc(sizeof(char) * (size + 1))))
+		return (NULL);
+	while (++i < size + 1)
+		str[i] = '\0';
+	return (str);
+}

+ 25 - 0
ft_strnstr.c

@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strnstr.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/08 15:26:53 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/08 17:21:39 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strnstr(const char *s1, const char *s2, size_t n)
+{
+	if (!*s2)
+		return ((char *)s1);
+	if (!*s1 || n == 0)
+		return (NULL);
+	if (*s1 == *s2)
+		if (ft_strnstr(s1 + 1, s2 + 1, n - 1) - 1 == s1)
+			return ((char *)s1);
+	return (ft_strnstr(s1 + 1, s2, n - 1));
+}

+ 24 - 0
ft_strrchr.c

@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strrchr.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/22 15:42:16 by mazimi            #+#    #+#             */
+/*   Updated: 2015/04/16 19:01:12 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strrchr(const char *s, int c)
+{
+	int		i;
+
+	i = ft_strlen(s) + 1;
+	while (--i >= -1)
+		if (s[i] == c)
+			return ((char *)&s[i]);
+	return (NULL);
+}

+ 63 - 0
ft_strsplit.c

@@ -0,0 +1,63 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strsplit.c                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/08 19:26:52 by mazimi            #+#    #+#             */
+/*   Updated: 2015/03/04 12:01:35 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+static	int		ft_count_words(const char *s, char c)
+{
+	int sp;
+	int sp_tmp;
+
+	sp_tmp = 0;
+	sp = 0;
+	while (*s)
+	{
+		if (sp_tmp == 1 && *s == c)
+			sp_tmp = 0;
+		if (sp_tmp == 0 && *s != c)
+		{
+			sp_tmp = 1;
+			sp++;
+		}
+		s++;
+	}
+	return (sp);
+}
+
+char			**ft_strsplit(char const *s, char c)
+{
+	int		sp;
+	char	**tab;
+	int		i;
+	int		j;
+	int		start;
+
+	if ((s == 0) || (c == 0))
+		return (NULL);
+	sp = ft_count_words(s, c);
+	tab = malloc((sizeof(char *) * (sp + 1)));
+	i = 0;
+	j = -1;
+	while (++j < sp)
+	{
+		while (s[i] && s[i] == c)
+			i++;
+		start = i;
+		while (s[i] && s[i] != c)
+			i++;
+		tab[j] = malloc((sizeof(char *)) * ((i - start) + 1));
+		tab[j] = ft_strsub(s, start, i - start);
+		i++;
+	}
+	tab[j] = NULL;
+	return (tab);
+}

+ 42 - 0
ft_strstr.c

@@ -0,0 +1,42 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strstr.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/08 19:33:30 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/16 16:05:35 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strstr(const char *s1, const char *s2)
+{
+	int i;
+	int j;
+	int k;
+
+	k = 0;
+	i = 0;
+	if (s2[0] == 0)
+		return ((char *)s1);
+	while (s1[i])
+	{
+		j = 0;
+		if (s1[i] == s2[j])
+		{
+			k = i;
+			while (s1[k] == s2[j] && s2[j])
+			{
+				k++;
+				j++;
+			}
+			if (s2[j] == '\0')
+				return ((char *)s1 + i);
+		}
+		i++;
+	}
+	return (NULL);
+}

+ 32 - 0
ft_strsub.c

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strsub.c                                        :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/09 13:45:03 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/16 16:06:23 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strsub(char const *s, unsigned int start, size_t len)
+{
+	char	*res;
+	size_t	i;
+
+	if (len <= 0 || s == NULL)
+		return (ft_strdup(""));
+	if (len > (size_t)ft_strlen(s))
+		return (NULL);
+	res = ft_strnew(len);
+	if (res == NULL)
+		return (0);
+	i = -1;
+	while (++i < len)
+		res[i] = s[start++];
+	res[i] = '\0';
+	return (res);
+}

+ 30 - 0
ft_strtrim.c

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strtrim.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/10 18:07:47 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/05 18:03:49 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+char	*ft_strtrim(char const *s)
+{
+	size_t	i;
+	char	*sc;
+
+	if (!s)
+		return (NULL);
+	sc = ft_strdup(s);
+	while (*sc == ' ' || *sc == '\n' || *sc == '\t')
+		sc++;
+	i = ft_strlen(sc) - 1;
+	while (sc[i] == ' ' || sc[i] == '\n' || sc[i] == '\t')
+		i--;
+	sc[++i] = '\0';
+	return (ft_strdup(sc));
+}

+ 23 - 0
ft_tabsize.c

@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_tabsize.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2015/04/18 16:52:16 by mazimi            #+#    #+#             */
+/*   Updated: 2015/04/28 15:31:59 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_tabsize(char **tab)
+{
+	int		i;
+
+	i = 0;
+	while (tab[i] != NULL)
+		i++;
+	return (i);
+}

+ 20 - 0
ft_tolower.c

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_tolower.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/06 17:11:05 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:07:45 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_tolower(int c)
+{
+	if (c >= 'A' && c <= 'Z')
+		c = c + 32;
+	return (c);
+}

+ 20 - 0
ft_toupper.c

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_toupper.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/08 17:23:39 by mazimi            #+#    #+#             */
+/*   Updated: 2014/12/02 16:07:56 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int		ft_toupper(int c)
+{
+	if (c >= 97 && c <= 122)
+		c = c - 32;
+	return (c);
+}

+ 66 - 0
get_next_line.c

@@ -0,0 +1,66 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   get_next_line.c                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2015/02/11 23:17:53 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/25 13:49:51 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "get_next_line.h"
+
+int		get_next_line(int const fd, char **line)
+{
+	char		*tmp;
+	static char	*rst[256];
+	int			ret;
+
+	if (fd < 0 || BUFF_SIZE < 1 || !line)
+		return (-1);
+	tmp = (rst[fd]) ? ft_strdup(rst[fd]) : ft_strnew(0);
+	ret = get(fd, tmp, rst, line);
+	if (ret == -1)
+		return (-1);
+	return (ret == 0 ? 0 : 1);
+}
+
+int		get(int const fd, char *tmp, char **rst, char **line)
+{
+	char	*buf;
+	int		ret;
+
+	ret = 1;
+	if (ft_strchr(tmp, '\n') != NULL)
+		rst[fd] = gnl(tmp);
+	else
+	{
+		buf = ft_strnew(BUFF_SIZE);
+		while ((ret = read(fd, buf, BUFF_SIZE)) > 0)
+		{
+			buf[ret] = '\0';
+			tmp = ft_strjoinf(tmp, buf, 1);
+			if (ft_strchr(tmp, '\n') != NULL)
+			{
+				(rst[fd] != NULL) ? free(rst[fd]) : NULL;
+				rst[fd] = gnl(tmp);
+				ft_strdel(&buf);
+				break ;
+			}
+		}
+	}
+	*line = ft_strdup(tmp);
+	ft_strdel(&tmp);
+	return (ret);
+}
+
+char	*gnl(char *tmp)
+{
+	char	*tmp2;
+
+	tmp2 = ft_strchr(tmp, '\n');
+	tmp[ft_strlen(tmp) - ft_strlen(tmp2)] = '\0';
+	return (ft_strdup(tmp2 + 1));
+}

+ 28 - 0
get_next_line.h

@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   get_next_line.h                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/12/04 15:11:38 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/25 13:49:41 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef GET_NEXT_LINE_H
+# define GET_NEXT_LINE_H
+
+# include "libft.h"
+# include <sys/types.h>
+# include <sys/uio.h>
+# include <unistd.h>
+# include <fcntl.h>
+
+# define BUFF_SIZE 7
+
+int		get_next_line(int const fd, char **line);
+int		get(int const fd, char *tmp, char **rst, char **line);
+char	*gnl(char *tmp);
+
+#endif

+ 92 - 0
libft.h

@@ -0,0 +1,92 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   libft.h                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2014/11/23 19:50:04 by mazimi            #+#    #+#             */
+/*   Updated: 2015/09/25 13:51:51 by mazimi           ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef LIBFT_H
+# define LIBFT_H
+# include "get_next_line.h"
+# include <string.h>
+# include <unistd.h>
+# include <stdlib.h>
+# include <ctype.h>
+# include <stddef.h>
+
+typedef struct		s_list
+{
+	void			*content;
+	size_t			content_size;
+	struct s_list	*next;
+}					t_list;
+
+void				*ft_memset(void *b, int c, size_t len);
+void				ft_bzero(void *s, size_t n);
+void				*ft_memcpy(void *dst, const void *src, size_t n);
+void				*ft_memccpy(void *dst, const void *src, int c, size_t n);
+void				*ft_memmove(void *dest, const void *src, size_t n);
+void				*ft_memchr(const void *s, int c, size_t n);
+int					ft_memcmp(const void *s1, const void *s2, size_t n);
+size_t				ft_strlen(char const *str);
+char				*ft_strdup(const char *s1);
+char				*ft_strcpy(char *dest, const char *src);
+char				*ft_strncpy(char *dest, char *src, unsigned int n);
+char				*ft_strcat(char *s1, const char *s2);
+char				*ft_strncat(char *s1, const char *s2, size_t n);
+size_t				ft_strlcat(char *dst, const char *src, size_t size);
+char				*ft_strchr(const char *s, int c);
+char				*ft_strrchr(const char *s, int c);
+char				*ft_strstr(const char *s1, const char *s2);
+char				*ft_strnstr(const char *s1, const char *s2, size_t n);
+int					ft_strcmp(const char *s1, const char *s2);
+int					ft_strncmp(const char *s1, const char *s2, size_t n);
+int					ft_atoi(char *str);
+int					ft_isalpha(int c);
+int					ft_isdigit(int c);
+int					ft_isalnum(int c);
+int					ft_isascii(int c);
+int					ft_isprint(int c);
+int					ft_toupper(int c);
+int					ft_tolower(int c);
+void				*ft_memalloc(size_t size);
+void				ft_memdel(void **ap);
+char				*ft_strnew(size_t size);
+void				ft_strdel(char **as);
+void				ft_strclr(char *s);
+void				ft_striter(char *s, void (*f)(char *));
+void				ft_striteri(char *s, void (*f)(unsigned int, char *));
+char				*ft_strmap(char const *s, char (*f)(char));
+char				*ft_strmapi(char const *s, char (*f)(unsigned int, char));
+int					ft_strequ(char const *s1, char const *s2);
+int					ft_strnequ(char const *s1, char const *s2, size_t n);
+char				*ft_strsub(char const *s, unsigned int start, size_t len);
+char				*ft_strjoin(char const *s1, char const *s2);
+char				*ft_strjoinf(char const *s1, char const *s2, int p);
+char				*ft_strtrim(char const *s);
+char				**ft_strsplit(char const *s, char c);
+int					ft_tabsize(char **tab);
+char				*ft_itoa(int n);
+void				ft_putchar(char c);
+void				ft_putstr(char const *s);
+void				ft_putendl(char const *s);
+void				ft_puttab(char **tab);
+void				ft_putnbr(int n);
+void				ft_putnbrn(int n);
+void				ft_putchar_fd(char c, int fd);
+void				ft_putstr_fd(char const *s, int fd);
+void				ft_putendl_fd(char const *s, int fd);
+void				ft_putnbr_fd(int n, int fd);
+t_list				*ft_lstnew(void const *content, size_t content_size);
+void				ft_lstdelone(t_list **alst, void (*del)(void*, size_t));
+void				ft_lstdel(t_list **alst, void (*del)(void*, size_t));
+void				ft_lstadd(t_list **alst, t_list *new);
+void				ft_lstiter(t_list *lst, void (*f)(t_list *elem));
+t_list				*ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem));
+
+#endif