[
  {
    "path": ".gitignore",
    "content": "# Prerequisites\n*.d\n\n# Object files\n*.o\n*.ko\n*.obj\n*.elf\n\n# Linker output\n*.ilk\n*.map\n*.exp\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Libraries\n*.lib\n*.a\n*.la\n*.lo\n\n# Shared objects (inc. Windows DLLs)\n*.dll\n*.so\n*.so.*\n*.dylib\n\n# Executables\n*.exe\n*.out\n*.app\n*.i*86\n*.x86_64\n*.hex\n\n# Debug files\n*.dSYM/\n*.su\n*.idb\n*.pdb\n\n# Kernel Module Compile Results\n*.mod*\n*.cmd\n.tmp_versions/\nmodules.order\nModule.symvers\nMkfile.old\ndkms.conf\n"
  },
  {
    "path": "README.md",
    "content": "# Piscine 42 - Juillet 2019\n\nToutes les journées sont terminées, il manque un exercice sur le jour 10 de C\n\nLe rush02 est broken, RIP :skull:\n\nCertaines fonctions ne sont pas optimisées, notamment ft_strstr, mais elles fonctionnent :man_shrugging:\n\nCheck [vimcake](https://github.com/ChuOkupai/vimcake) pour une config vim simple et efficace pour débuter !\n\nCe code n'est pas sous licence, le copier n'est cependant pas le meilleur moyen de progresser, à bon entendeur.\n\n![alt text](https://i.redd.it/5iinczbed0yz.jpg)\n"
  },
  {
    "path": "bsq/Makefile",
    "content": "SRCS\t\t= ft_find_biggest_square.c \\\n\t\t\t  ft_is_valid.c \\\n\t\t\t  ft_file_load.c \\\n\t\t\t  main.c\n\nOBJS\t\t= $(addprefix srcs/, ${SRCS:.c=.o})\n\nSRC_HEADERS\t= ft.h\nHEADERS\t\t:= $(addprefix includes/, ${SRC_HEADERS})\n\nNAME\t\t= bsq\n\nCFLAGS\t\t= -Wall -Wextra -Werror -Ofast\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS} ${HEADERS}\n\t\t\tgcc ${CFLAGS} ${OBJS} -o $@\n\n.c.o:\t\t${HEADERS}\n\t\t\tgcc ${CFLAGS} -I./includes -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "bsq/auteur",
    "content": "asoursou:gdinet\n"
  },
  {
    "path": "bsq/gen.pl",
    "content": "#!/usr/bin/perl\n\nuse warnings;\nuse strict;\ndie \"program x y density\" unless (scalar(@ARGV) == 3);\nmy ($x, $y, $density) = @ARGV;print \"$y.ox\\n\";\nfor (my $i = 0; $i < $y; $i++)\n{\n\tfor (my $j = 0; $j < $x; $j++)\n\t{\n\t\tif (int(rand($y) * 2) < $density)\n\t\t{\n\t\t\tprint \"o\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprint \".\";\n\t\t}\n\t}\n\tprint \"\\n\";\n}"
  },
  {
    "path": "bsq/includes/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/23 04:52:47 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/24 21:03:04 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\n# define MAX_LINES\t\t12000\n# define BUFFER_SIZE\t5800000\n# define MIN(A, B)\t\t((A < B) ? A : B)\n\ntypedef struct\ts_point\n{\n\tint x;\n\tint y;\n}\t\t\t\tt_point;\n\ntypedef struct\ts_map\n{\n\tchar\t*content;\n\tchar\t*matrix;\n\tchar\tempty;\n\tchar\tfull;\n\tchar\tobstacle;\n\tt_point\tsize;\n}\t\t\t\tt_map;\n\ntypedef struct\ts_square\n{\n\tt_point\tcoords;\n\tint\t\tsize;\n}\t\t\t\tt_square;\n\nchar\t\t\t*ft_file_load(char *path);\n\nint\t\t\t\tft_is_valid(t_map *m);\n\nvoid\t\t\tft_find_biggest_square(t_map *m, t_square *s);\n\n#endif\n"
  },
  {
    "path": "bsq/srcs/ft_file_load.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_file_load.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: gdinet <marvin@42.fr>                      +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/23 09:14:34 by gdinet            #+#    #+#             */\n/*   Updated: 2019/07/24 17:26:28 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <fcntl.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include \"ft.h\"\n\nchar\t*ft_bufcpy(char *dest, char *src, int n)\n{\n\tchar *d;\n\n\td = dest;\n\twhile (n--)\n\t\t*d++ = *src++;\n\treturn (dest);\n}\n\nchar\t*ft_file_read(int fd)\n{\n\tchar\tbuf[BUFFER_SIZE];\n\tchar\t*content;\n\tchar\t*tmp;\n\tint\t\tlen;\n\tint\t\tsize;\n\n\tif (!(content = malloc(sizeof(char))))\n\t\treturn (NULL);\n\t*content = '\\0';\n\tsize = 0;\n\twhile ((len = read(fd, buf, BUFFER_SIZE)) > 0)\n\t{\n\t\tif (!(tmp = malloc((size + len + 1) * sizeof(char))))\n\t\t\tbreak ;\n\t\ttmp = ft_bufcpy(tmp, content, size);\n\t\tfree(content);\n\t\tft_bufcpy(tmp + size, buf, len);\n\t\tcontent = tmp;\n\t\tsize += len;\n\t\tcontent[size] = '\\0';\n\t}\n\tif (len)\n\t\tfree(content);\n\treturn ((len) ? NULL : content);\n}\n\nchar\t*ft_file_load(char *path)\n{\n\tchar\t*content;\n\tint\t\tfd;\n\n\tfd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;\n\tif (fd < 0)\n\t\treturn (NULL);\n\tcontent = ft_file_read(fd);\n\tif (fd != STDIN_FILENO)\n\t\tclose(fd);\n\treturn (content);\n}\n"
  },
  {
    "path": "bsq/srcs/ft_find_biggest_square.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_find_biggest_square.c                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/23 09:30:32 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/24 21:00:55 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft.h\"\n\nvoid\tft_compute(t_map *m, t_square *s, int *t, t_point p)\n{\n\tint tmp;\n\tint u;\n\n\tu = 0;\n\tp.y = 0;\n\twhile (++p.y <= m->size.y)\n\t{\n\t\tp.x = 0;\n\t\twhile (++p.x <= m->size.x)\n\t\t{\n\t\t\ttmp = t[p.x];\n\t\t\tif (m->matrix[p.x - 1 + (p.y - 1) * (1 + m->size.x)] == m->empty)\n\t\t\t{\n\t\t\t\tt[p.x] = MIN(MIN(u, t[p.x - 1]), t[p.x]) + 1;\n\t\t\t\tif (s->size < t[p.x])\n\t\t\t\t{\n\t\t\t\t\ts->coords = p;\n\t\t\t\t\ts->size = t[p.x];\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\tt[p.x] = 0;\n\t\t\tu = tmp;\n\t\t}\n\t}\n}\n\nvoid\tft_find_biggest_square(t_map *m, t_square *s)\n{\n\tt_point\tp;\n\tint\t\ttab[m->size.x + 1];\n\n\ts->size = 0;\n\tp.x = 0;\n\twhile (p.x <= m->size.x)\n\t\ttab[p.x++] = 0;\n\tft_compute(m, s, tab, p);\n\tp.y = s->coords.y;\n\ts->coords.y -= s->size;\n\ts->coords.x -= s->size;\n\twhile (p.y > s->coords.y)\n\t{\n\t\tp.y--;\n\t\tp.x = s->coords.x + s->size;\n\t\twhile (p.x > s->coords.x)\n\t\t{\n\t\t\tp.x--;\n\t\t\tm->matrix[p.x + p.y * (1 + m->size.x)] = m->full;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "bsq/srcs/ft_is_valid.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_is_valid.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/24 09:25:05 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/24 18:20:54 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <limits.h>\n#include \"ft.h\"\n\nint\t\tft_atoui(char *str, int *length)\n{\n\tlong\tres;\n\tint\t\ti;\n\n\tres = 0;\n\t*length = 0;\n\twhile (str[*length] >= '0' && str[*length] <= '9')\n\t\t(*length)++;\n\ti = 0;\n\twhile (str[*length + i] && str[*length + i] != '\\n')\n\t\ti++;\n\tif (i > 3)\n\t\treturn (0);\n\t*length -= 3 - i;\n\ti = 0;\n\twhile (i < *length)\n\t{\n\t\tres = res * 10 + str[i++] - '0';\n\t\tif (res > INT_MAX)\n\t\t{\n\t\t\tres = 0;\n\t\t\tbreak ;\n\t\t}\n\t}\n\treturn ((res > 16000) ? 0 : res);\n}\n\nint\t\tft_check_line(t_map *m)\n{\n\tchar\t*s;\n\tt_point\tp;\n\n\ts = m->matrix;\n\tp.x = -1;\n\twhile (s[++p.x] != '\\n')\n\t\tif (!s[p.x] || s[p.x] == m->full\n\t\t\t|| (s[p.x] != m->empty && s[p.x] != m->obstacle))\n\t\t\treturn (0);\n\tm->size.x = p.x;\n\tp.y = 1;\n\twhile (m->size.x == p.x++ && *(s += p.x))\n\t{\n\t\tp.x = -1;\n\t\twhile (s[++p.x] != '\\n')\n\t\t\tif (!s[p.x] || s[p.x] == m->full || (s[p.x] != m->empty\n\t\t\t\t&& s[p.x] != m->obstacle))\n\t\t\t\treturn (0);\n\t\tp.y++;\n\t}\n\treturn (p.y == m->size.y);\n}\n\nint\t\tft_is_valid(t_map *m)\n{\n\tint i;\n\n\tif ((m->size.y = ft_atoui(m->content, &i)) <= 0)\n\t\treturn (0);\n\tif (m->content[i] != '\\0' && m->content[i] != '\\n')\n\t\tm->empty = m->content[i++];\n\telse\n\t\treturn (0);\n\tif (m->content[i] != '\\0' && m->content[i] != '\\n')\n\t\tm->obstacle = m->content[i++];\n\telse\n\t\treturn (0);\n\tif (m->content[i] != '\\0' && m->content[i] != '\\n')\n\t\tm->full = m->content[i++];\n\telse\n\t\treturn (0);\n\tif (m->content[i] != '\\n' || m->empty == m->full || m->empty == m->obstacle\n\t\t|| m->full == m->obstacle)\n\t\treturn (0);\n\tm->matrix = m->content + i + 1;\n\treturn (ft_check_line(m));\n}\n"
  },
  {
    "path": "bsq/srcs/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:32:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/24 18:15:04 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include <unistd.h>\n#include \"ft.h\"\n\nstatic void\tft_bsq(char *path)\n{\n\tt_map\t\tmap;\n\tt_square\tsquare;\n\tint\t\t\ty;\n\n\tif (!(map.content = ft_file_load(path))\n\t\t|| !ft_is_valid(&map))\n\t\twrite(STDERR_FILENO, \"map error\\n\", 10);\n\telse\n\t{\n\t\tft_find_biggest_square(&map, &square);\n\t\tmap.size.x++;\n\t\ty = 0;\n\t\twhile (y < map.size.y)\n\t\t\twrite(STDOUT_FILENO, map.matrix + map.size.x * y++, map.size.x);\n\t}\n\tfree(map.content);\n}\n\nint\t\t\tmain(int argc, char **argv)\n{\n\tchar\tc;\n\tint\t\ti;\n\n\tif (argc < 2)\n\t{\n\t\tft_bsq(NULL);\n\t\treturn (0);\n\t}\n\tc = '\\n';\n\ti = 0;\n\twhile (++i < argc)\n\t{\n\t\tif (i > 1)\n\t\t\twrite(STDOUT_FILENO, &c, 1);\n\t\tft_bsq(argv[i]);\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c00/ex00/ft_putchar.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:19:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:28:36 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n"
  },
  {
    "path": "c00/ex01/ft_print_alphabet.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_alphabet.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:26:51 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:30:59 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_print_alphabet(void)\n{\n\twrite(1, \"abcdefghijklmnopqrstuvwxyz\", 26);\n}\n"
  },
  {
    "path": "c00/ex02/ft_print_reverse_alphabet.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_reverse_alphabet.c                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:45:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:30:59 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_print_reverse_alphabet(void)\n{\n\twrite(1, \"zyxwvutsrqponmlkjihgfedcba\", 26);\n}\n"
  },
  {
    "path": "c00/ex03/ft_print_numbers.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_numbers.c                                 :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:44:10 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:32:39 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_print_numbers(void)\n{\n\twrite(1, \"0123456789\", 10);\n}\n"
  },
  {
    "path": "c00/ex04/ft_is_negative.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_is_negative.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:47:18 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 21:52:13 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_is_negative(int n)\n{\n\tft_putchar((n < 0) ? 'N' : 'P');\n}\n"
  },
  {
    "path": "c00/ex05/ft_print_comb.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_comb.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:56:52 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:36:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_print_comb(void)\n{\n\tchar t[5];\n\n\t*t = '0';\n\tt[1] = '1';\n\tt[2] = '2';\n\tt[3] = ',';\n\tt[4] = ' ';\n\twhile (*t < '8')\n\t{\n\t\twrite(1, t, (*t != '7') ? 5 : 3);\n\t\tif (++t[2] > '9')\n\t\t{\n\t\t\tif (++t[1] > '8')\n\t\t\t\tt[1] = ++(*t) + 1;\n\t\t\tt[2] = t[1] + 1;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "c00/ex06/ft_print_comb2.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_comb2.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/02 12:29:57 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:43:21 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_print_comb2(void)\n{\n\tchar a;\n\tchar b;\n\n\ta = 0;\n\tb = 1;\n\twhile (a < 99)\n\t{\n\t\tft_putchar(a / 10 + '0');\n\t\tft_putchar(a % 10 + '0');\n\t\tft_putchar(' ');\n\t\tft_putchar(b / 10 + '0');\n\t\tft_putchar(b % 10 + '0');\n\t\tif (a < 98)\n\t\t\twrite(1, \", \", 2);\n\t\tif (++b > 99)\n\t\t\tb = ++a + 1;\n\t}\n}\n"
  },
  {
    "path": "c00/ex07/ft_putnbr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putnbr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/02 13:02:20 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 16:38:06 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_putnbr(int nb)\n{\n\tunsigned int n;\n\n\tif (nb < 0)\n\t{\n\t\tft_putchar('-');\n\t\tn = -nb;\n\t}\n\telse\n\t\tn = nb;\n\tif (n > 9)\n\t{\n\t\tft_putnbr(n / 10);\n\t\tn %= 10;\n\t}\n\tft_putchar(n + '0');\n}\n"
  },
  {
    "path": "c00/ex08/ft_print_combn.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_combn.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/02 17:39:52 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 21:49:26 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_print_combn(int n)\n{\n\tchar\tt[11];\n\tint\t\ti;\n\n\tif (n < 1 || n > 9)\n\t\treturn ;\n\t*t = '0';\n\ti = 0;\n\twhile (++i < n)\n\t\tt[i] = t[i - 1] + 1;\n\tt[n] = ',';\n\tt[n + 1] = ' ';\n\twhile (*t <= 58 - n)\n\t{\n\t\twrite(1, t, n + ((*t != 58 - n) ? 2 : 0));\n\t\ti = n;\n\t\twhile (i--)\n\t\t\tif (++t[i] <= 58 - n + i)\n\t\t\t\tbreak ;\n\t\twhile (++i > 0 && i < n)\n\t\t\tt[i] = t[i - 1] + 1;\n\t}\n}\n"
  },
  {
    "path": "c01/ex00/ft_ft.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_ft.c                                            :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 02:49:17 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 02:50:02 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_ft(int *nbr)\n{\n\t*nbr = 42;\n}\n"
  },
  {
    "path": "c01/ex01/ft_ultimate_ft.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_ultimate_ft.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 02:50:59 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 02:52:17 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_ultimate_ft(int *********nbr)\n{\n\t*********nbr = 42;\n}\n"
  },
  {
    "path": "c01/ex02/ft_swap.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_swap.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 02:53:08 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 02:54:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_swap(int *a, int *b)\n{\n\tint c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n"
  },
  {
    "path": "c01/ex03/ft_div_mod.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_div_mod.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 02:54:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 02:56:30 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_div_mod(int a, int b, int *div, int *mod)\n{\n\t*div = a / b;\n\t*mod = a % b;\n}\n"
  },
  {
    "path": "c01/ex04/ft_ultimate_div_mod.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_ultimate_div_mod.c                              :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 02:57:55 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:19:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_ultimate_div_mod(int *a, int *b)\n{\n\tint c;\n\n\tc = *a;\n\t*a /= *b;\n\t*b = c % *b;\n}\n"
  },
  {
    "path": "c01/ex05/ft_putstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:00:11 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 03:10:15 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nint\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nvoid\tft_putstr(char *str)\n{\n\twrite(1, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c01/ex06/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:18:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c01/ex07/ft_rev_int_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_rev_int_tab.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:13:10 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 03:26:16 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_swap(int *a, int *b)\n{\n\tint c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n\nvoid\tft_rev_int_tab(int *tab, int size)\n{\n\tint left;\n\n\tif (size < 2)\n\t\treturn ;\n\tleft = 0;\n\twhile (left < --size)\n\t\tft_swap(&tab[left++], &tab[size]);\n}\n"
  },
  {
    "path": "c01/ex08/ft_sort_int_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sort_int_tab.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:27:57 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 04:33:21 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_swap(int *a, int *b)\n{\n\tint c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n\nvoid\tft_sort_int_tab(int *tab, int size)\n{\n\tint pivot;\n\tint i;\n\tint j;\n\n\tif (size < 2)\n\t\treturn ;\n\tpivot = tab[--size];\n\ti = 0;\n\tj = -1;\n\twhile (++j < size)\n\t\tif (tab[j] < pivot)\n\t\t\tft_swap(&tab[i++], &tab[j]);\n\tif (tab[i] > tab[size])\n\t\tft_swap(&tab[i], &tab[size]);\n\tft_sort_int_tab(tab, i);\n\tft_sort_int_tab(tab + i + 1, size - i);\n}\n"
  },
  {
    "path": "c02/ex00/ft_strcpy.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcpy.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 04:58:09 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 05:01:42 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strcpy(char *dest, char *src)\n{\n\tint i;\n\n\ti = -1;\n\twhile (src[++i])\n\t\tdest[i] = src[i];\n\tdest[i] = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c02/ex01/ft_strncpy.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strncpy.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 22:19:44 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:19:46 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strncpy(char *dest, char *src, unsigned int n)\n{\n\tunsigned int i;\n\n\ti = -1;\n\twhile (++i < n && src[i])\n\t\tdest[i] = src[i];\n\twhile (i < n)\n\t\tdest[i++] = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c02/ex02/ft_str_is_alpha.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_str_is_alpha.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 13:56:21 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 16:28:24 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_str_is_alpha(char *str)\n{\n\twhile (*str)\n\t{\n\t\tif (!((*str >= 'A' && *str <= 'Z') || (*str >= 'a' && *str <= 'z')))\n\t\t\treturn (0);\n\t\tstr++;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c02/ex03/ft_str_is_numeric.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_str_is_numeric.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 16:26:20 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 17:44:41 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_str_is_numeric(char *str)\n{\n\twhile (*str)\n\t{\n\t\tif (*str < '0' || *str > '9')\n\t\t\treturn (0);\n\t\tstr++;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c02/ex04/ft_str_is_lowercase.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_str_is_lowercase.c                              :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 16:27:44 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 19:48:48 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_str_is_lowercase(char *str)\n{\n\twhile (*str)\n\t{\n\t\tif (*str < 'a' || *str > 'z')\n\t\t\treturn (0);\n\t\tstr++;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c02/ex05/ft_str_is_uppercase.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_str_is_uppercase.c                              :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 17:48:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 19:35:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_str_is_uppercase(char *str)\n{\n\twhile (*str)\n\t{\n\t\tif (*str < 'A' || *str > 'Z')\n\t\t\treturn (0);\n\t\tstr++;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c02/ex06/ft_str_is_printable.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_str_is_printable.c                              :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 18:31:22 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 18:42:20 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_str_is_printable(char *str)\n{\n\twhile (*str)\n\t{\n\t\tif (*str < ' ' || *str == 127)\n\t\t\treturn (0);\n\t\tstr++;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c02/ex07/ft_strupcase.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strupcase.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 18:58:53 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 19:39:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strupcase(char *str)\n{\n\tchar *s;\n\n\ts = str;\n\twhile (*s)\n\t{\n\t\tif (*s >= 'a' && *s <= 'z')\n\t\t\t*s -= 32;\n\t\ts++;\n\t}\n\treturn (str);\n}\n"
  },
  {
    "path": "c02/ex08/ft_strlowcase.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlowcase.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 19:39:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 19:42:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strlowcase(char *str)\n{\n\tchar *s;\n\n\ts = str;\n\twhile (*s)\n\t{\n\t\tif (*s >= 'A' && *s <= 'Z')\n\t\t\t*s += 32;\n\t\ts++;\n\t}\n\treturn (str);\n}\n"
  },
  {
    "path": "c02/ex09/ft_strcapitalize.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcapitalize.c                                 :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 19:42:24 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/05 04:12:21 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_isdigit(char c)\n{\n\treturn (c >= '0' && c <= '9');\n}\n\nint\t\tft_islower(char c)\n{\n\treturn (c >= 'a' && c <= 'z');\n}\n\nint\t\tft_isupper(char c)\n{\n\treturn (c >= 'A' && c <= 'Z');\n}\n\nchar\t*ft_strcapitalize(char *str)\n{\n\tchar\t*s;\n\n\ts = str;\n\twhile (*s)\n\t{\n\t\tif (ft_isdigit(*s) || ft_islower(*s) || ft_isupper(*s))\n\t\t{\n\t\t\tif (ft_isdigit(*s))\n\t\t\t\twhile (ft_isdigit(s[1]))\n\t\t\t\t\ts++;\n\t\t\telse if (ft_islower(*s))\n\t\t\t\t*s -= 32;\n\t\t\twhile (ft_islower(*(++s)) || ft_isupper(*s))\n\t\t\t\tif (ft_isupper(*s))\n\t\t\t\t\t*s += 32;\n\t\t}\n\t\telse\n\t\t\ts++;\n\t}\n\treturn (str);\n}\n"
  },
  {
    "path": "c02/ex10/ft_strlcpy.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlcpy.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 21:11:14 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/05 07:02:17 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\t\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nunsigned int\tft_strlcpy(char *dest, char *src, unsigned int size)\n{\n\tunsigned int i;\n\tunsigned int j;\n\n\ti = ft_strlen(src);\n\tif (i + 1 < size)\n\t{\n\t\tj = -1;\n\t\twhile (++j < i + 1)\n\t\t\tdest[j] = src[j];\n\t}\n\telse if (size)\n\t{\n\t\tj = -1;\n\t\twhile (++j < size - 1)\n\t\t\tdest[j] = src[j];\n\t\tdest[j] = '\\0';\n\t}\n\treturn (i);\n}\n"
  },
  {
    "path": "c02/ex11/ft_putstr_non_printable.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr_non_printable.c                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 22:18:10 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/05 15:05:11 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_puthex(unsigned char c)\n{\n\tchar *base;\n\n\tbase = \"0123456789abcdef\";\n\tft_putchar(base[c / 16]);\n\tft_putchar(base[c % 16]);\n}\n\nvoid\tft_putstr_non_printable(char *str)\n{\n\twhile (*str)\n\t{\n\t\tif (*str < ' ' || *str == 127)\n\t\t{\n\t\t\tft_putchar('\\\\');\n\t\t\tft_puthex(*str);\n\t\t}\n\t\telse\n\t\t\tft_putchar(*str);\n\t\tstr++;\n\t}\n}\n"
  },
  {
    "path": "c02/ex12/ft_print_memory.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_memory.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 23:22:04 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/05 16:39:37 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_puthex(unsigned char c)\n{\n\tchar *base;\n\n\tbase = \"0123456789abcdef\";\n\tft_putchar(base[c / 16]);\n\tft_putchar(base[c % 16]);\n}\n\nvoid\tft_print_data(char *s, unsigned int size)\n{\n\tunsigned int i;\n\n\ti = -1;\n\twhile (++i < size)\n\t{\n\t\tif (!(i % 2))\n\t\t\tft_putchar(' ');\n\t\tft_puthex(s[i]);\n\t}\n\twhile (i < 16)\n\t\twrite(1, \"   \", (i++ % 2) ? 2 : 3);\n\tft_putchar(' ');\n\ti = -1;\n\twhile (++i < size)\n\t\tft_putchar((s[i] < ' ' || s[i] == 127) ? '.' : s[i]);\n}\n\nvoid\t*ft_print_memory(void *addr, unsigned int size)\n{\n\tunsigned int\ti;\n\tint\t\t\t\tj;\n\n\ti = 0;\n\twhile (i < size)\n\t{\n\t\tft_putchar('0');\n\t\tj = 56;\n\t\twhile ((j -= 8) >= 0)\n\t\t\tft_puthex((unsigned long int)(addr + i) >> j & 0xff);\n\t\tft_putchar(':');\n\t\tft_print_data(addr + i, (size - i < 16) ? size - i : 16);\n\t\tft_putchar('\\n');\n\t\ti += 16;\n\t}\n\treturn (addr);\n}\n"
  },
  {
    "path": "c03/ex00/ft_strcmp.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcmp.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 01:25:21 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 01:37:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strcmp(char *s1, char *s2)\n{\n\twhile (*s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t}\n\treturn (*s1 - *s2);\n}\n"
  },
  {
    "path": "c03/ex01/ft_strncmp.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strncmp.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 01:48:20 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 01:48:22 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strncmp(char *s1, char *s2, unsigned int n)\n{\n\twhile (n && *s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t\tn--;\n\t}\n\treturn ((n) ? *s1 - *s2 : 0);\n}\n"
  },
  {
    "path": "c03/ex02/ft_strcat.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcat.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 01:48:44 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 01:55:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strcat(char *dest, char *src)\n{\n\tchar *d;\n\n\td = dest;\n\twhile (*d)\n\t\td++;\n\twhile (*src)\n\t\t*d++ = *src++;\n\t*d = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c03/ex03/ft_strncat.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strncat.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 18:34:45 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 18:45:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strncat(char *dest, char *src, unsigned int nb)\n{\n\tchar *d;\n\n\td = dest;\n\twhile (*d)\n\t\td++;\n\twhile (nb-- && *src)\n\t\t*d++ = *src++;\n\t*d = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c03/ex04/ft_strstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 18:45:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/05 06:32:38 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strstr(char *str, char *to_find)\n{\n\tint i;\n\n\tif (!*to_find)\n\t\treturn (str);\n\twhile (*str)\n\t{\n\t\tif (*str == *to_find)\n\t\t{\n\t\t\ti = 1;\n\t\t\twhile (to_find[i] && str[i] == to_find[i])\n\t\t\t\ti++;\n\t\t\tif (!to_find[i])\n\t\t\t\treturn (str);\n\t\t}\n\t\tstr++;\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c03/ex05/ft_strlcat.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlcat.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 21:49:16 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/05 06:31:28 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\t\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nunsigned int\tft_strlcat(char *dest, char *src, unsigned int size)\n{\n\tunsigned int\ti;\n\tunsigned int\tj;\n\n\ti = -1;\n\twhile (++i < size && *dest)\n\t\tdest++;\n\tif (i == size)\n\t\treturn (i + (unsigned int)ft_strlen(src));\n\tj = -1;\n\twhile (src[++j])\n\t\tif (j < size - i - 1)\n\t\t\t*dest++ = src[j];\n\t*dest = '\\0';\n\treturn (i + j);\n}\n"
  },
  {
    "path": "c04/ex00/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:30:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c04/ex01/ft_putstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:00:11 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:40:51 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nint\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nvoid\tft_putstr(char *str)\n{\n\twrite(1, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c04/ex02/ft_putnbr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putnbr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/02 13:02:20 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:40:51 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_putnbr(int nb)\n{\n\tunsigned int n;\n\n\tif (nb < 0)\n\t{\n\t\tft_putchar('-');\n\t\tn = -nb;\n\t}\n\telse\n\t\tn = nb;\n\tif (n > 9)\n\t{\n\t\tft_putnbr(n / 10);\n\t\tn %= 10;\n\t}\n\tft_putchar(n + '0');\n}\n"
  },
  {
    "path": "c04/ex03/ft_atoi.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_atoi.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 06:20:50 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:35:23 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_atoi(char *str)\n{\n\tint n;\n\tint negative;\n\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile (*str >= '0' && *str <= '9')\n\t\tn = n * 10 + *str++ - '0';\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n"
  },
  {
    "path": "c04/ex04/ft_putnbr_base.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putnbr_base.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 06:45:07 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 06:18:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nint\t\tft_in_base(char c, char *base)\n{\n\twhile (*base)\n\t\tif (c == *base++)\n\t\t\treturn (1);\n\treturn (0);\n}\n\nvoid\tft_print(unsigned int n, char *base, unsigned int size)\n{\n\tif (n > size - 1)\n\t{\n\t\tft_print(n / size, base, size);\n\t\tn %= size;\n\t}\n\tft_putchar(base[n]);\n}\n\nvoid\tft_putnbr_base(int nbr, char *base)\n{\n\tint size;\n\n\tsize = -1;\n\twhile (base[++size])\n\t\tif (base[size] == '+' || base[size] == '-' || base[size] == ' '\n\t\t\t|| ft_in_base(base[size], base + size + 1)\n\t\t\t|| (base[size] >= 9 && base[size] <= 13))\n\t\t\treturn ;\n\tif (size < 2)\n\t\treturn ;\n\tif (nbr < 0)\n\t{\n\t\tft_putchar('-');\n\t\tft_print(-nbr, base, size);\n\t}\n\telse\n\t\tft_print(nbr, base, size);\n}\n"
  },
  {
    "path": "c04/ex05/ft_atoi_base.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_atoi_base.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 20:27:50 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:41:48 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_in_base(char c, char *base)\n{\n\tint i;\n\n\ti = -1;\n\twhile (base[++i])\n\t\tif (c == base[i])\n\t\t\treturn (i);\n\treturn (-1);\n}\n\nint\t\tft_baselen(char *base)\n{\n\tint size;\n\n\tsize = -1;\n\twhile (base[++size])\n\t\tif (base[size] == '+' || base[size] == '-' || base[size] == ' '\n\t\t\t|| ft_in_base(base[size], base + size + 1) >= 0\n\t\t\t|| (base[size] >= 9 && base[size] <= 13))\n\t\t\treturn (0);\n\treturn (size);\n}\n\nint\t\tft_atoi_base(char *str, char *base)\n{\n\tint i;\n\tint n;\n\tint negative;\n\tint size;\n\n\tif ((size = ft_baselen(base)) < 2)\n\t\treturn (0);\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile ((i = ft_in_base(*str, base)) >= 0)\n\t{\n\t\tn = n * size + i;\n\t\tstr++;\n\t}\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n"
  },
  {
    "path": "c05/ex00/ft_iterative_factorial.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_iterative_factorial.c                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 08:16:02 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 04:31:35 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_iterative_factorial(int nb)\n{\n\tint n;\n\n\tif (nb < 1)\n\t\treturn (!nb);\n\tn = 1;\n\twhile (nb)\n\t\tn *= nb--;\n\treturn (n);\n}\n"
  },
  {
    "path": "c05/ex01/ft_recursive_factorial.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_recursive_factorial.c                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 08:22:08 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 04:35:45 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_recursive_factorial(int nb)\n{\n\tif (nb < 1)\n\t\treturn (!nb);\n\treturn (nb * ft_recursive_factorial(nb - 1));\n}\n"
  },
  {
    "path": "c05/ex02/ft_iterative_power.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_iterative_power.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 08:25:43 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 07:01:52 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_iterative_power(int nb, int power)\n{\n\tint n;\n\n\tif (power < 1)\n\t\treturn (!power);\n\tn = nb;\n\twhile (--power)\n\t\tn *= nb;\n\treturn (n);\n}\n"
  },
  {
    "path": "c05/ex03/ft_recursive_power.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_recursive_power.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 08:31:46 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 05:46:12 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_recursive_power(int nb, int power)\n{\n\tif (power < 1)\n\t\treturn (!power);\n\treturn (nb * ft_recursive_power(nb, power - 1));\n}\n"
  },
  {
    "path": "c05/ex04/ft_fibonacci.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_fibonacci.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 09:02:55 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 05:51:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_fibonacci(int index)\n{\n\tif (index < 0)\n\t\treturn (-1);\n\tif (index < 2)\n\t\treturn (index);\n\treturn (ft_fibonacci(index - 1) + ft_fibonacci(index - 2));\n}\n"
  },
  {
    "path": "c05/ex05/ft_sqrt.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sqrt.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 09:06:22 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 09:16:16 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_sqrt(int nb)\n{\n\tunsigned int i;\n\n\tif (nb < 1)\n\t\treturn (0);\n\ti = 1;\n\twhile (i * i < (unsigned int)nb)\n\t\ti++;\n\treturn ((i * i == (unsigned int)nb) ? i : 0);\n}\n"
  },
  {
    "path": "c05/ex06/ft_is_prime.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_is_prime.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/07 09:35:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 09:29:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_is_prime(int nb)\n{\n\tunsigned int i;\n\n\tif (nb < 3 || !(nb % 2))\n\t\treturn (nb == 2);\n\ti = 3;\n\twhile (i * i <= (unsigned int)nb)\n\t{\n\t\tif (!(nb % i))\n\t\t\treturn (0);\n\t\ti += 2;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c05/ex07/ft_find_next_prime.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_find_next_prime.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/08 03:52:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 09:22:50 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_find_next_prime(int nb)\n{\n\tunsigned int i;\n\n\tif (nb < 3)\n\t\treturn (2);\n\tif (!(nb % 2))\n\t\tnb++;\n\ti = 3;\n\twhile (i * i <= (unsigned int)nb)\n\t{\n\t\tif (!(nb % i))\n\t\t{\n\t\t\tnb += 2;\n\t\t\ti = 1;\n\t\t}\n\t\ti += 2;\n\t}\n\treturn (nb);\n}\n"
  },
  {
    "path": "c05/ex08/ft_ten_queens_puzzle.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_ten_queens_puzzle.c                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/25 12:22:47 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 13:30:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nint\t\tft_abs(int n)\n{\n\treturn (n < 0) ? -n : n;\n}\n\nvoid\tft_solve(char *tab, int x, int *max)\n{\n\tint i;\n\tint j;\n\n\tif (x == 10)\n\t{\n\t\tx = 0;\n\t\twhile (x < 10)\n\t\t\tft_putchar(tab[x++] + '0');\n\t\tft_putchar('\\n');\n\t\t(*max)++;\n\t\treturn ;\n\t}\n\ti = -1;\n\twhile (++i < 10)\n\t{\n\t\tj = 0;\n\t\twhile (j < x && i != tab[j] && ft_abs(tab[j] - i) != x - j)\n\t\t\tj++;\n\t\tif (j >= x)\n\t\t{\n\t\t\ttab[x] = i;\n\t\t\tft_solve(tab, x + 1, max);\n\t\t}\n\t}\n}\n\nint\t\tft_ten_queens_puzzle(void)\n{\n\tchar\ttab[10];\n\tint\t\tmax;\n\n\tmax = 0;\n\tft_solve(tab, 0, &max);\n\treturn (max);\n}\n"
  },
  {
    "path": "c06/ex00/ft_print_program_name.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_program_name.c                            :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/09 03:20:37 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/09 03:20:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_putstr(char *str)\n{\n\twhile (*str)\n\t\tft_putchar(*str++);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tif (argc)\n\t{\n\t\tft_putstr(argv[0]);\n\t\tft_putchar('\\n');\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c06/ex01/ft_print_params.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print_params.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/08 07:56:58 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 23:45:06 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_putstr(char *str)\n{\n\twhile (*str)\n\t\tft_putchar(*str++);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tint i;\n\n\ti = 1;\n\twhile (i < argc)\n\t{\n\t\tft_putstr(argv[i++]);\n\t\tft_putchar('\\n');\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c06/ex02/ft_rev_params.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_rev_params.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/08 21:52:57 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/08 23:45:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_putstr(char *str)\n{\n\twhile (*str)\n\t\tft_putchar(*str++);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\twhile (argc > 1)\n\t{\n\t\tft_putstr(argv[--argc]);\n\t\tft_putchar('\\n');\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c06/ex03/ft_sort_params.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sort_params.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/08 21:58:42 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/09 00:09:19 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nint\t\tft_strcmp(char *s1, char *s2)\n{\n\twhile (*s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t}\n\treturn (*s1 - *s2);\n}\n\nvoid\tft_strswap(char **a, char **b)\n{\n\tchar *c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n\nvoid\tft_sort_str_tab(char **tab, int size)\n{\n\tchar\t*pivot;\n\tint\t\ti;\n\tint\t\tj;\n\n\tif (size < 2)\n\t\treturn ;\n\tpivot = tab[--size];\n\ti = 0;\n\tj = -1;\n\twhile (++j < size)\n\t\tif (ft_strcmp(tab[j], pivot) < 0)\n\t\t\tft_strswap(&tab[i++], &tab[j]);\n\tif (ft_strcmp(tab[i], tab[size]) > 0)\n\t\tft_strswap(&tab[i], &tab[size]);\n\tft_sort_str_tab(tab, i);\n\tft_sort_str_tab(tab + i + 1, size - i);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tint i;\n\n\tft_sort_str_tab(argv + 1, argc - 1);\n\ti = 0;\n\twhile (++i < argc)\n\t{\n\t\twhile (*argv[i])\n\t\t\tft_putchar(*argv[i]++);\n\t\tft_putchar('\\n');\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c07/ex00/ft_strdup.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strdup.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/09 02:30:44 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/09 21:35:58 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nchar\t*ft_strcpy(char *dest, char *src)\n{\n\tint i;\n\n\ti = -1;\n\twhile (src[++i])\n\t\tdest[i] = src[i];\n\tdest[i] = '\\0';\n\treturn (dest);\n}\n\nchar\t*ft_strdup(char *src)\n{\n\tchar *dest;\n\n\tdest = malloc((ft_strlen(src) + 1) * sizeof(char));\n\tif (!dest)\n\t\treturn (NULL);\n\treturn (ft_strcpy(dest, src));\n}\n"
  },
  {
    "path": "c07/ex01/ft_range.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_range.c                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/09 03:30:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/09 21:36:52 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t*ft_range(int min, int max)\n{\n\tint *t;\n\tint i;\n\n\tif (min >= max)\n\t\treturn (NULL);\n\tmax -= min;\n\tt = malloc(max * sizeof(int));\n\tif (!t)\n\t\treturn (NULL);\n\ti = -1;\n\twhile (++i < max)\n\t\tt[i] = min + i;\n\treturn (t);\n}\n"
  },
  {
    "path": "c07/ex02/ft_ultimate_range.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_ultimate_range.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/09 03:57:58 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/10 05:14:42 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\tft_ultimate_range(int **range, int min, int max)\n{\n\tint i;\n\n\tif (min >= max)\n\t{\n\t\t*range = NULL;\n\t\treturn (0);\n\t}\n\tmax -= min;\n\t*range = malloc(max * sizeof(int));\n\tif (!*range)\n\t\treturn (-1);\n\ti = -1;\n\twhile (++i < max)\n\t\t(*range)[i] = min + i;\n\treturn (max);\n}\n"
  },
  {
    "path": "c07/ex03/ft_strjoin.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strjoin.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/09 21:35:31 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/10 06:01:55 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nchar\t*ft_strcpy(char *dest, char *src)\n{\n\tint i;\n\n\ti = -1;\n\twhile (src[++i])\n\t\tdest[i] = src[i];\n\tdest[i] = '\\0';\n\treturn (dest);\n}\n\nchar\t*ft_strjoin(int size, char **strs, char *sep)\n{\n\tchar\t*dest;\n\tint\t\ti;\n\tint\t\tj;\n\n\ti = 0;\n\tj = 0;\n\twhile (i < size)\n\t\tj += ft_strlen(strs[i++]);\n\tif (size > 0)\n\t\tj += (size - 1) * ft_strlen(sep);\n\tdest = malloc((j + 1) * sizeof(char));\n\tif (!dest)\n\t\treturn (NULL);\n\ti = 0;\n\tj = 0;\n\twhile (i < size)\n\t{\n\t\tft_strcpy(dest + j, strs[i]);\n\t\tj += ft_strlen(strs[i]);\n\t\tif (++i < size)\n\t\t\tj += dest + j + ft_strlen(sep) - ft_strcpy(dest + j, sep);\n\t}\n\tdest[j] = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c07/ex04/ft_convert_base.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_convert_base.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/10 05:20:33 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/11 02:13:52 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t\tft_in_base(char c, char *base)\n{\n\tint i;\n\n\ti = -1;\n\twhile (base[++i])\n\t\tif (c == base[i])\n\t\t\treturn (i);\n\treturn (-1);\n}\n\nint\t\tft_checkbase(char *base)\n{\n\tint i;\n\n\ti = -1;\n\twhile (base[++i])\n\t\tif (base[i] == '+' || base[i] == '-' || base[i] == ' '\n\t\t\t|| ft_in_base(base[i], base + i + 1) >= 0\n\t\t\t|| (base[i] >= 9 && base[i] <= 13))\n\t\t\treturn (0);\n\treturn ((i < 2) ? 0 : i);\n}\n\nint\t\tft_atoi_base(char *str, char *base, int size)\n{\n\tint i;\n\tint n;\n\tint negative;\n\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile ((i = ft_in_base(*str++, base)) >= 0)\n\t\tn = n * size + i;\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n\nint\t\tft_nbrlen(unsigned int n, unsigned int base_size)\n{\n\tif (n < base_size)\n\t\treturn (1);\n\treturn (1 + ft_nbrlen(n / base_size, base_size));\n}\n\nchar\t*ft_convert_base(char *nbr, char *base_from, char *base_to)\n{\n\tchar\t\t\t*dest;\n\tunsigned int\tnb;\n\tint\t\t\t\tsize;\n\tint\t\t\t\ti;\n\tint\t\t\t\tn;\n\n\tn = ft_checkbase(base_from);\n\tif (!(n && (size = ft_checkbase(base_to))))\n\t\treturn (NULL);\n\tn = ft_atoi_base(nbr, base_from, n);\n\tnb = (n < 0) ? -n : n;\n\ti = ft_nbrlen(nb, size) + ((n < 0) ? 1 : 0);\n\tif (!(dest = malloc((i + 1) * sizeof(char))))\n\t\treturn (NULL);\n\tdest[i] = '\\0';\n\twhile (i--)\n\t{\n\t\tdest[i] = base_to[nb % size];\n\t\tnb /= size;\n\t}\n\tif (n < 0)\n\t\tdest[0] = '-';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c07/ex04/ft_convert_base2.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_convert_base2.c                                 :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/10 06:20:53 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/10 09:56:54 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_useless(void)\n{\n\treturn ;\n}\n"
  },
  {
    "path": "c07/ex05/ft_split.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_split.c                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/10 05:33:05 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/12 10:41:51 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t\tft_is_separator(char *str, char *charset)\n{\n\twhile (*charset)\n\t\tif (*str == *charset++)\n\t\t\treturn (1);\n\treturn (0);\n}\n\nint\t\tft_wordlen(char *str, char *charset)\n{\n\tint i;\n\n\ti = 0;\n\twhile (str[i] && !ft_is_separator(str + i, charset))\n\t\ti++;\n\treturn (i);\n}\n\nint\t\tft_wordcount(char *str, char *charset)\n{\n\tint i;\n\tint w;\n\n\tw = 0;\n\twhile (*str)\n\t{\n\t\twhile (*str && ft_is_separator(str, charset))\n\t\t\tstr++;\n\t\ti = ft_wordlen(str, charset);\n\t\tstr += i;\n\t\tif (i)\n\t\t\tw++;\n\t}\n\treturn (w);\n}\n\nchar\t*ft_wordcpy(char *src, int n)\n{\n\tchar\t*dest;\n\n\tif (!(dest = malloc((n + 1) * sizeof(char))))\n\t\treturn (NULL);\n\tdest[n] = '\\0';\n\twhile (n--)\n\t\tdest[n] = src[n];\n\treturn (dest);\n}\n\nchar\t**ft_split(char *str, char *charset)\n{\n\tchar\t**t;\n\tint\t\tsize;\n\tint\t\ti;\n\tint\t\tn;\n\n\tsize = ft_wordcount(str, charset);\n\tif (!(t = malloc((size + 1) * sizeof(char*))))\n\t\treturn (NULL);\n\ti = -1;\n\twhile (++i < size)\n\t{\n\t\twhile (*str && ft_is_separator(str, charset))\n\t\t\tstr++;\n\t\tn = ft_wordlen(str, charset);\n\t\tif (!(t[i] = ft_wordcpy(str, n)))\n\t\t\treturn (NULL);\n\t\tstr += n;\n\t}\n\tt[size] = 0;\n\treturn (t);\n}\n"
  },
  {
    "path": "c08/ex00/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/11 08:21:45 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/11 10:24:47 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\nvoid\tft_putchar(char c);\nvoid\tft_swap(int *a, int *b);\nvoid\tft_putstr(char *str);\nint\t\tft_strlen(char *str);\nint\t\tft_strcmp(char *s1, char *s2);\n\n#endif\n"
  },
  {
    "path": "c08/ex01/ft_boolean.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_boolean.h                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/11 10:31:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/11 11:23:59 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BOOLEAN_H\n# define FT_BOOLEAN_H\n\n# include <unistd.h>\n\ntypedef char\tt_bool;\n# define FALSE 0\n# define TRUE 1\n\n# define SUCCESS 0\n# define EVEN_MSG \"I have an even number of arguments.\\n\"\n# define ODD_MSG \"I have an odd number of arguments.\\n\"\n\n# define EVEN(X) ((X % 2) ? 0 : 1)\n\n#endif\n"
  },
  {
    "path": "c08/ex02/ft_abs.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_abs.h                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/11 11:12:59 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/11 11:15:09 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_ABS_H\n# define FT_ABS_H\n\n# define ABS(Value) ((Value < 0) ? -Value : Value)\n\n#endif\n"
  },
  {
    "path": "c08/ex03/ft_point.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_point.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/11 11:16:08 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/11 16:05:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_POINT_H\n# define FT_POINT_H\n\ntypedef struct\ts_point\n{\n\tint x;\n\tint y;\n}\t\t\t\tt_point;\n\n#endif\n"
  },
  {
    "path": "c08/ex04/ft_strs_to_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strs_to_tab.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/11 11:52:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/12 11:12:38 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_stock_str.h\"\n\nint\t\t\t\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nchar\t\t\t\t*ft_strdup(char *src)\n{\n\tchar\t*dest;\n\tint\t\ti;\n\n\tdest = malloc((ft_strlen(src) + 1) * sizeof(char));\n\tif (!dest)\n\t\treturn (NULL);\n\ti = -1;\n\twhile (src[++i])\n\t\tdest[i] = src[i];\n\tdest[i] = '\\0';\n\treturn (dest);\n}\n\nstruct s_stock_str\t*ft_strs_to_tab(int ac, char **av)\n{\n\tt_stock_str\t*t;\n\tint\t\t\ti;\n\n\tif (ac < 0)\n\t\tac = 0;\n\tif (!(t = malloc((ac + 1) * sizeof(t_stock_str))))\n\t\treturn (NULL);\n\ti = -1;\n\twhile (++i < ac)\n\t{\n\t\tt[i].size = ft_strlen(av[i]);\n\t\tt[i].str = av[i];\n\t\tt[i].copy = ft_strdup(av[i]);\n\t}\n\tt[i].str = 0;\n\treturn (t);\n}\n"
  },
  {
    "path": "c08/ex05/ft_show_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_show_tab.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/11 15:24:50 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/11 15:46:18 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft_stock_str.h\"\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\nvoid\tft_puts(char *str)\n{\n\twhile (*str)\n\t\tft_putchar(*str++);\n\tft_putchar('\\n');\n}\n\nvoid\tft_putnbr(int nb)\n{\n\tunsigned int n;\n\n\tif (nb < 0)\n\t{\n\t\tft_putchar('-');\n\t\tn = -nb;\n\t}\n\telse\n\t\tn = nb;\n\tif (n > 9)\n\t{\n\t\tft_putnbr(n / 10);\n\t\tn %= 10;\n\t}\n\tft_putchar(n + '0');\n}\n\nvoid\tft_show_tab(struct s_stock_str *par)\n{\n\tif (!par)\n\t\treturn ;\n\twhile (par->str)\n\t{\n\t\tft_puts(par->str);\n\t\tft_putnbr(par->size);\n\t\tft_putchar('\\n');\n\t\tft_puts(par->copy);\n\t\tpar++;\n\t}\n}\n"
  },
  {
    "path": "c09/ex00/ft_putchar.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:19:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:28:36 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n"
  },
  {
    "path": "c09/ex00/ft_putstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:00:11 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:40:51 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nint\t\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n\nvoid\tft_putstr(char *str)\n{\n\twrite(1, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c09/ex00/ft_strcmp.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcmp.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 01:25:21 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 01:37:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strcmp(char *s1, char *s2)\n{\n\twhile (*s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t}\n\treturn (*s1 - *s2);\n}\n"
  },
  {
    "path": "c09/ex00/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:30:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c09/ex00/ft_swap.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_swap.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 02:53:08 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 02:54:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_swap(int *a, int *b)\n{\n\tint c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n"
  },
  {
    "path": "c09/ex00/libft_creator.sh",
    "content": "#!/bin/sh\ngcc -Wall -Wextra -Werror -c *.c\nar -rcs libft.a *.o\n"
  },
  {
    "path": "c09/ex01/Makefile",
    "content": "SRCS\t\t= ft_putchar.c ft_swap.c ft_putstr.c ft_strlen.c ft_strcmp.c\n\nOBJS\t\t= $(addprefix srcs/, ${SRCS:.c=.o})\n\nNAME\t\t= libft.a\n\n.c.o:\n\t\t\tgcc -Wall -Wextra -Werror -c -I./includes $< -o ${<:.c=.o}\n\n${NAME}:\t${OBJS}\n\t\t\tar -rcs $@ $^\n\nall:\t\t${NAME}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c09/ex02/ft_split.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_split.c                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/10 05:33:05 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/12 10:41:51 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t\tft_is_separator(char *str, char *charset)\n{\n\twhile (*charset)\n\t\tif (*str == *charset++)\n\t\t\treturn (1);\n\treturn (0);\n}\n\nint\t\tft_wordlen(char *str, char *charset)\n{\n\tint i;\n\n\ti = 0;\n\twhile (str[i] && !ft_is_separator(str + i, charset))\n\t\ti++;\n\treturn (i);\n}\n\nint\t\tft_wordcount(char *str, char *charset)\n{\n\tint i;\n\tint w;\n\n\tw = 0;\n\twhile (*str)\n\t{\n\t\twhile (*str && ft_is_separator(str, charset))\n\t\t\tstr++;\n\t\ti = ft_wordlen(str, charset);\n\t\tstr += i;\n\t\tif (i)\n\t\t\tw++;\n\t}\n\treturn (w);\n}\n\nchar\t*ft_wordcpy(char *src, int n)\n{\n\tchar\t*dest;\n\n\tif (!(dest = malloc((n + 1) * sizeof(char))))\n\t\treturn (NULL);\n\tdest[n] = '\\0';\n\twhile (n--)\n\t\tdest[n] = src[n];\n\treturn (dest);\n}\n\nchar\t**ft_split(char *str, char *charset)\n{\n\tchar\t**t;\n\tint\t\tsize;\n\tint\t\ti;\n\tint\t\tn;\n\n\tsize = ft_wordcount(str, charset);\n\tif (!(t = malloc((size + 1) * sizeof(char*))))\n\t\treturn (NULL);\n\ti = -1;\n\twhile (++i < size)\n\t{\n\t\twhile (*str && ft_is_separator(str, charset))\n\t\t\tstr++;\n\t\tn = ft_wordlen(str, charset);\n\t\tif (!(t[i] = ft_wordcpy(str, n)))\n\t\t\treturn (NULL);\n\t\tstr += n;\n\t}\n\tt[size] = 0;\n\treturn (t);\n}\n"
  },
  {
    "path": "c10/ex00/Makefile",
    "content": "SRCS\t\t= ft_display_file.c \\\n\t\t\t  ft_putstr_fd.c \\\n\t\t\t  ft_strlen.c \\\n\t\t\t  main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= ft_display_file\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c10/ex00/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 22:32:41 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:33:37 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\nint\t\tft_display_file(char *path);\n\nvoid\tft_putstr_fd(char *str, int fd);\n\nint\t\tft_strlen(char *str);\n\n#endif\n"
  },
  {
    "path": "c10/ex00/ft_display_file.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_display_file.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/14 22:17:46 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/15 16:45:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <fcntl.h>\n#include <unistd.h>\n\nint\tft_display_file(char *path)\n{\n\tchar\tbuf[2048];\n\tint\t\tfd;\n\tint\t\tlen;\n\n\tif ((fd = open(path, O_RDONLY)) < 0)\n\t\treturn (-1);\n\twhile ((len = read(fd, buf, 2048)) > 0)\n\t\twrite(1, buf, len);\n\tclose(fd);\n\treturn ((len) ? -1 : 0);\n}\n"
  },
  {
    "path": "c10/ex00/ft_putstr_fd.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr_fd.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:42:27 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:34:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_putstr_fd(char *str, int fd)\n{\n\twrite(fd, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c10/ex00/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:18:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c10/ex00/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:32:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:34:16 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nint\t\tmain(int argc, char **argv)\n{\n\tif (argc < 2)\n\t\tft_putstr_fd(\"File name missing.\\n\", STDERR_FILENO);\n\telse if (argc > 2)\n\t\tft_putstr_fd(\"Too many arguments.\\n\", STDERR_FILENO);\n\telse if (ft_display_file(argv[1]) < 0)\n\t\tft_putstr_fd(\"Cannot read file.\\n\", STDERR_FILENO);\n\treturn (0);\n}\n"
  },
  {
    "path": "c10/ex01/Makefile",
    "content": "SRCS\t\t= ft_display_file.c \\\n\t\t\t  ft_putchar_fd.c \\\n\t\t\t  ft_puterr.c \\\n\t\t\t  ft_putstr_fd.c \\\n\t\t\t  ft_strcmp.c \\\n\t\t\t  ft_strlen.c \\\n\t\t\t  main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= ft_cat\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c10/ex01/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 22:32:41 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:44:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\nint\t\tft_display_file(char *path);\n\nvoid\tft_putchar_fd(char c, int fd);\n\nvoid\tft_puterr(char *bin, char *path, char *error);\n\nvoid\tft_putstr_fd(char *str, int fd);\n\nint\t\tft_strcmp(char *s1, char *s2);\n\nint\t\tft_strlen(char *str);\n\n#endif\n"
  },
  {
    "path": "c10/ex01/ft_display_file.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_display_file.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/14 22:17:46 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 17:41:42 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <fcntl.h>\n#include <unistd.h>\n\nint\tft_display_file(char *path)\n{\n\tchar\tbuf[2048];\n\tint\t\tfd;\n\tint\t\tlen;\n\n\tfd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;\n\tif (fd < 0)\n\t\treturn (-1);\n\twhile ((len = read(fd, buf, 2048)) > 0)\n\t\twrite(1, buf, len);\n\tif (fd != STDIN_FILENO)\n\t\tclose(fd);\n\treturn ((len) ? -1 : 0);\n}\n"
  },
  {
    "path": "c10/ex01/ft_putchar_fd.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar_fd.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/15 16:10:45 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/15 16:12:44 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar_fd(char c, int fd)\n{\n\twrite(fd, &c, 1);\n}\n"
  },
  {
    "path": "c10/ex01/ft_puterr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_puterr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 17:15:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:43:18 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_puterr(char *bin, char *path, char *error)\n{\n\tft_putstr_fd(bin, STDERR_FILENO);\n\tft_putstr_fd(\": \", STDERR_FILENO);\n\tft_putstr_fd(path, STDERR_FILENO);\n\tft_putstr_fd(\": \", STDERR_FILENO);\n\tft_putstr_fd(error, STDERR_FILENO);\n\tft_putchar_fd('\\n', STDERR_FILENO);\n}\n"
  },
  {
    "path": "c10/ex01/ft_putstr_fd.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr_fd.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:42:27 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:43:32 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_putstr_fd(char *str, int fd)\n{\n\twrite(fd, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c10/ex01/ft_strcmp.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcmp.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 01:25:21 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 01:37:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strcmp(char *s1, char *s2)\n{\n\twhile (*s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t}\n\treturn (*s1 - *s2);\n}\n"
  },
  {
    "path": "c10/ex01/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:18:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c10/ex01/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:32:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:43:14 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <errno.h>\n#include <libgen.h>\n#include <string.h>\n#include \"ft.h\"\n\nint\t\tmain(int argc, char **argv)\n{\n\tchar\t*bin;\n\tint\t\ti;\n\n\tbin = basename(argv[0]);\n\tif (argc < 2 && ft_display_file(NULL) < 0)\n\t\tft_puterr(bin, NULL, strerror(errno));\n\ti = 0;\n\twhile (++i < argc)\n\t{\n\t\tif (!ft_strcmp(argv[i], \"-\"))\n\t\t\targv[i] = NULL;\n\t\tif (ft_display_file(argv[i]) < 0)\n\t\t\tft_puterr(bin, argv[i], strerror(errno));\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c10/ex02/Makefile",
    "content": "SRCS\t\t= ft_atoi.c \\\n\t\t\t  ft_putchar_fd.c \\\n\t\t\t  ft_puterr.c \\\n\t\t\t  ft_putstr_fd.c \\\n\t\t\t  ft_strcmp.c \\\n\t\t\t  ft_strlen.c \\\n\t\t\t  ft_strncpy.c \\\n\t\t\t  ft_tail.c \\\n\t\t\t  main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= ft_tail\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c10/ex02/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 22:32:41 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 23:18:51 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\nint\t\tft_atoi(char *str);\n\nint\t\tft_display_file(char *path);\n\nvoid\tft_putchar_fd(char c, int fd);\n\nvoid\tft_puterr(char *bin, char *path, char *error);\n\nvoid\tft_putstr_fd(char *str, int fd);\n\nint\t\tft_strcmp(char *s1, char *s2);\n\nint\t\tft_strlen(char *str);\n\nchar\t*ft_strncpy(char *dest, char *src, unsigned int n);\n\nint\t\tft_tail(char *path, unsigned int n, int count, int print_path);\n\n#endif\n"
  },
  {
    "path": "c10/ex02/ft_atoi.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_atoi.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 06:20:50 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:35:23 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_atoi(char *str)\n{\n\tint n;\n\tint negative;\n\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile (*str >= '0' && *str <= '9')\n\t\tn = n * 10 + *str++ - '0';\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n"
  },
  {
    "path": "c10/ex02/ft_putchar_fd.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar_fd.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/15 16:10:45 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/15 16:12:44 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar_fd(char c, int fd)\n{\n\twrite(fd, &c, 1);\n}\n"
  },
  {
    "path": "c10/ex02/ft_puterr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_puterr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 17:15:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:48:17 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_puterr(char *bin, char *path, char *error)\n{\n\tft_putstr_fd(bin, STDERR_FILENO);\n\tft_putstr_fd(\": \", STDERR_FILENO);\n\tft_putstr_fd(path, STDERR_FILENO);\n\tft_putstr_fd(\": \", STDERR_FILENO);\n\tft_putstr_fd(error, STDERR_FILENO);\n\tft_putchar_fd('\\n', STDERR_FILENO);\n}\n"
  },
  {
    "path": "c10/ex02/ft_putstr_fd.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr_fd.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:42:27 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:56:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_putstr_fd(char *str, int fd)\n{\n\twrite(fd, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c10/ex02/ft_strcmp.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strcmp.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/04 01:25:21 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/04 01:37:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strcmp(char *s1, char *s2)\n{\n\twhile (*s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t}\n\treturn (*s1 - *s2);\n}\n"
  },
  {
    "path": "c10/ex02/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:18:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c10/ex02/ft_strncpy.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strncpy.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 22:19:59 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:20:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strncpy(char *dest, char *src, unsigned int n)\n{\n\tunsigned int i;\n\n\ti = -1;\n\twhile (++i < n && src[i])\n\t\tdest[i] = src[i];\n\twhile (i < n)\n\t\tdest[i++] = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "c10/ex02/ft_tail.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_tail.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/15 16:51:18 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 23:47:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <fcntl.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include \"ft.h\"\n\nchar\t*ft_load_file(int fd, unsigned int *size)\n{\n\tchar\tbuf[2048];\n\tchar\t*content;\n\tchar\t*tmp;\n\tint\t\tlen;\n\n\tif (!(content = malloc(sizeof(char))))\n\t\treturn (NULL);\n\t*content = '\\0';\n\t*size = 0;\n\twhile ((len = read(fd, buf, 2048)) > 0)\n\t{\n\t\tif (!(tmp = malloc((*size + len) * sizeof(char))))\n\t\t\tbreak ;\n\t\ttmp = ft_strncpy(tmp, content, *size);\n\t\tfree(content);\n\t\tft_strncpy(tmp + *size, buf, len);\n\t\tcontent = tmp;\n\t\t*size += len;\n\t\tcontent[*size] = '\\0';\n\t}\n\tif (len)\n\t\tfree(content);\n\treturn ((len) ? NULL : content);\n}\n\nint\t\tft_tail(char *path, unsigned int n, int count, int print_path)\n{\n\tchar\t\t\t*content;\n\tint\t\t\t\tfd;\n\tunsigned int\tsize;\n\n\tfd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;\n\tif (fd < 0)\n\t\treturn (-1);\n\tcontent = ft_load_file(fd, &size);\n\tif (fd != STDIN_FILENO)\n\t\tclose(fd);\n\tif (!content)\n\t\treturn (-1);\n\tif (print_path)\n\t{\n\t\tif (count)\n\t\t\tft_putchar_fd('\\n', 1);\n\t\tft_putstr_fd(\"==> \", 1);\n\t\tft_putstr_fd(path, 1);\n\t\tft_putstr_fd(\" <==\\n\", 1);\n\t}\n\tif (n > size)\n\t\tn = size;\n\tft_putstr_fd(content + size - n, 1);\n\tfree(content);\n\treturn (0);\n}\n"
  },
  {
    "path": "c10/ex02/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:32:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:55:02 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <errno.h>\n#include <libgen.h>\n#include <string.h>\n#include \"ft.h\"\n\nint\t\tmain(int argc, char **argv)\n{\n\tchar\t\t\t*bin;\n\tint\t\t\t\ti;\n\tint\t\t\t\tcount;\n\tunsigned int\tn;\n\n\tif (argc < 3 || ft_strcmp(argv[1], \"-c\"))\n\t\treturn (0);\n\tbin = basename(argv[0]);\n\ti = ft_atoi(argv[2]);\n\tn = (i < 0) ? -i : i;\n\tif (argc < 4 && ft_tail(NULL, n, 0, 0) < 0)\n\t\tft_puterr(bin, NULL, strerror(errno));\n\ti = 2;\n\tcount = 0;\n\twhile (++i < argc)\n\t{\n\t\tif (ft_tail(argv[i], n, count, argc > 4) < 0)\n\t\t\tft_puterr(bin, argv[i], strerror(errno));\n\t\telse\n\t\t\tcount++;\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c11/ex00/ft_foreach.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_foreach.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 21:06:37 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 21:20:17 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_foreach(int *tab, int length, void (*f)(int))\n{\n\tint i;\n\n\ti = 0;\n\twhile (i < length)\n\t\tf(tab[i++]);\n}\n"
  },
  {
    "path": "c11/ex01/ft_map.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_map.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 21:17:48 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 21:28:26 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nint\t*ft_map(int *tab, int length, int (*f)(int))\n{\n\tint *ret;\n\tint i;\n\n\tif (length < 1 || !(ret = malloc(length * sizeof(int))))\n\t\treturn (NULL);\n\ti = -1;\n\twhile (++i < length)\n\t\tret[i] = f(tab[i]);\n\treturn (ret);\n}\n"
  },
  {
    "path": "c11/ex02/ft_any.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_any.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 21:29:30 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 01:42:50 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_any(char **tab, int (*f)(char*))\n{\n\tint i;\n\n\ti = 0;\n\twhile (tab[i])\n\t\tif (f(tab[i++]))\n\t\t\treturn (1);\n\treturn (0);\n}\n"
  },
  {
    "path": "c11/ex03/ft_count_if.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_count_if.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 01:43:23 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 03:40:08 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_count_if(char **tab, int length, int (*f)(char*))\n{\n\tint i;\n\tint n;\n\n\ti = 0;\n\tn = 0;\n\twhile (i < length)\n\t\tif (f(tab[i++]))\n\t\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c11/ex04/ft_is_sort.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_is_sort.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 03:41:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 00:10:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_is_sort(int *tab, int length, int (*f)(int, int))\n{\n\tint i;\n\tint r;\n\tint r2;\n\n\ti = 1;\n\twhile (i < length && !(r = f(tab[i - 1], tab[i])))\n\t\ti++;\n\twhile (i < length)\n\t{\n\t\tr2 = f(tab[i - 1], tab[i]);\n\t\tif ((r < 0 && r2 > 0) || (r > 0 && r2 < 0))\n\t\t\treturn (0);\n\t\ti++;\n\t}\n\treturn (1);\n}\n"
  },
  {
    "path": "c11/ex05/Makefile",
    "content": "SRCS\t\t= ft_atoi.c \\\n\t\t\t  ft_op.c \\\n\t\t\t  ft_putchar.c \\\n\t\t\t  ft_putnbr.c \\\n\t\t\t  ft_putstr.c \\\n\t\t\t  ft_strlen.c \\\n\t\t\t  main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= do-op\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c11/ex05/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 04:21:58 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 14:42:52 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\ntypedef enum\te_op\n{\n\top_sum,\n\top_sub,\n\top_div,\n\top_mul,\n\top_mod,\n\top_null,\n}\t\t\t\tt_op;\n\nvoid\tft_sum(int a, int b);\n\nvoid\tft_sub(int a, int b);\n\nvoid\tft_div(int a, int b);\n\nvoid\tft_mul(int a, int b);\n\nvoid\tft_mod(int a, int b);\n\nint\t\tft_atoi(char *str);\n\nvoid\tft_putchar(char c);\n\nvoid\tft_putnbr(int nb);\n\nvoid\tft_putstr(char *str);\n\nint\t\tft_strlen(char *str);\n\n#endif\n"
  },
  {
    "path": "c11/ex05/ft_atoi.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_atoi.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 06:20:50 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/07 02:35:23 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_atoi(char *str)\n{\n\tint n;\n\tint negative;\n\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile (*str >= '0' && *str <= '9')\n\t\tn = n * 10 + *str++ - '0';\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n"
  },
  {
    "path": "c11/ex05/ft_op.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_do-op.c                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 05:08:56 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 14:41:39 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft.h\"\n\nvoid\tft_sum(int a, int b)\n{\n\tft_putnbr(a + b);\n}\n\nvoid\tft_sub(int a, int b)\n{\n\tft_putnbr(a - b);\n}\n\nvoid\tft_div(int a, int b)\n{\n\tif (b)\n\t\tft_putnbr(a / b);\n\telse\n\t\tft_putstr(\"Stop : division by zero\");\n}\n\nvoid\tft_mul(int a, int b)\n{\n\tft_putnbr(a * b);\n}\n\nvoid\tft_mod(int a, int b)\n{\n\tif (b)\n\t\tft_putnbr(a % b);\n\telse\n\t\tft_putstr(\"Stop : modulo by zero\");\n}\n"
  },
  {
    "path": "c11/ex05/ft_putchar.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:19:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:28:36 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n"
  },
  {
    "path": "c11/ex05/ft_putnbr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putnbr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/02 13:02:20 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 13:41:50 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_putnbr(int nb)\n{\n\tunsigned int n;\n\n\tif (nb < 0)\n\t{\n\t\tft_putchar('-');\n\t\tn = -nb;\n\t}\n\telse\n\t\tn = nb;\n\tif (n > 9)\n\t{\n\t\tft_putnbr(n / 10);\n\t\tn %= 10;\n\t}\n\tft_putchar(n + '0');\n}\n"
  },
  {
    "path": "c11/ex05/ft_putstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:00:11 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 05:37:21 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_putstr(char *str)\n{\n\twrite(1, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "c11/ex05/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:18:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "c11/ex05/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 15:25:06 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 15:25:16 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft.h\"\n\nt_op\tft_get_index(char *str)\n{\n\tif (!*str || str[1])\n\t\treturn (op_null);\n\tif (*str == '+')\n\t\treturn (op_sum);\n\tif (*str == '-')\n\t\treturn (op_sub);\n\tif (*str == '/')\n\t\treturn (op_div);\n\tif (*str == '*')\n\t\treturn (op_mul);\n\tif (*str == '%')\n\t\treturn (op_mod);\n\treturn (op_null);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tvoid\t(*do_op[5])(int, int);\n\tt_op\top;\n\n\tdo_op[op_sum] = &ft_sum;\n\tdo_op[op_sub] = &ft_sub;\n\tdo_op[op_div] = &ft_div;\n\tdo_op[op_mul] = &ft_mul;\n\tdo_op[op_mod] = &ft_mod;\n\tif (argc == 4)\n\t{\n\t\top = ft_get_index(argv[2]);\n\t\tif (op == op_null)\n\t\t\tft_putnbr(0);\n\t\telse\n\t\t\tdo_op[op](ft_atoi(argv[1]), ft_atoi(argv[3]));\n\t\tft_putchar('\\n');\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "c11/ex06/ft_sort_string_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sort_string_tab.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 14:54:30 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/17 15:12:29 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_strcmp(char *s1, char *s2)\n{\n\twhile (*s1 && *s1 == *s2)\n\t{\n\t\ts1++;\n\t\ts2++;\n\t}\n\treturn (*s1 - *s2);\n}\n\nvoid\tft_strswap(char **a, char **b)\n{\n\tchar *c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n\nvoid\tft_sort_str_tab(char **tab, int size)\n{\n\tchar\t*pivot;\n\tint\t\ti;\n\tint\t\tj;\n\n\tif (size < 2)\n\t\treturn ;\n\tpivot = tab[--size];\n\ti = 0;\n\tj = -1;\n\twhile (++j < size)\n\t\tif (ft_strcmp(tab[j], pivot) < 0)\n\t\t\tft_strswap(&tab[i++], &tab[j]);\n\tif (ft_strcmp(tab[i], tab[size]) > 0)\n\t\tft_strswap(&tab[i], &tab[size]);\n\tft_sort_str_tab(tab, i);\n\tft_sort_str_tab(tab + i + 1, size - i);\n}\n\nvoid\tft_sort_string_tab(char **tab)\n{\n\tint n;\n\n\tn = 0;\n\twhile (tab[n])\n\t\tn++;\n\tft_sort_str_tab(tab, n);\n}\n"
  },
  {
    "path": "c11/ex07/ft_advanced_sort_string_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_advanced_sort_string_tab.c                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 15:09:08 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 01:06:40 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_strswap(char **a, char **b)\n{\n\tchar *c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n\nvoid\tft_advanced_sort_string_tab(char **tab, int (*cmp)(char *, char *))\n{\n\tint size;\n\tint i;\n\n\tsize = 0;\n\twhile (tab[size])\n\t\tsize++;\n\twhile (--size >= 0)\n\t{\n\t\ti = 0;\n\t\twhile (++i <= size)\n\t\t\tif (cmp(tab[i - 1], tab[i]) > 0)\n\t\t\t\tft_strswap(&tab[i - 1], &tab[i]);\n\t}\n}\n"
  },
  {
    "path": "c12/Makefile",
    "content": "SRCS\t\t= ex00/ft_create_elem.c \\\n\t\t\t  ex01/ft_list_push_front.c \\\n\t\t\t  ex02/ft_list_size.c \\\n\t\t\t  ex03/ft_list_last.c \\\n\t\t\t  ex04/ft_list_push_back.c \\\n\t\t\t  ex05/ft_list_push_strs.c \\\n\t\t\t  ex06/ft_list_clear.c \\\n\t\t\t  ex07/ft_list_at.c \\\n\t\t\t  ex08/ft_list_reverse.c \\\n\t\t\t  ex09/ft_list_foreach.c \\\n\t\t\t  ex10/ft_list_foreach_if.c \\\n\t\t\t  ex11/ft_list_find.c \\\n\t\t\t  ex12/ft_list_remove_if.c \\\n\t\t\t  ex13/ft_list_merge.c \\\n\t\t\t  ex14/ft_list_sort.c \\\n\t\t\t  ex15/ft_list_reverse_fun.c \\\n\t\t\t  ex16/ft_sorted_list_insert.c \\\n\t\t\t  ex17/ft_sorted_list_merge.c \\\n\t\t\t  main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= a.out\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -I. -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c12/ex00/ft_create_elem.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_create_elem.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 01:38:16 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 02:17:18 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nt_list\t*ft_create_elem(void *data)\n{\n\tt_list *l;\n\n\tif (!(l = malloc(sizeof(t_list))))\n\t\treturn (NULL);\n\tl->next = NULL;\n\tl->data = data;\n\treturn (l);\n}\n"
  },
  {
    "path": "c12/ex00/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex01/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex01/ft_list_push_front.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_push_front.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 04:53:41 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 18:44:21 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_list_push_front(t_list **begin_list, void *data)\n{\n\tt_list *e;\n\n\tif ((e = ft_create_elem(data)))\n\t{\n\t\tif (*begin_list)\n\t\t\te->next = *begin_list;\n\t\t*begin_list = e;\n\t}\n}\n"
  },
  {
    "path": "c12/ex02/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex02/ft_list_size.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_size.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 19:33:22 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 02:53:06 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nint\tft_list_size(t_list *begin_list)\n{\n\treturn ((begin_list) ? 1 + ft_list_size(begin_list->next) : 0);\n}\n"
  },
  {
    "path": "c12/ex03/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex03/ft_list_last.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_last.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 19:47:55 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 02:55:35 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nt_list\t*ft_list_last(t_list *begin_list)\n{\n\tif (!begin_list || !begin_list->next)\n\t\treturn (begin_list);\n\treturn (ft_list_last(begin_list->next));\n}\n"
  },
  {
    "path": "c12/ex04/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex04/ft_list_push_back.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_push_back.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 20:41:20 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 20:44:26 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_list_push_back(t_list **begin_list, void *data)\n{\n\tif (!*begin_list)\n\t\t*begin_list = ft_create_elem(data);\n\telse if ((*begin_list)->next)\n\t\tft_list_push_back(&(*begin_list)->next, data);\n\telse\n\t\t(*begin_list)->next = ft_create_elem(data);\n}\n"
  },
  {
    "path": "c12/ex05/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex05/ft_list_push_strs.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_push_strs.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 20:42:07 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 02:51:11 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nt_list\t*ft_list_push_strs(int size, char **strs)\n{\n\tt_list\t*begin;\n\tt_list\t*e;\n\tint\t\ti;\n\n\tbegin = NULL;\n\ti = -1;\n\twhile (++i < size && (e = ft_create_elem(strs[i])))\n\t{\n\t\te->next = begin;\n\t\tbegin = e;\n\t}\n\treturn (begin);\n}\n"
  },
  {
    "path": "c12/ex06/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex06/ft_list_clear.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_clear.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 18:15:02 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 02:52:16 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nvoid\tft_list_clear(t_list *begin_list, void (*free_fct)(void *))\n{\n\tif (!begin_list)\n\t\treturn ;\n\tft_list_clear(begin_list->next, free_fct);\n\tif (free_fct)\n\t\tfree_fct(begin_list->data);\n\tfree(begin_list);\n}\n"
  },
  {
    "path": "c12/ex07/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex07/ft_list_at.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_at.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 00:30:41 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 00:45:34 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nt_list\t*ft_list_at(t_list *begin_list, unsigned int nbr)\n{\n\tif (!begin_list || !nbr)\n\t\treturn (begin_list);\n\treturn (ft_list_at(begin_list->next, nbr - 1));\n}\n"
  },
  {
    "path": "c12/ex08/ft_list_reverse.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_reverse.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 00:52:44 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 03:13:57 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nvoid\tft_list_reverse(t_list **begin_list)\n{\n\tt_list *prev;\n\tt_list *next;\n\n\tprev = NULL;\n\twhile (*begin_list)\n\t{\n\t\tnext = (*begin_list)->next;\n\t\t(*begin_list)->next = prev;\n\t\tprev = *begin_list;\n\t\t*begin_list = next;\n\t}\n\t*begin_list = prev;\n}\n"
  },
  {
    "path": "c12/ex09/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex09/ft_list_foreach.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_foreach.c                                  :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 19:02:55 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 19:06:35 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_list_foreach(t_list *begin_list, void (*f)(void *))\n{\n\tif (!begin_list)\n\t\treturn ;\n\tf(begin_list->data);\n\tft_list_foreach(begin_list->next, f);\n}\n"
  },
  {
    "path": "c12/ex10/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex10/ft_list_foreach_if.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_foreach_if.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 02:26:37 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 02:42:30 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_list_foreach_if(t_list *begin_list, void (*f)(void *),\n\t\tvoid *data_ref, int (*cmp)())\n{\n\tif (!begin_list)\n\t\treturn ;\n\tif (!cmp(begin_list->data, data_ref))\n\t\tf(begin_list->data);\n\tft_list_foreach_if(begin_list->next, f, data_ref, cmp);\n}\n"
  },
  {
    "path": "c12/ex11/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex11/ft_list_find.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_find.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 02:44:24 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 03:03:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nt_list\t*ft_list_find(t_list *begin_list, void *data_ref, int (*cmp)())\n{\n\tif (!begin_list || !cmp(begin_list->data, data_ref))\n\t\treturn (begin_list);\n\treturn (ft_list_find(begin_list->next, data_ref, cmp));\n}\n"
  },
  {
    "path": "c12/ex12/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex12/ft_list_remove_if.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_remove_if.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 03:08:37 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 03:02:35 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nvoid\tft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)(),\n\t\tvoid (*free_fct)(void *))\n{\n\tt_list *prev;\n\tt_list *l;\n\n\tprev = NULL;\n\tl = *begin_list;\n\twhile (l)\n\t\tif (!cmp(l->data, data_ref))\n\t\t{\n\t\t\tif (prev)\n\t\t\t\tprev->next = l->next;\n\t\t\telse\n\t\t\t\t*begin_list = l->next;\n\t\t\tif (free_fct)\n\t\t\t\tfree_fct(l->data);\n\t\t\tfree(l);\n\t\t\tl = (prev) ? prev->next : *begin_list;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprev = l;\n\t\t\tl = l->next;\n\t\t}\n}\n"
  },
  {
    "path": "c12/ex13/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex13/ft_list_merge.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_merge.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 04:09:39 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 05:03:46 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_list_merge(t_list **begin_list1, t_list *begin_list2)\n{\n\tif (!*begin_list1)\n\t\t*begin_list1 = begin_list2;\n\telse if ((*begin_list1)->next)\n\t\tft_list_merge(&(*begin_list1)->next, begin_list2);\n\telse\n\t\t(*begin_list1)->next = begin_list2;\n}\n"
  },
  {
    "path": "c12/ex14/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex14/ft_list_sort.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_sort.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 04:32:07 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 07:02:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nt_list\t*ft_merge(t_list *l1, t_list *l2, int (*cmp)())\n{\n\tif (!l1)\n\t\treturn (l2);\n\tif (!l2)\n\t\treturn (l1);\n\tif (cmp(l1->data, l2->data) > 0)\n\t{\n\t\tl2->next = ft_merge(l1, l2->next, cmp);\n\t\treturn (l2);\n\t}\n\tl1->next = ft_merge(l1->next, l2, cmp);\n\treturn (l1);\n}\n\nvoid\tft_list_sort(t_list **begin_list, int (*cmp)())\n{\n\tt_list *prev;\n\tt_list *next;\n\n\tif (!*begin_list || !(*begin_list)->next)\n\t\treturn ;\n\tprev = *begin_list;\n\tnext = prev->next;\n\twhile (next && (next = next->next))\n\t{\n\t\tprev = prev->next;\n\t\tnext = next->next;\n\t}\n\tnext = prev->next;\n\tprev->next = NULL;\n\tft_list_sort(&(*begin_list), cmp);\n\tft_list_sort(&next, cmp);\n\t*begin_list = ft_merge(*begin_list, next, cmp);\n}\n"
  },
  {
    "path": "c12/ex15/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex15/ft_list_reverse_fun.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_reverse_fun.c                              :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 03:08:18 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/22 04:31:55 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nstatic int\t\tft_list_size(t_list *begin_list)\n{\n\treturn ((begin_list) ? 1 + ft_list_size(begin_list->next) : 0);\n}\n\nstatic t_list\t*ft_list_at(t_list *begin_list, unsigned int nbr)\n{\n\tif (!begin_list || !nbr)\n\t\treturn (begin_list);\n\treturn (ft_list_at(begin_list->next, nbr - 1));\n}\n\nvoid\t\t\tft_list_reverse_fun(t_list *begin_list)\n{\n\tt_list\t\t\t*right;\n\tvoid\t\t\t*data;\n\tunsigned int\ti;\n\tunsigned int\tj;\n\n\ti = -1;\n\twhile (begin_list && (j = ft_list_size(begin_list) - ++i) > 1)\n\t{\n\t\tright = ft_list_at(begin_list, j - 1);\n\t\tdata = begin_list->data;\n\t\tbegin_list->data = right->data;\n\t\tright->data = data;\n\t\tbegin_list = begin_list->next;\n\t}\n}\n"
  },
  {
    "path": "c12/ex16/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex16/ft_sorted_list_insert.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sorted_list_insert.c                            :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 03:43:01 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 04:26:57 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_sorted_list_insert(t_list **begin_list, void *data, int (*cmp)())\n{\n\tt_list *e;\n\n\tif (!*begin_list || cmp(data, (*begin_list)->data) <= 0)\n\t{\n\t\tif (!(e = ft_create_elem(data)))\n\t\t\treturn ;\n\t\te->next = *begin_list;\n\t\t*begin_list = e;\n\t}\n\telse\n\t\tft_sorted_list_insert(&(*begin_list)->next, data, cmp);\n}\n"
  },
  {
    "path": "c12/ex17/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 04:51:31 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\n#endif\n"
  },
  {
    "path": "c12/ex17/ft_sorted_list_merge.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sorted_list_merge.c                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 04:35:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 05:18:09 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_sorted_list_insert_elem(t_list **l, t_list *elem,\n\t\tint (*cmp)())\n{\n\tif (!*l || cmp(elem->data, (*l)->data) <= 0)\n\t{\n\t\telem->next = *l;\n\t\t*l = elem;\n\t}\n\telse\n\t\tft_sorted_list_insert_elem(&(*l)->next, elem, cmp);\n}\n\nvoid\tft_sorted_list_merge(t_list **begin_list1, t_list *begin_list2,\n\t\tint (*cmp)())\n{\n\tif (!begin_list2)\n\t\treturn ;\n\tft_sorted_list_merge(begin_list1, begin_list2->next, cmp);\n\tft_sorted_list_insert_elem(begin_list1, begin_list2, cmp);\n}\n"
  },
  {
    "path": "c12/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/22 01:41:33 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\nvoid\t\t\t\tft_list_push_front(t_list **begin_list, void *data);\n\nint\t\t\t\t\tft_list_size(t_list *begin_list);\n\nt_list\t\t\t\t*ft_list_last(t_list *begin_list);\n\nvoid\t\t\t\tft_list_push_back(t_list **begin_list, void *data);\n\nt_list\t\t\t\t*ft_list_push_strs(int size, char **strs);\n\nvoid\t\t\t\tft_list_clear(t_list *begin_list, void (*free_fct)(void *));\n\nt_list\t\t\t\t*ft_list_at(t_list *begin_list, unsigned int nbr);\n\nvoid\t\t\t\tft_list_reverse(t_list **begin_list);\n\nvoid\t\t\t\tft_list_foreach(t_list *begin_list, void (*f)(void *));\n\nvoid\t\t\t\tft_list_foreach_if(t_list *begin_list, void (*f)(void *),\n\t\t\t\t\tvoid *data_ref, int (*cmp)());\n\nt_list\t\t\t\t*ft_list_find(t_list *begin_list, void *data_ref,\n\t\t\t\t\tint (*cmp)());\n\nvoid\t\t\t\tft_list_remove_if(t_list **begin_list, void *data_ref,\n\t\t\t\t\tint (*cmp)(), void (*free_fct)(void *));\n\nvoid\t\t\t\tft_list_merge(t_list **begin_list1, t_list *begin_list2);\n\nvoid\t\t\t\tft_list_sort(t_list **begin_list, int (*cmp)());\n\nvoid\t\t\t\tft_list_reverse_fun(t_list *begin_list);\n\nvoid\t\t\t\tft_sorted_list_insert(t_list **begin_list, void *data,\n\t\t\t\t\tint (*cmp)());\n\nvoid\t\t\t\tft_sorted_list_merge(t_list **begin_list1,\n\t\t\t\t\tt_list *begin_list2, int (*cmp)());\n\n#endif\n"
  },
  {
    "path": "c12/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 04:23:59 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/22 01:41:59 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"ft_list.h\"\n\nvoid\tft_list_print(t_list *l)\n{\n\tif (!l)\n\t{\n\t\tprintf(\"NULL\\n\");\n\t\treturn ;\n\t}\n\tprintf(\"%s -> \", (char *)l->data);\n\tft_list_print(l->next);\n}\n\nt_list\t*ft_list_create(void)\n{\n\tt_list *l;\n\n\tl = NULL;\n\tft_list_push_back(&l, \"a\");\n\tft_list_push_back(&l, \"b\");\n\tft_list_push_back(&l, \"c\");\n\treturn (l);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tt_list *l;\n\tt_list *e;\n\n\tl = ft_list_push_strs(argc - 1, argv + 1);\n\tprintf(\"content: \");\n\tft_list_print(l);\n\tprintf(\"size: %d\\n\", ft_list_size(l));\n\te = ft_list_at(l, 1);\n\tprintf(\"2nd element: \");\n\tif (e)\n\t\tprintf(\"%s\\n\", e->data);\n\telse\n\t\tprintf(\"NULL\\n\");\n\tft_list_reverse_fun(l);\n\tprintf(\"reverse content: \");\n\tft_list_print(l);\n\tft_list_sort(&l, &strcmp);\n\tprintf(\"sorted content: \");\n\tft_list_print(l);\n\tft_list_remove_if(&l, \"foo\", &strcmp, NULL);\n\tprintf(\"removing foo: \");\n\tft_list_print(l);\n\tft_sorted_list_insert(&l, \"foo\", &strcmp);\n\tprintf(\"inserting foo: \");\n\tft_list_print(l);\n\tft_sorted_list_merge(&l, ft_list_create(), &strcmp);\n\tprintf(\"merging a b c: \");\n\tft_list_print(l);\n\tft_list_clear(l, NULL);\n\treturn (0);\n}\n"
  },
  {
    "path": "c13/Makefile",
    "content": "SRCS\t\t= ex00/btree_create_node.c \\\n\t\t\t  ex01/btree_apply_prefix.c \\\n\t\t\t  ex02/btree_apply_infix.c \\\n\t\t\t  ex03/btree_apply_suffix.c \\\n\t\t\t  ex04/btree_insert_data.c \\\n\t\t\t  ex05/btree_search_item.c \\\n\t\t\t  ex06/btree_level_count.c \\\n\t\t\t  ex07/btree_apply_by_level.c \\\n\t\t\t  main.c\n\nOBJS\t\t= ${SRCS:.c=.o}\n\nNAME\t\t= a.out\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -I. -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "c13/ex00/btree_create_node.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_create_node.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:57:41 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 07:22:15 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_btree.h\"\n\nt_btree\t*btree_create_node(void *item)\n{\n\tt_btree *b;\n\n\tif ((b = malloc(sizeof(t_btree))))\n\t{\n\t\tb->left = NULL;\n\t\tb->right = NULL;\n\t\tb->item = item;\n\t}\n\treturn (b);\n}\n"
  },
  {
    "path": "c13/ex00/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex01/btree_apply_prefix.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_apply_prefix.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 07:19:06 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 03:01:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_btree.h\"\n\nvoid\tbtree_apply_prefix(t_btree *root, void (*applyf)(void *))\n{\n\tif (!root)\n\t\treturn ;\n\tapplyf(root->item);\n\tbtree_apply_prefix(root->left, applyf);\n\tbtree_apply_prefix(root->right, applyf);\n}\n"
  },
  {
    "path": "c13/ex01/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex02/btree_apply_infix.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_apply_infix.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 07:25:52 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 03:01:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_btree.h\"\n\nvoid\tbtree_apply_infix(t_btree *root, void (*applyf)(void *))\n{\n\tif (!root)\n\t\treturn ;\n\tbtree_apply_infix(root->left, applyf);\n\tapplyf(root->item);\n\tbtree_apply_infix(root->right, applyf);\n}\n"
  },
  {
    "path": "c13/ex02/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex03/btree_apply_suffix.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_apply_suffix.c                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 07:27:10 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 03:01:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_btree.h\"\n\nvoid\tbtree_apply_suffix(t_btree *root, void (*applyf)(void *))\n{\n\tif (!root)\n\t\treturn ;\n\tbtree_apply_suffix(root->left, applyf);\n\tbtree_apply_suffix(root->right, applyf);\n\tapplyf(root->item);\n}\n"
  },
  {
    "path": "c13/ex03/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex04/btree_insert_data.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_insert_data.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 07:35:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/22 09:22:27 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_btree.h\"\n\nvoid\tbtree_insert_data(t_btree **root, void *item,\n\t\tint (*cmpf)(void *, void *))\n{\n\tif (!*root)\n\t\t*root = btree_create_node(item);\n\telse if (cmpf(item, (*root)->item) < 0)\n\t\tbtree_insert_data(&(*root)->left, item, cmpf);\n\telse\n\t\tbtree_insert_data(&(*root)->right, item, cmpf);\n}\n"
  },
  {
    "path": "c13/ex04/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex05/btree_search_item.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_search_item.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 07:44:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 06:26:54 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_btree.h\"\n\nvoid\t*btree_search_item(t_btree *root, void *data_ref,\n\t\tint (*cmpf)(void *, void *))\n{\n\tvoid *item;\n\n\tif (!root)\n\t\treturn (NULL);\n\tif ((item = btree_search_item(root->left, data_ref, cmpf)))\n\t\treturn (item);\n\tif (!cmpf(data_ref, root->item))\n\t\treturn (root->item);\n\treturn (btree_search_item(root->right, data_ref, cmpf));\n}\n"
  },
  {
    "path": "c13/ex05/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex06/btree_level_count.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_level_count.c                                :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/22 10:36:51 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/22 10:39:26 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_btree.h\"\n\nint\tbtree_level_count(t_btree *root)\n{\n\tint left;\n\tint right;\n\n\tif (!root)\n\t\treturn (0);\n\tleft = btree_level_count(root->left);\n\tright = btree_level_count(root->right);\n\treturn (1 + ((left > right) ? left : right));\n}\n"
  },
  {
    "path": "c13/ex06/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ex07/btree_apply_by_level.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   btree_apply_by_level.c                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/22 10:42:49 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 09:47:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_btree.h\"\n\nstatic int\tbtree_level_count(t_btree *root)\n{\n\tint left;\n\tint right;\n\n\tif (!root)\n\t\treturn (0);\n\tleft = btree_level_count(root->left);\n\tright = btree_level_count(root->right);\n\treturn (1 + ((left > right) ? left : right));\n}\n\nvoid\t\tbtree_process_level(t_btree *root, int *t, int level,\n\t\t\tvoid (*applyf)(void *item, int current_level, int is_first_elem))\n{\n\tif (!root)\n\t\treturn ;\n\tif (level == 1)\n\t{\n\t\tapplyf(root->item, t[0], t[1]);\n\t\tt[1] = 0;\n\t}\n\telse if (level > 1)\n\t{\n\t\tbtree_process_level(root->left, t, level - 1, applyf);\n\t\tbtree_process_level(root->right, t, level - 1, applyf);\n\t}\n}\n\nvoid\t\tbtree_apply_by_level(t_btree *root, void (*applyf)(void *item,\n\t\t\tint current_level, int is_first_elem))\n{\n\tint t[3];\n\tint h;\n\tint i;\n\n\tif (!root)\n\t\treturn ;\n\th = btree_level_count(root);\n\ti = 0;\n\twhile (i < h)\n\t{\n\t\tt[0] = i;\n\t\tt[1] = 1;\n\t\tbtree_process_level(root, t, ++i, applyf);\n\t}\n}\n"
  },
  {
    "path": "c13/ex07/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 06:59:25 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\n#endif\n"
  },
  {
    "path": "c13/ft_btree.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_btree.h                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:50:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 00:24:37 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_BTREE_H\n# define FT_BTREE_H\n\ntypedef struct\t\ts_btree\n{\n\tstruct s_btree\t*left;\n\tstruct s_btree\t*right;\n\tvoid\t\t\t*item;\n}\t\t\t\t\tt_btree;\n\nt_btree\t\t\t\t*btree_create_node(void *item);\n\nvoid\t\t\t\tbtree_apply_prefix(t_btree *root, void (*applyf)(void *));\n\nvoid\t\t\t\tbtree_apply_infix(t_btree *root, void (*applyf)(void *));\n\nvoid\t\t\t\tbtree_apply_suffix(t_btree *root, void (*applyf)(void *));\n\nvoid\t\t\t\tbtree_insert_data(t_btree **root, void *item,\n\t\t\t\t\tint (*cmpf)(void *, void *));\n\nvoid\t\t\t\t*btree_search_item(t_btree *root, void *data_ref,\n\t\t\t\t\tint (*cmpf)(void *, void *));\n\nint\t\t\t\t\tbtree_level_count(t_btree *root);\n\nvoid\t\t\t\tbtree_apply_by_level(t_btree *root,\n\t\t\t\t\tvoid (*applyf)(void*item, int current_level,\n\t\t\t\t\tint is_first_elem));\n\n#endif\n"
  },
  {
    "path": "c13/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 06:13:56 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/25 09:42:14 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"ft_btree.h\"\n\nvoid\tbtree_clear(t_btree *root)\n{\n\tif (!root)\n\t\treturn ;\n\tbtree_clear(root->left);\n\tbtree_clear(root->right);\n\tfree(root);\n}\n\nvoid\tbtree_print(t_btree *node, unsigned int deep)\n{\n\tunsigned int i;\n\n\tif (!node)\n\t\treturn ;\n\tif (deep)\n\t{\n\t\ti = 0;\n\t\twhile (++i < deep)\n\t\t\tprintf(\"  \");\n\t\tprintf(\"↳ \");\n\t}\n\tprintf(\"%s\\n\", node->item);\n\tbtree_print(node->left, deep + 1);\n\tbtree_print(node->right, deep + 1);\n}\n\nvoid\tbtree_ultimate_print(void *item, int level, int is_first_elem)\n{\n\tprintf(\"[%s] l:[%d] f:[%d]\\n\", item, level, is_first_elem);\n}\n\nint\t\tft_fakestrcmp(void *s1, void *s2)\n{\n\treturn (strcmp(s1, s2));\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tt_btree\t*b;\n\tint\t\ti;\n\n\tif (argc < 1)\n\t\treturn (0);\n\tb = NULL;\n\ti = 1;\n\twhile (i < argc)\n\t\tbtree_insert_data(&b, argv[i++], &ft_fakestrcmp);\n\tbtree_print(b, 0);\n\tbtree_apply_by_level(b, &btree_ultimate_print);\n\tif (btree_search_item(b, \"foo\", &ft_fakestrcmp))\n\t\tprintf(\"foo found!\\n\");\n\tprintf(\"height: %d\\n\", btree_level_count(b));\n\tbtree_clear(b);\n\treturn (0);\n}\n"
  },
  {
    "path": "other/binary.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   binary.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 17:33:35 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/06 17:46:50 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n\n// fonction qui affiche un caractere en hexadecimal\nvoid\tft_puthex(unsigned char c)\n{\n\tchar *base;\n\n\tbase = \"0123456789abcdef\";\n\t// c >> 4 recupere la dizaine\n\tft_putchar(base[c >> 4]);\n\t// c & 0xf recupere l'unite (== c % 16)\n\tft_putchar(base[c & 0xf]);\n}\n\nint\tmain(void)\n{\n\tunsigned int n = 0x41424344; // \"ABCD\", len = 4 octets = 32 bit\n\t// on affiche uniquement le 'B' en hexadecimal (valeur en ascii = 66 = 42 en base 16)\n\tft_puthex(n >> 16);\n\tft_putchar('\\n');\n\t// on affiche le 'B' en ascii\n\tft_putchar(n >> 16);\n\treturn (0);\n}\n"
  },
  {
    "path": "other/mkdirs.sh",
    "content": "#!/bin/bash\n\nif [ \"$#\" != \"1\" ]; then\n\techo \"error: Invalid argument\"\n\texit\nfi\n\nn=$1 \nwhile [ \"$n\" -ge \"0\" ]; do\n\tif [ \"$n\" -lt \"10\" ]\n\t\tthen mkdir -p \"ex0$n\"\n\telse\n\t\tmkdir -p \"ex$n\"\n\tfi\n\tn=`expr \"$n\" - 1`;\ndone\n"
  },
  {
    "path": "other/sorting.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   sorting.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 04:39:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 04:47:28 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n\nint\t\tft_is_sorted(int *tab, int size)\n{\n\twhile (--size > 0)\n\t\tif (tab[size] < tab[size - 1])\n\t\t\treturn (0);\n\t\treturn (1);\n}\n\nvoid\tft_swap(int *a, int *b)\n{\n\tint c;\n\n\tc = *a;\n\t*a = *b;\n\t*b = c;\n}\n\nvoid\tft_sort_int_tab(int *tab, int size)\n{\n\tint pivot;\n\tint i;\n\tint j;\n\n\tif (size < 2)\n\t\treturn ;\n\tpivot = tab[--size];\n\ti = 0;\n\tj = -1;\n\twhile (++j < size)\n\t\tif (tab[j] < pivot)\n\t\t\tft_swap(&tab[i++], &tab[j]);\n\tif (tab[i] > tab[size])\n\t\tft_swap(&tab[i], &tab[size]);\n\tft_sort_int_tab(tab, i);\n\tft_sort_int_tab(tab + i + 1, size - i);\n}\n\nvoid\tft_bubble_sort(int *tab, int size)\n{\n\tint i, j;\n\t\n\tfor (i = size - 1; i >= 0; i--)\n\t\tfor (j = 1; j <= i; j++)\n\t\t\tif (tab[j - 1] > tab[j])\n\t\t\t\tft_swap(&tab[j - 1], &tab[j]);\n}\n\nvoid\tbenchmark(char *name, int n, void(*sorting)(int *, int))\n{\n\tclock_t start, end;\n\tint t[n];\n\t\t\n\tsrand(0);\n\tfor (int i = 0; i < n; i++)\n\t\tt[i] = rand();\n\tprintf(\"%s:\\n\", name);\n\tstart = clock();\n\tsorting(t, n);\n\tend = clock();\n\tprintf(\"time: %f\\n\", (double)(end - start) / CLOCKS_PER_SEC);\n\t//printf(\"sorted: %d\\n\", ft_is_sorted(t, n));\n}\n\nint\tmain(int argc, char **argv)\n{\n\tif (argc != 2)\n\t\treturn (0);\n\tint n = atoi(argv[1]);\n\tif (n >= 1 && n <= 100000)\n\t{\n\t\tbenchmark(\"ft_sort_int_tab\", n, ft_sort_int_tab);\n\t\tbenchmark(\"ft_bubble_sort\", n, ft_bubble_sort);\n\t}\n\treturn (0);\n}\n"
  },
  {
    "path": "rush00/ex00/ft_putchar.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: tbrondin <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 16:53:35 by tbrondin          #+#    #+#             */\n/*   Updated: 2019/07/06 16:53:39 by tbrondin         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n"
  },
  {
    "path": "rush00/ex00/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: tbrondin <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 16:54:19 by tbrondin          #+#    #+#             */\n/*   Updated: 2019/07/07 23:38:59 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\trush(int x, int y);\n\nint\t\tft_atoi(char *str)\n{\n\tint n;\n\tint negative;\n\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile (*str >= '0' && *str <= '9')\n\t\tn = n * 10 + *str++ - '0';\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tif (argc == 3)\n\t\trush(ft_atoi(argv[1]), ft_atoi(argv[2]));\n\treturn (0);\n}\n"
  },
  {
    "path": "rush00/ex00/rush00.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   rush00.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: tbrondin <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 17:05:10 by tbrondin          #+#    #+#             */\n/*   Updated: 2019/07/06 18:20:13 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_putchar(char c);\n\nvoid\tft_print_line(char left, char middle, char right, int size)\n{\n\tft_putchar(left);\n\twhile (size-- > 2)\n\t\tft_putchar(middle);\n\tif (size == 1)\n\t\tft_putchar(right);\n\tft_putchar('\\n');\n}\n\nvoid\trush(int x, int y)\n{\n\tif (x < 1 || y < 1)\n\t\treturn ;\n\tft_print_line('o', '-', 'o', x);\n\twhile (y-- > 2)\n\t\tft_print_line('|', ' ', '|', x);\n\tif (y == 1)\n\t\tft_print_line('o', '-', 'o', x);\n}\n"
  },
  {
    "path": "rush00/ex00/rush01.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   rush01.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: tbrondin <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 16:51:38 by tbrondin          #+#    #+#             */\n/*   Updated: 2019/07/06 18:20:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_putchar(char c);\n\nvoid\tft_print_line(char left, char middle, char right, int size)\n{\n\tft_putchar(left);\n\twhile (size-- > 2)\n\t\tft_putchar(middle);\n\tif (size == 1)\n\t\tft_putchar(right);\n\tft_putchar('\\n');\n}\n\nvoid\trush(int x, int y)\n{\n\tif (x < 1 || y < 1)\n\t\treturn ;\n\tft_print_line('/', '*', '\\\\', x);\n\twhile (y-- > 2)\n\t\tft_print_line('*', ' ', '*', x);\n\tif (y == 1)\n\t\tft_print_line('\\\\', '*', '/', x);\n}\n"
  },
  {
    "path": "rush00/ex00/rush02.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   rush02.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: alboumed <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 17:15:54 by alboumed          #+#    #+#             */\n/*   Updated: 2019/07/06 18:20:24 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_putchar(char c);\n\nvoid\tft_print_line(char left, char middle, char right, int size)\n{\n\tft_putchar(left);\n\twhile (size-- > 2)\n\t\tft_putchar(middle);\n\tif (size == 1)\n\t\tft_putchar(right);\n\tft_putchar('\\n');\n}\n\nvoid\trush(int x, int y)\n{\n\tif (x < 1 || y < 1)\n\t\treturn ;\n\tft_print_line('A', 'B', 'A', x);\n\twhile (y-- > 2)\n\t\tft_print_line('B', ' ', 'B', x);\n\tif (y == 1)\n\t\tft_print_line('C', 'B', 'C', x);\n}\n"
  },
  {
    "path": "rush00/ex00/rush03.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   rush03.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: tbrondin <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 17:09:43 by tbrondin          #+#    #+#             */\n/*   Updated: 2019/07/06 18:20:33 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_putchar(char c);\n\nvoid\tft_print_line(char left, char middle, char right, int size)\n{\n\tft_putchar(left);\n\twhile (size-- > 2)\n\t\tft_putchar(middle);\n\tif (size == 1)\n\t\tft_putchar(right);\n\tft_putchar('\\n');\n}\n\nvoid\trush(int x, int y)\n{\n\tif (x < 1 || y < 1)\n\t\treturn ;\n\tft_print_line('A', 'B', 'C', x);\n\twhile (y-- > 2)\n\t\tft_print_line('B', ' ', 'B', x);\n\tif (y == 1)\n\t\tft_print_line('A', 'B', 'C', x);\n}\n"
  },
  {
    "path": "rush00/ex00/rush04.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   rush04.c                                           :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: tbrondin <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/06 17:13:36 by tbrondin          #+#    #+#             */\n/*   Updated: 2019/07/06 18:21:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nvoid\tft_putchar(char c);\n\nvoid\tft_print_line(char left, char middle, char right, int size)\n{\n\tft_putchar(left);\n\twhile (size-- > 2)\n\t\tft_putchar(middle);\n\tif (size == 1)\n\t\tft_putchar(right);\n\tft_putchar('\\n');\n}\n\nvoid\trush(int x, int y)\n{\n\tif (x < 1 || y < 1)\n\t\treturn ;\n\tft_print_line('A', 'B', 'C', x);\n\twhile (y-- > 2)\n\t\tft_print_line('B', ' ', 'B', x);\n\tif (y == 1)\n\t\tft_print_line('C', 'B', 'A', x);\n}\n"
  },
  {
    "path": "rush01/ex00/ft_backtrack.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_backtrack.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/14 10:48:54 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 21:19:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_rush.h\"\n\nint\tft_is_valid_value(char **tab, int x, int y, int size)\n{\n\tif (ft_is_duplicate(tab, x, y, size)\n\t\t|| ft_height_col(tab, x, 1, size) > tab[x][size] || (y == size - 1\n\t\t&& ft_height_col(tab, x, -1, size) != tab[x][size + 1])\n\t\t|| ft_height_row(tab, y, 1, size) > tab[y][size + 2] || (x == size - 1\n\t\t&& ft_height_row(tab, y, -1, size) != tab[y][size + 3]))\n\t\treturn (0);\n\treturn (1);\n}\n\nint\tft_backtrack(char **tab, int n, int size)\n{\n\tint i;\n\tint x;\n\tint y;\n\n\tif (n == size * size)\n\t\treturn (1);\n\ti = 0;\n\tx = n % size;\n\ty = n / size;\n\twhile (++i <= size)\n\t{\n\t\ttab[y][x] = i;\n\t\tif (ft_is_valid_value(tab, x, y, size))\n\t\t{\n\t\t\tif (ft_backtrack(tab, n + 1, size))\n\t\t\t\treturn (1);\n\t\t\ttab[y][x] = 0;\n\t\t}\n\t}\n\ttab[y][x] = 0;\n\treturn (0);\n}\n\nint\tft_solve(char **tab, int size)\n{\n\tint i;\n\n\ti = -1;\n\twhile (++i < size)\n\t\tif (tab[i][size] + tab[i][size + 1] > size + 1\n\t\t\t|| tab[i][size + 2] + tab[i][size + 3] > size + 1)\n\t\t\treturn (0);\n\treturn (ft_backtrack(tab, 0, size));\n}\n"
  },
  {
    "path": "rush01/ex00/ft_check.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_check.c                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/14 13:05:13 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 19:55:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_height_col(char **tab, int x, int delta, int size)\n{\n\tint y;\n\tint max;\n\tint vmax;\n\tint height;\n\n\ty = (delta > 0) ? 0 : size - 1;\n\tmax = (delta > 0) ? size : -1;\n\tvmax = 0;\n\theight = 0;\n\twhile (y != max)\n\t{\n\t\tif (!tab[y][x])\n\t\t\treturn (0);\n\t\tif (tab[y][x] > vmax)\n\t\t{\n\t\t\tvmax = tab[y][x];\n\t\t\theight++;\n\t\t}\n\t\ty += delta;\n\t}\n\treturn (height);\n}\n\nint\tft_height_row(char **tab, int y, int delta, int size)\n{\n\tint x;\n\tint max;\n\tint vmax;\n\tint height;\n\n\tx = (delta > 0) ? 0 : size - 1;\n\tmax = (delta > 0) ? size : -1;\n\tvmax = 0;\n\theight = 0;\n\twhile (x != max)\n\t{\n\t\tif (tab[y][x] > vmax)\n\t\t{\n\t\t\tvmax = tab[y][x];\n\t\t\theight++;\n\t\t}\n\t\tx += delta;\n\t}\n\treturn (height);\n}\n\nint\tft_is_duplicate(char **tab, int x, int y, int size)\n{\n\tint i;\n\n\tif (!tab[y][x])\n\t\treturn (0);\n\ti = y;\n\twhile (i--)\n\t\tif (tab[y][x] == tab[i][x])\n\t\t\treturn (1);\n\ti = y;\n\twhile (++i < size)\n\t\tif (tab[y][x] == tab[i][x])\n\t\t\treturn (1);\n\ti = x;\n\twhile (i--)\n\t\tif (tab[y][x] == tab[y][i])\n\t\t\treturn (1);\n\ti = x;\n\twhile (++i < size)\n\t\tif (tab[y][x] == tab[y][i])\n\t\t\treturn (1);\n\treturn (0);\n}\n"
  },
  {
    "path": "rush01/ex00/ft_destroy_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_destroy_tab.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/14 10:51:18 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 20:04:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_rush.h\"\n\nvoid\tft_destroy_tab(char **tab, int size)\n{\n\twhile (size--)\n\t\tfree(tab[size]);\n\tfree(tab);\n}\n"
  },
  {
    "path": "rush01/ex00/ft_get_size.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_get_size.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/13 13:02:06 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 21:20:47 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_is_valid(char *str, int size)\n{\n\tint i;\n\tint j;\n\n\ti = -1;\n\tj = size / 4;\n\twhile (++i < size)\n\t{\n\t\tif (*str < '1' || *str > j + '0')\n\t\t\treturn (0);\n\t\tstr += 2;\n\t}\n\treturn (j);\n}\n\nint\t\tft_get_size(char *str)\n{\n\tint size;\n\tint i;\n\n\tsize = 0;\n\ti = 0;\n\twhile (str[i])\n\t{\n\t\tif (str[i] >= '1' && str[i] <= '9')\n\t\t\tsize++;\n\t\telse\n\t\t\treturn (0);\n\t\tif (str[++i] == ' ' && !str[++i])\n\t\t\treturn (0);\n\t}\n\tif (size != 16)\n\t\treturn (0);\n\treturn (ft_is_valid(str, size));\n}\n"
  },
  {
    "path": "rush01/ex00/ft_init_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_init_tab.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/13 13:01:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 12:17:04 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nchar\t**ft_init_tab(char *str, int size)\n{\n\tchar\t**tab;\n\tint\t\tx;\n\tint\t\ty;\n\n\tif (!(tab = malloc(size * sizeof(char*))))\n\t\treturn (NULL);\n\ty = -1;\n\twhile (++y < size)\n\t{\n\t\tif (!(tab[y] = malloc((size + 4) * sizeof(char))))\n\t\t\treturn (NULL);\n\t\tx = -1;\n\t\twhile (++x < size)\n\t\t\ttab[y][x] = 0;\n\t\tx = -1;\n\t\twhile (++x < 4)\n\t\t\ttab[y][size + x] = str[2 * (y + x * size)] - '0';\n\t}\n\treturn (tab);\n}\n"
  },
  {
    "path": "rush01/ex00/ft_print_tab.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_printtab.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: ogrosset <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/13 12:22:29 by ogrosset          #+#    #+#             */\n/*   Updated: 2019/07/14 20:31:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_rush.h\"\n\nvoid\tft_print_tab(char **tab, int size)\n{\n\tint x;\n\tint y;\n\n\ty = 0;\n\twhile (y < size)\n\t{\n\t\tx = 0;\n\t\twhile (x < size)\n\t\t{\n\t\t\tft_putchar(tab[y][x] + '0');\n\t\t\tif (++x < size)\n\t\t\t\tft_putchar(' ');\n\t\t}\n\t\tft_putchar('\\n');\n\t\ty++;\n\t}\n}\n"
  },
  {
    "path": "rush01/ex00/ft_putchar.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/13 10:25:09 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/13 10:38:04 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n"
  },
  {
    "path": "rush01/ex00/ft_putstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/13 10:27:01 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 20:05:23 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_rush.h\"\n\nvoid\tft_putstr(char *str)\n{\n\twhile (*str)\n\t\tft_putchar(*str++);\n}\n"
  },
  {
    "path": "rush01/ex00/ft_rush.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_rush.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/14 20:03:57 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 21:08:10 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_RUSH_H\n# define FT_RUSH_H\n\nvoid\tft_putchar(char c);\n\nvoid\tft_putstr(char *str);\n\nint\t\tft_get_size(char *str);\n\nchar\t**ft_init_tab(char *str, int size);\n\nint\t\tft_solve(char **tab, int size);\n\nvoid\tft_print_tab(char **tab, int size);\n\nvoid\tft_destroy_tab(char **tab, int size);\n\nint\t\tft_height_col(char **tab, int x, int delta, int size);\n\nint\t\tft_height_row(char **tab, int y, int delta, int size);\n\nint\t\tft_is_duplicate(char **tab, int x, int y, int size);\n\n#endif\n"
  },
  {
    "path": "rush01/ex00/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/13 10:25:54 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/14 21:07:52 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_rush.h\"\n\nvoid\tft_error_message(void)\n{\n\tft_putstr(\"Error\\n\");\n}\n\nint\t\tmain(int argc, char **argv)\n{\n\tchar\t**tab;\n\tint\t\tsize;\n\n\tif (argc != 2 || !(size = ft_get_size(argv[1])))\n\t\tft_error_message();\n\telse if ((tab = ft_init_tab(argv[1], size)))\n\t{\n\t\tif (ft_solve(tab, size))\n\t\t\tft_print_tab(tab, size);\n\t\tft_destroy_tab(tab, size);\n\t}\n\telse\n\t\tft_error_message();\n\treturn (0);\n}\n"
  },
  {
    "path": "rush02/ex00/Makefile",
    "content": "SRCS\t\t= ft/ft_atol.c \\\n\t\t\t  ft/ft_check_args.c \\\n\t\t\t  ft/ft_file_load.c \\\n\t\t\t  ft/ft_isdigit.c \\\n\t\t\t  ft/ft_isprint.c \\\n\t\t\t  ft/ft_is_valid.c \\\n\t\t\t  ft/ft_isspace.c \\\n\t\t\t  ft/ft_putchar.c \\\n\t\t\t  ft/ft_putstr.c \\\n\t\t\t  ft/ft_strlen.c \\\n\t\t\t  ft/ft_strncpy.c \\\n\t\t\t  ft_dict/ft_dict_cmp.c \\\n\t\t\t  ft_dict/ft_dict_clear.c \\\n\t\t\t  ft_dict/ft_dict_create.c \\\n\t\t\t  ft_dict/ft_dict_create_elem.c \\\n\t\t\t  ft_dict/ft_dict_in.c \\\n\t\t\t  ft_dict/ft_print.c \\\n\t\t\t  ft_list/ft_create_elem.c \\\n\t\t\t  ft_list/ft_list_clear.c \\\n\t\t\t  ft_list/ft_list_find.c \\\n\t\t\t  ft_list/ft_sorted_list_insert.c \\\n\t\t\t  main.c\n\nOBJS\t\t= $(addprefix srcs/, ${SRCS:.c=.o})\n\nNAME\t\t= rush-02\n\nCFLAGS\t\t= -Wall -Wextra -Werror\n\nall:\t\t${NAME}\n\n${NAME}:\t${OBJS}\n\t\t\tgcc ${CFLAGS} $^ -o $@\n\n.c.o:\n\t\t\tgcc ${CFLAGS} -I./includes -c $< -o ${<:.c=.o}\n\nclean:\n\t\t\trm -f ${OBJS}\n\nfclean:\t\tclean\n\t\t\trm -f ${NAME}\n\nre:\t\t\tfclean all\n\n.PHONY:\t\tall clean fclean re\n"
  },
  {
    "path": "rush02/ex00/includes/ft.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft.h                                               :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 21:38:33 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 21:48:57 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_H\n# define FT_H\n\nvoid\tft_check_args(int argc, char **argv, char **path, char **value);\n\nchar\t*ft_file_load(char *path);\n\nint\t\tft_is_valid(char *value);\n\nlong\tft_atol(char *str);\n\nint\t\tft_isdigit(char c);\n\nint\t\tft_isprint(char c);\n\nint\t\tft_isspace(char c);\n\nvoid\tft_putchar(char c);\n\nvoid\tft_putstr(char *str);\n\nint\t\tft_strlen(char *str);\n\nchar\t*ft_strncpy(char *dest, char *src, unsigned int n);\n\n#endif\n"
  },
  {
    "path": "rush02/ex00/includes/ft_dict.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_dict.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 00:10:08 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 10:57:35 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_DICT_H\n# define FT_DICT_H\n\n# include \"ft_list.h\"\n\ntypedef struct\t\ts_data\n{\n\tunsigned long\tvalue;\n\tchar\t\t\t*name;\n}\t\t\t\t\tt_data;\n\nt_list\t\t\t\t*ft_dict_create(char *content);\n\nt_data\t\t\t\t*ft_dict_create_elem(unsigned long value, char *name);\n\nt_data\t\t\t\t*ft_dict_in(t_list *dict, unsigned long value);\n\nint\t\t\t\t\tft_dict_cmp(t_data *d1, t_data *d2);\n\nvoid\t\t\t\tft_dict_clear(t_data *d);\n\nvoid\t\t\t\tft_print(t_list *dict, char *value);\n\n#endif\n"
  },
  {
    "path": "rush02/ex00/includes/ft_list.h",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list.h                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/17 18:47:15 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 03:25:33 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#ifndef FT_LIST_H\n# define FT_LIST_H\n\ntypedef struct\t\ts_list\n{\n\tstruct s_list\t*next;\n\tvoid\t\t\t*data;\n}\t\t\t\t\tt_list;\n\nt_list\t\t\t\t*ft_create_elem(void *data);\n\nvoid\t\t\t\tft_sorted_list_insert(t_list **begin_list, void *data,\n\t\t\t\t\tint (*cmp)());\n\nt_list\t\t\t\t*ft_list_find(t_list *begin_list, void *data_ref,\n\t\t\t\t\tint (*cmp)());\n\nvoid\t\t\t\tft_list_clear(t_list *begin_list, void (*free_fct)());\n\n#endif\n"
  },
  {
    "path": "rush02/ex00/numbers.dict",
    "content": "0: zero\n1: one\n2: two\n3: three\n4: four\n5: five\n6: six\n7: seven\n8: eight\n9: nine\n10: ten\n11: eleven\n12: twelve\n13: thirteen\n14: fourteen\n15: fifteen\n16: sixteen\n17: seventeen\n18: eighteen\n19: nineteen\n20: twenty\n30: thirty\n40: forty\n50: fifty\n60: sixty\n70: seventy\n80: eighty\n90: ninety\n100: hundred\n1000: thousand\n1000000: million\n1000000000: billion\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_atol.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_atol.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 01:49:38 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 01:49:40 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nlong\tft_atol(char *str)\n{\n\tlong\tn;\n\tint\t\tnegative;\n\n\twhile ((*str >= 9 && *str <= 13) || *str == ' ')\n\t\tstr++;\n\tnegative = 0;\n\twhile (*str == '-' || *str == '+')\n\t\tif (*str++ == '-')\n\t\t\tnegative = 1 - negative;\n\tn = 0;\n\twhile (*str >= '0' && *str <= '9')\n\t\tn = n * 10 + *str++ - '0';\n\tif (negative)\n\t\tn *= -1;\n\treturn (n);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_check_args.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_check_args.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: hvernhes <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 23:54:34 by hvernhes          #+#    #+#             */\n/*   Updated: 2019/07/21 00:27:39 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n\nvoid\tft_check_args(int argc, char **argv, char **path, char **value)\n{\n\tif (argc < 2 || argc > 3)\n\t{\n\t\t*path = NULL;\n\t\t*value = NULL;\n\t}\n\tif (argc == 2)\n\t{\n\t\t*path = \"numbers.dict\";\n\t\t*value = argv[1];\n\t}\n\telse\n\t{\n\t\t*path = argv[1];\n\t\t*value = argv[2];\n\t}\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_file_load.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_tail.c                                          :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/15 16:51:18 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 23:15:40 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <fcntl.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include \"ft.h\"\n\nchar\t*ft_file_read(int fd)\n{\n\tchar\tbuf[2048];\n\tchar\t*content;\n\tchar\t*tmp;\n\tint\t\tlen;\n\tint\t\tsize;\n\n\tif (!(content = malloc(sizeof(char))))\n\t\treturn (NULL);\n\t*content = '\\0';\n\tsize = 0;\n\twhile ((len = read(fd, buf, 2048)) > 0)\n\t{\n\t\tif (!(tmp = malloc((size + len + 1) * sizeof(char))))\n\t\t\tbreak ;\n\t\ttmp = ft_strncpy(tmp, content, size);\n\t\tfree(content);\n\t\tft_strncpy(tmp + size, buf, len);\n\t\tcontent = tmp;\n\t\tsize += len;\n\t\tcontent[size] = '\\0';\n\t}\n\tif (len)\n\t\tfree(content);\n\treturn ((len) ? NULL : content);\n}\n\nchar\t*ft_file_load(char *path)\n{\n\tchar\t\t\t*content;\n\tint\t\t\t\tfd;\n\n\tfd = (path) ? open(path, O_RDONLY) : STDIN_FILENO;\n\tif (fd < 0)\n\t\treturn (NULL);\n\tcontent = ft_file_read(fd);\n\tif (fd != STDIN_FILENO)\n\t\tclose(fd);\n\treturn (content);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_is_valid.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_is_valid.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: hvernhes <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 23:25:33 by hvernhes          #+#    #+#             */\n/*   Updated: 2019/07/21 20:28:49 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_is_valid(char *value)\n{\n\tint n;\n\tint i;\n\n\tif (!*value)\n\t\treturn (0);\n\tn = 0;\n\ti = -1;\n\twhile (value[++i])\n\t{\n\t\tif (value[i] < '0' || value[i] > '9')\n\t\t\treturn (0);\n\t\telse if (n || value[i] != '0')\n\t\t\tn++;\n\t}\n\treturn (n <= 12);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_isdigit.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_isdigit.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: hvernhes <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 01:05:56 by hvernhes          #+#    #+#             */\n/*   Updated: 2019/07/21 01:12:45 by hvernhes         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_isdigit(char c)\n{\n\treturn (c >= '0' && c <= '9');\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_isprint.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_isprint.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 01:30:49 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 01:31:37 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_isprint(char c)\n{\n\treturn (c >= ' ' && c <= '~');\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_isspace.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_isspace.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: hvernhes <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 01:09:33 by hvernhes          #+#    #+#             */\n/*   Updated: 2019/07/21 01:13:59 by hvernhes         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\t\tft_isspace(char c)\n{\n\treturn (c == '\\t' || c == '\\n' || c == '\\v' || c == '\\f'\n\t\t\t|| c == '\\r' || c == ' ');\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_putchar.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putchar.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/01 17:19:29 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/02 17:28:36 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n\nvoid\tft_putchar(char c)\n{\n\twrite(1, &c, 1);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_putstr.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_putstr.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:00:11 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 22:41:07 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <unistd.h>\n#include \"ft.h\"\n\nvoid\tft_putstr(char *str)\n{\n\twrite(1, str, ft_strlen(str));\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_strlen.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strlen.c                                        :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/03 03:11:19 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/03 15:18:43 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nint\tft_strlen(char *str)\n{\n\tint n;\n\n\tn = 0;\n\twhile (str[n])\n\t\tn++;\n\treturn (n);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft/ft_strncpy.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_strncpy.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/16 22:19:59 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/16 22:20:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\nchar\t*ft_strncpy(char *dest, char *src, unsigned int n)\n{\n\tunsigned int i;\n\n\ti = -1;\n\twhile (++i < n && src[i])\n\t\tdest[i] = src[i];\n\twhile (i < n)\n\t\tdest[i++] = '\\0';\n\treturn (dest);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_dict/ft_dict_clear.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_dict_clear.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: hvernhes <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 02:24:34 by hvernhes          #+#    #+#             */\n/*   Updated: 2019/07/21 02:53:57 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_dict.h\"\n\nvoid\tft_dict_clear(t_data *d)\n{\n\tfree(d->name);\n\tfree(d);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_dict/ft_dict_cmp.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_dict_cmp.c                                      :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 23:56:59 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 00:19:14 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_dict.h\"\n\nint\t\tft_dict_cmp(t_data *d1, t_data *d2)\n{\n\treturn (d1->value - d2->value);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_dict/ft_dict_create.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_dict_create.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 00:48:04 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 23:26:38 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft.h\"\n#include \"ft_dict.h\"\n\nt_list\t*ft_dicterr(t_list *l)\n{\n\tft_list_clear(l, &ft_dict_clear);\n\tft_putstr(\"Dict Error\\n\");\n\treturn (NULL);\n}\n\nint\t\tft_is_valid_line(char *s, unsigned long *value, char **name)\n{\n\tlong\tn;\n\tint\t\ti;\n\n\ti = 0;\n\twhile (ft_isdigit(s[i]))\n\t\ti++;\n\tif (!i || i > 18 || (n = ft_atol(s)) < 0)\n\t\treturn (0);\n\t*value = n;\n\ts += i;\n\twhile (ft_isspace(*s))\n\t\ts++;\n\tif (*s++ != ':')\n\t\treturn (0);\n\twhile (ft_isspace(*s))\n\t\ts++;\n\t*name = s;\n\ti = 0;\n\twhile (s[i] && s[i] != '\\n')\n\t\tif (!ft_isprint(s[i]))\n\t\t\treturn (0);\n\t\telse if (ft_isspace(s[i++]))\n\t\t\twhile (ft_isspace(s[i]))\n\t\t\t\ts++;\n\treturn (i && s[i] == '\\n');\n}\n\nt_list\t*ft_dict_check(t_list *dict)\n{\n\tunsigned int i;\n\n\ti = -1;\n\twhile (++i < 10)\n\t\tif (!ft_dict_in(dict, i) || !ft_dict_in(dict, 10 + i)\n\t\t\t|| !ft_dict_in(dict, 10 * i))\n\t\t\treturn (ft_dicterr(dict));\n\tif (!ft_dict_in(dict, 100) || !ft_dict_in(dict, 1000)\n\t\t|| !ft_dict_in(dict, 1000000) || !ft_dict_in(dict, 1000000))\n\t\treturn (ft_dicterr(dict));\n\treturn (dict);\n}\n\nt_list\t*ft_dict_create(char *content)\n{\n\tt_list *l;\n\tt_data *e;\n\tt_data t;\n\n\tl = NULL;\n\twhile (*content)\n\t{\n\t\tif (*content == '\\n')\n\t\t\tcontent++;\n\t\telse if (ft_is_valid_line(content, &t.value, &t.name)\n\t\t\t&& !ft_list_find(l, &t, ft_dict_cmp)\n\t\t\t&& (e = ft_dict_create_elem(t.value, t.name)))\n\t\t{\n\t\t\tft_sorted_list_insert(&l, e, &ft_dict_cmp);\n\t\t\twhile (*content != '\\n')\n\t\t\t\tcontent++;\n\t\t}\n\t\telse\n\t\t\treturn (ft_dicterr(l));\n\t}\n\treturn (ft_dict_check(l));\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_dict/ft_dict_create_elem.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_dict_create_elem.c                              :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 00:56:44 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 22:40:02 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft.h\"\n#include \"ft_dict.h\"\n\nint\t\tft_dict_wordlen(char *s)\n{\n\tint i;\n\n\ti = 0;\n\twhile (s[i] != '\\n')\n\t\tif (ft_isspace(s[i++]))\n\t\t\twhile (ft_isspace(s[i]))\n\t\t\t\ts++;\n\treturn (i);\n}\n\nt_data\t*ft_dict_create_elem(unsigned long value, char *name)\n{\n\tt_data\t*d;\n\tint\t\ti;\n\n\ti = ft_dict_wordlen(name);\n\tif (!i || !(d = malloc(sizeof(t_data))))\n\t\treturn (NULL);\n\td->value = value;\n\tif (!(d->name = malloc((i + 1) * sizeof(char))))\n\t{\n\t\tfree(d);\n\t\treturn (NULL);\n\t}\n\ti = 0;\n\twhile (*name != '\\n')\n\t{\n\t\td->name[i++] = (ft_isspace(*name)) ? ' ' : *name++;\n\t\twhile (ft_isspace(*name) && *name != '\\n')\n\t\t\tname++;\n\t}\n\td->name[i] = '\\0';\n\treturn (d);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_dict/ft_dict_in.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_dict_in.c                                       :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 10:34:11 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 10:58:04 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_dict.h\"\n\nt_data\t*ft_dict_in(t_list *dict, unsigned long value)\n{\n\tt_list *l;\n\tt_data d;\n\n\td.value = value;\n\treturn ((l = ft_list_find(dict, &d, &ft_dict_cmp)) ? l->data : NULL);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_dict/ft_print.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_print.c                                         :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: hvernhes <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/21 00:53:28 by hvernhes          #+#    #+#             */\n/*   Updated: 2019/07/21 23:08:01 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft.h\"\n#include \"ft_dict.h\"\n\nvoid\tft_putvalue(t_list *dict, unsigned long n, int count)\n{\n\tif (count)\n\t\tft_putchar(' ');\n\tft_putstr(ft_dict_in(dict, n)->name);\n}\n\nint\t\tft_special(t_list *dict, unsigned long n, int count)\n{\n\tunsigned long i;\n\n\ti = 1000000000000;\n\twhile ((i /= 1000) >= 1000)\n\t\tif (i == n)\n\t\t\treturn (0);\n\tif (n == 100 || !ft_dict_in(dict, n))\n\t\treturn (0);\n\tft_putvalue(dict, n, count);\n\treturn (1);\n}\n\nint\t\tft_print_digits(t_list *dict, unsigned long n, int count)\n{\n\tif ((n %= 1000) >= 100)\n\t{\n\t\tft_putvalue(dict, n / 100, count++);\n\t\tft_putvalue(dict, 100, count);\n\t\tif (n == 100)\n\t\t\treturn (count);\n\t}\n\tif (ft_dict_in(dict, (n %= 100)))\n\t\tft_putvalue(dict, n, count++);\n\telse\n\t{\n\t\tif (n >= 10)\n\t\t\tft_putvalue(dict, (n / 10) * 10, count++);\n\t\tif ((n %= 10))\n\t\t\tft_putvalue(dict, n, count++);\n\t}\n\treturn (count);\n}\n\nvoid\tft_print(t_list *dict, char *value)\n{\n\tunsigned long\tn;\n\tunsigned long\tmask;\n\tint\t\t\t\tcount;\n\n\twhile (*value == '0' && *(value + 1))\n\t\tvalue++;\n\tmask = 1000000000;\n\tcount = 0;\n\twhile (*value)\n\t{\n\t\tif (ft_special(dict, (n = ft_atol(value)), count))\n\t\t\tbreak ;\n\t\twhile (mask > n + 1)\n\t\t\tmask /= 1000;\n\t\tcount = ft_print_digits(dict, n / mask, count);\n\t\tif (mask > 1)\n\t\t\tft_putvalue(dict, mask, count++);\n\t\tn = ft_strlen(value);\n\t\tvalue++;\n\t\twhile (ft_strlen(value) % 3)\n\t\t\tvalue++;\n\t\twhile (*value == '0')\n\t\t\tvalue++;\n\t}\n\tft_putchar('\\n');\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_list/ft_create_elem.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_create_elem.c                                   :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 01:38:16 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/18 02:17:18 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nt_list\t*ft_create_elem(void *data)\n{\n\tt_list *l;\n\n\tif (!(l = malloc(sizeof(t_list))))\n\t\treturn (NULL);\n\tl->next = NULL;\n\tl->data = data;\n\treturn (l);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_list/ft_list_clear.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_clear.c                                    :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/18 18:15:02 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 02:58:36 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft_list.h\"\n\nvoid\tft_list_clear(t_list *begin_list, void (*free_fct)())\n{\n\tif (!begin_list)\n\t\treturn ;\n\tft_list_clear(begin_list->next, free_fct);\n\tif (free_fct)\n\t\tfree_fct(begin_list->data);\n\tfree(begin_list);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_list/ft_list_find.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_list_find.c                                     :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/19 02:44:24 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/19 03:03:00 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nt_list\t*ft_list_find(t_list *begin_list, void *data_ref, int (*cmp)())\n{\n\tif (!begin_list || !cmp(begin_list->data, data_ref))\n\t\treturn (begin_list);\n\treturn (ft_list_find(begin_list->next, data_ref, cmp));\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/ft_list/ft_sorted_list_insert.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   ft_sorted_list_insert.c                            :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/20 03:43:01 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/20 04:26:57 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include \"ft_list.h\"\n\nvoid\tft_sorted_list_insert(t_list **begin_list, void *data, int (*cmp)())\n{\n\tt_list *e;\n\n\tif (!*begin_list || cmp(data, (*begin_list)->data) <= 0)\n\t{\n\t\tif (!(e = ft_create_elem(data)))\n\t\t\treturn ;\n\t\te->next = *begin_list;\n\t\t*begin_list = e;\n\t}\n\telse\n\t\tft_sorted_list_insert(&(*begin_list)->next, data, cmp);\n}\n"
  },
  {
    "path": "rush02/ex00/srcs/main.c",
    "content": "/* ************************************************************************** */\n/*                                                                            */\n/*                                                        :::      ::::::::   */\n/*   main.c                                             :+:      :+:    :+:   */\n/*                                                    +:+ +:+         +:+     */\n/*   By: asoursou <marvin@42.fr>                    +#+  +:+       +#+        */\n/*                                                +#+#+#+#+#+   +#+           */\n/*   Created: 2019/07/12 15:32:28 by asoursou          #+#    #+#             */\n/*   Updated: 2019/07/21 23:16:48 by asoursou         ###   ########.fr       */\n/*                                                                            */\n/* ************************************************************************** */\n\n#include <stdlib.h>\n#include \"ft.h\"\n#include \"ft_dict.h\"\n\nint\t\tmain(int argc, char **argv)\n{\n\tt_list\t*dict;\n\tchar\t*path;\n\tchar\t*value;\n\tchar\t*content;\n\n\tft_check_args(argc, argv, &path, &value);\n\tif (!ft_is_valid(value))\n\t\tft_putstr(\"Error\\n\");\n\telse if ((content = ft_file_load(path)))\n\t{\n\t\tdict = ft_dict_create(content);\n\t\tfree(content);\n\t\tif (dict)\n\t\t{\n\t\t\tft_print(dict, value);\n\t\t\tft_list_clear(dict, &ft_dict_clear);\n\t\t}\n\t}\n\telse\n\t\tft_putstr(\"Dict Error\\n\");\n\treturn (0);\n}\n"
  },
  {
    "path": "rush02/ex00/test.sh",
    "content": "#!/bin/bash\n\nif [ \"$#\" != \"1\" ]; then\n\techo \"error: Invalid argument\"\n\texit\nfi\n\nn=$1 \nwhile [ \"$n\" -ge \"0\" ]; do\n\t./rush-02 $n\n\tn=`expr \"$n\" - 1`;\ndone\n"
  },
  {
    "path": "shell00/ex00/z",
    "content": "Z\n"
  },
  {
    "path": "shell00/ex03/klist.txt",
    "content": "Credentials cache: API:597EA158-C46F-4F28-9226-87F55BEEEF86\n        Principal: asoursou@42.FR\n\n  Issued                Expires               Principal\nJul  1 08:56:05 2019  Jul  8 08:56:05 2019  krbtgt/42.FR@42.FR\nJul  1 09:46:20 2019  Jul  8 08:56:05 2019  host/vgs-fn1.42.fr@42.FR\n"
  },
  {
    "path": "shell00/ex04/midLS",
    "content": "#!/bin/sh\nls -mUtp\n"
  },
  {
    "path": "shell00/ex05/git_commit.sh",
    "content": "#!/bin/sh\ngit log -5 --pretty=%H\n"
  },
  {
    "path": "shell00/ex06/git_ignore.sh",
    "content": "#!/bin/sh\ngit status -s --ignored | grep '!!' | sed 's/!! //'\n"
  },
  {
    "path": "shell00/ex07/b",
    "content": "Episode V, A NEW H0PE It is a period of civil war\nRebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire. \nDuring the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the STAR DEATH, an armored space station with enough power to destroy an entire planet.\n\n\nPursued by the Empire's sinister agents,\nPrincess Mehdi races home aboard her starship, custodian of the stolen plans that can save her people and restore the dictatorship to the galaxie..\n\n\n\n\n"
  },
  {
    "path": "shell00/ex08/clean",
    "content": "#!/bin/sh\nfind . -type f \\( -name '*~' -o -name '#*#' \\) -print -delete\n"
  },
  {
    "path": "shell00/ex09/ft_magic",
    "content": "42\tstring\t42\t42 file"
  },
  {
    "path": "shell01/ex01/print_groups.sh",
    "content": "#!/bin/sh\ngroups $FT_USER | tr ' ' ',' | tr -d '\\n'\n"
  },
  {
    "path": "shell01/ex02/find_sh.sh",
    "content": "#!/bin/sh\nfind . -type f -name '*.sh' | sed 's/.*\\///' | sed 's/...$//'"
  },
  {
    "path": "shell01/ex03/count_files.sh",
    "content": "#!/bin/sh\nfind . -type f -o -type d | wc -l | tr -d ' '"
  },
  {
    "path": "shell01/ex04/MAC.sh",
    "content": "#!/bin/sh\nifconfig -a | grep ether | cut -c 8-24"
  },
  {
    "path": "shell01/ex05/\"/?$*'MaRViN'*$?/\"",
    "content": "42"
  },
  {
    "path": "shell01/ex06/skip.sh",
    "content": "#!/bin/bash\nls -l | awk 'NR%2'"
  },
  {
    "path": "shell01/ex07/r_dwssap.sh",
    "content": "#!/bin/sh\ncat /etc/passwd | grep -v '#' | awk 'NR%2==0' | cut -d : -f 1 | rev | sort -r | awk \"NR>=$FT_LINE1 && NR<=$FT_LINE2\" | tr '\\n' ' ' | sed '$ s/ $/./' | sed 's/ /, /g' | tr -d '\\n'"
  },
  {
    "path": "shell01/ex08/add_chelou.sh",
    "content": "#!/bin/sh\nn1=`echo $FT_NBR1 | sed 'y/'\\''\\\\\"?!/01234/'`\nn2=`echo $FT_NBR2 | sed 'y/mrdoc/01234/'`\nb5=`echo \"ibase=5;$n1+$n2\" | bc`\necho \"obase=13;$b5\" | bc | sed 'y/0123456789ABC/gtaio luSnemf/'\n"
  }
]