├── 01_original ├── ft_putchar_fd.c ├── ft_bzero.c ├── ft_isascii.c ├── ft_isdigit.c ├── ft_isprint.c ├── ft_tolower.c ├── ft_toupper.c ├── ft_lstlast.c ├── ft_isalpha.c ├── ft_putendl_fd.c ├── ft_strlen.c ├── ft_lstdelone.c ├── ft_isalnum.c ├── ft_putstr_fd.c ├── ft_memset.c ├── ft_calloc.c ├── ft_lstnew.c ├── ft_lstadd_front.c ├── ft_strchr.c ├── ft_lstsize.c ├── ft_strrchr.c ├── ft_lstclear.c ├── ft_lstiter.c ├── ft_lstadd_back.c ├── ft_memchr.c ├── ft_memcpy.c ├── ft_strdup.c ├── ft_memcmp.c ├── ft_strtrim.c ├── ft_memccpy.c ├── ft_strlcpy.c ├── ft_strmapi.c ├── ft_strncmp.c ├── ft_strnstr.c ├── ft_substr.c ├── ft_putnbr_fd.c ├── ft_memmove.c ├── ft_strjoin.c ├── ft_atoi.c ├── ft_strlcat.c ├── ft_lstmap.c ├── ft_split.c ├── ft_itoa.c ├── Makefile └── libft.h ├── 02_myown ├── ft_bzero.c ├── ft_putchar_fd.c ├── ft_isascii.c ├── ft_isdigit.c ├── ft_isprint.c ├── ft_tolower.c ├── ft_toupper.c ├── ft_isspace.c ├── ft_lstlast.c ├── ft_isalpha.c ├── ft_putendl_fd.c ├── ft_strlen.c ├── ft_lstdelone.c ├── ft_isalnum.c ├── ft_putstr_fd.c ├── ft_memset.c ├── ft_calloc.c ├── ft_isspace_str.c ├── ft_lstadd_front.c ├── ft_lstnew.c ├── ft_strchr.c ├── ft_strrchr.c ├── ft_lstsize.c ├── ft_lstiter.c ├── ft_lstclear.c ├── ft_memchr.c ├── ft_lstadd_back.c ├── ft_memcpy.c ├── ft_strdup.c ├── ft_memcmp.c ├── ft_strtrim.c ├── ft_memccpy.c ├── ft_strlcpy.c ├── ft_strmapi.c ├── ft_strnstr.c ├── ft_strncmp.c ├── ft_substr.c ├── ft_chrdel.c ├── ft_putnbr_fd.c ├── ft_memmove.c ├── ft_strjoin.c ├── ft_strstr.c ├── ft_atoi.c ├── ft_strlcat.c ├── ft_lstmap.c ├── ft_split.c ├── ft_itoa.c ├── get_next_line.c ├── Makefile └── libft.h └── README.md /01_original/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:13:46 by jwon #+# #+# */ 9 | /* Updated: 2020/04/14 18:46:41 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putchar_fd(char c, int fd) 16 | { 17 | write(fd, &c, 1); 18 | } 19 | -------------------------------------------------------------------------------- /02_myown/ft_bzero.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bzero.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:28:27 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:29:09 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_bzero(void *str, size_t n) 16 | { 17 | ft_memset(str, '\0', n); 18 | } 19 | -------------------------------------------------------------------------------- /02_myown/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:13:46 by jwon #+# #+# */ 9 | /* Updated: 2020/04/14 18:46:41 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putchar_fd(char c, int fd) 16 | { 17 | write(fd, &c, 1); 18 | } 19 | -------------------------------------------------------------------------------- /01_original/ft_bzero.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bzero.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:28:27 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:29:09 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_bzero(void *str, size_t n) 16 | { 17 | ft_memset(str, '\0', n); 18 | } 19 | -------------------------------------------------------------------------------- /02_myown/ft_isascii.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isascii.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:38:58 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:50 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isascii(int c) 16 | { 17 | if (c >= 0 && c <= 127) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /01_original/ft_isascii.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isascii.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:38:58 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:50 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isascii(int c) 16 | { 17 | if (c >= 0 && c <= 127) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /01_original/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isdigit.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:39:52 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:47 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isdigit(int c) 16 | { 17 | if (c >= '0' && c <= '9') 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /01_original/ft_isprint.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isprint.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:41:04 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:44 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isprint(int c) 16 | { 17 | if (c >= 32 && c <= 126) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isdigit.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:39:52 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:47 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isdigit(int c) 16 | { 17 | if (c >= '0' && c <= '9') 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_isprint.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isprint.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:41:04 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:44 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isprint(int c) 16 | { 17 | if (c >= 32 && c <= 126) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_tolower.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_tolower.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:59:25 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:10 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_tolower(int c) 16 | { 17 | if (c >= 65 && c <= 90) 18 | return (c + 32); 19 | return (c); 20 | } 21 | -------------------------------------------------------------------------------- /01_original/ft_tolower.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_tolower.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:59:25 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:10 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_tolower(int c) 16 | { 17 | if (c >= 65 && c <= 90) 18 | return (c + 32); 19 | return (c); 20 | } 21 | -------------------------------------------------------------------------------- /01_original/ft_toupper.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_toupper.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 16:00:00 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:05 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_toupper(int c) 16 | { 17 | if (c >= 97 && c <= 122) 18 | return (c - 32); 19 | return (c); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_toupper.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_toupper.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 16:00:00 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:05 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_toupper(int c) 16 | { 17 | if (c >= 97 && c <= 122) 18 | return (c - 32); 19 | return (c); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_isspace.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isspace.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/06/21 14:37:41 by jwon #+# #+# */ 9 | /* Updated: 2020/06/21 22:18:56 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isspace(int c) 16 | { 17 | if (c == ' ' || (c >= 9 && c <= 13)) 18 | return (1); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_lstlast.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstlast.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:55:05 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:55:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstlast(t_list *lst) 16 | { 17 | while (lst != NULL && lst->next != NULL) 18 | lst = lst->next; 19 | return (lst); 20 | } 21 | -------------------------------------------------------------------------------- /01_original/ft_lstlast.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstlast.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:55:05 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:55:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstlast(t_list *lst) 16 | { 17 | while (lst != NULL && lst->next != NULL) 18 | lst = lst->next; 19 | return (lst); 20 | } 21 | -------------------------------------------------------------------------------- /02_myown/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalpha.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:37:41 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:56 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalpha(int c) 16 | { 17 | if ((c >= 'a' && c <= 'z') || 18 | (c >= 'A' && c <= 'Z')) 19 | return (1); 20 | return (0); 21 | } 22 | -------------------------------------------------------------------------------- /02_myown/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:14:30 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:14:55 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putendl_fd(char *s, int fd) 16 | { 17 | if (s) 18 | { 19 | ft_putstr_fd(s, fd); 20 | ft_putchar_fd('\n', fd); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /02_myown/ft_strlen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:53:19 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 17:22:41 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlen(const char *str) 16 | { 17 | int idx; 18 | 19 | idx = 0; 20 | while (str[idx]) 21 | idx++; 22 | return (idx); 23 | } 24 | -------------------------------------------------------------------------------- /01_original/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalpha.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:37:41 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:56 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalpha(int c) 16 | { 17 | if ((c >= 'a' && c <= 'z') || 18 | (c >= 'A' && c <= 'Z')) 19 | return (1); 20 | return (0); 21 | } 22 | -------------------------------------------------------------------------------- /01_original/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:14:30 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:14:55 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putendl_fd(char *s, int fd) 16 | { 17 | if (s) 18 | { 19 | ft_putstr_fd(s, fd); 20 | ft_putchar_fd('\n', fd); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /01_original/ft_strlen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:53:19 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 17:22:41 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlen(const char *str) 16 | { 17 | int idx; 18 | 19 | idx = 0; 20 | while (str[idx]) 21 | idx++; 22 | return (idx); 23 | } 24 | -------------------------------------------------------------------------------- /02_myown/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstdelone.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:53:17 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:24 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstdelone(t_list *lst, void (*del)(void *)) 16 | { 17 | if (!lst) 18 | return ; 19 | if (del) 20 | del(lst->content); 21 | free(lst); 22 | } 23 | -------------------------------------------------------------------------------- /01_original/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstdelone.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:53:17 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:24 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstdelone(t_list *lst, void (*del)(void *)) 16 | { 17 | if (!lst) 18 | return ; 19 | if (del) 20 | del(lst->content); 21 | free(lst); 22 | } 23 | -------------------------------------------------------------------------------- /01_original/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalnum.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:32:05 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:19:01 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalnum(int c) 16 | { 17 | if ((c >= 'a' && c <= 'z') || 18 | (c >= 'A' && c <= 'Z') || 19 | (c >= '0' && c <= '9')) 20 | return (1); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /02_myown/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalnum.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:32:05 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:19:01 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalnum(int c) 16 | { 17 | if ((c >= 'a' && c <= 'z') || 18 | (c >= 'A' && c <= 'Z') || 19 | (c >= '0' && c <= '9')) 20 | return (1); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /02_myown/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:18:07 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 20:22:36 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putstr_fd(char *s, int fd) 16 | { 17 | int idx; 18 | 19 | if (!s) 20 | return ; 21 | idx = 0; 22 | while (s[idx]) 23 | { 24 | ft_putchar_fd(s[idx], fd); 25 | idx++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:18:07 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 20:22:36 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putstr_fd(char *s, int fd) 16 | { 17 | int idx; 18 | 19 | if (!s) 20 | return ; 21 | idx = 0; 22 | while (s[idx]) 23 | { 24 | ft_putchar_fd(s[idx], fd); 25 | idx++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_memset.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memset.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:12:19 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:13:25 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memset(void *str, int c, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | *((unsigned char *)str + idx) = c; 23 | idx++; 24 | } 25 | return (str); 26 | } 27 | -------------------------------------------------------------------------------- /02_myown/ft_memset.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memset.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:12:19 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:13:25 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memset(void *str, int c, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | *((unsigned char *)str + idx) = c; 23 | idx++; 24 | } 25 | return (str); 26 | } 27 | -------------------------------------------------------------------------------- /02_myown/ft_calloc.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_calloc.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:29:46 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:14:37 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_calloc(size_t nmemb, size_t size) 16 | { 17 | void *buffer; 18 | 19 | if (!(buffer = (void *)malloc(size * nmemb))) 20 | return (NULL); 21 | ft_bzero(buffer, size * nmemb); 22 | return (buffer); 23 | } 24 | -------------------------------------------------------------------------------- /01_original/ft_calloc.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_calloc.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:29:46 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:14:37 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_calloc(size_t nmemb, size_t size) 16 | { 17 | void *buffer; 18 | 19 | if (!(buffer = (void *)malloc(size * nmemb))) 20 | return (NULL); 21 | ft_bzero(buffer, size * nmemb); 22 | return (buffer); 23 | } 24 | -------------------------------------------------------------------------------- /01_original/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstnew.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:55:53 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:15 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstnew(void *content) 16 | { 17 | t_list *new; 18 | 19 | if (!(new = (t_list *)malloc(sizeof(t_list)))) 20 | return (NULL); 21 | new->content = content; 22 | new->next = NULL; 23 | return (new); 24 | } 25 | -------------------------------------------------------------------------------- /02_myown/ft_isspace_str.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isspace_str.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/06/29 14:37:41 by jwon #+# #+# */ 9 | /* Updated: 2020/09/14 17:50:53 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isspace_str(char *str) 16 | { 17 | int idx; 18 | 19 | idx = 0; 20 | while (str[idx]) 21 | { 22 | if (ft_isspace(str[idx])) 23 | idx++; 24 | else 25 | return (0); 26 | } 27 | return (1); 28 | } 29 | -------------------------------------------------------------------------------- /02_myown/ft_lstadd_front.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd_front.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:47:48 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:51:21 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstadd_front(t_list **lst, t_list *new) 16 | { 17 | if (*lst == NULL) 18 | { 19 | new->next = NULL; 20 | *lst = new; 21 | } 22 | else 23 | { 24 | new->next = *lst; 25 | *lst = new; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /02_myown/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstnew.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:55:53 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:15 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstnew(void *content) 16 | { 17 | t_list *new; 18 | 19 | if (!(new = (t_list *)malloc(sizeof(t_list)))) 20 | return (NULL); 21 | new->content = content; 22 | new->next = NULL; 23 | return (new); 24 | } 25 | -------------------------------------------------------------------------------- /02_myown/ft_strchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:24:48 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:47 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strchr(const char *str, int c) 16 | { 17 | while (*str) 18 | { 19 | if (*str == c) 20 | return ((char *)str); 21 | str++; 22 | } 23 | if (c == '\0') 24 | return ((char *)str); 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /01_original/ft_lstadd_front.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd_front.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:47:48 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:51:21 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstadd_front(t_list **lst, t_list *new) 16 | { 17 | if (*lst == NULL) 18 | { 19 | new->next = NULL; 20 | *lst = new; 21 | } 22 | else 23 | { 24 | new->next = *lst; 25 | *lst = new; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_strchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:24:48 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:47 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strchr(const char *str, int c) 16 | { 17 | while (*str) 18 | { 19 | if (*str == c) 20 | return ((char *)str); 21 | str++; 22 | } 23 | if (c == '\0') 24 | return ((char *)str); 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /02_myown/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strrchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:56:21 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:57:02 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrchr(const char *str, int c) 16 | { 17 | int idx; 18 | 19 | idx = ft_strlen((char *)str) + 1; 20 | while (idx--) 21 | { 22 | if (*(str + idx) == c) 23 | return ((char *)(str + idx)); 24 | } 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /01_original/ft_lstsize.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstsize.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:01:40 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:02:43 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_lstsize(t_list *lst) 16 | { 17 | int idx; 18 | t_list *position; 19 | 20 | idx = 0; 21 | position = lst; 22 | while (position != NULL) 23 | { 24 | position = position->next; 25 | idx++; 26 | } 27 | return (idx); 28 | } 29 | -------------------------------------------------------------------------------- /01_original/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strrchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:56:21 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:57:02 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrchr(const char *str, int c) 16 | { 17 | int idx; 18 | 19 | idx = ft_strlen((char *)str) + 1; 20 | while (idx--) 21 | { 22 | if (*(str + idx) == c) 23 | return ((char *)(str + idx)); 24 | } 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /02_myown/ft_lstsize.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstsize.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:01:40 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:02:43 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_lstsize(t_list *lst) 16 | { 17 | int idx; 18 | t_list *position; 19 | 20 | idx = 0; 21 | position = lst; 22 | while (position != NULL) 23 | { 24 | position = position->next; 25 | idx++; 26 | } 27 | return (idx); 28 | } 29 | -------------------------------------------------------------------------------- /02_myown/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstiter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:54:03 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:54:43 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstiter(t_list *lst, void (*f)(void *)) 16 | { 17 | t_list *position; 18 | 19 | if (!lst) 20 | return ; 21 | position = lst; 22 | while (position != NULL) 23 | { 24 | (*f)(position->content); 25 | position = position->next; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_lstclear.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstclear.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:51:37 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:52:06 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstclear(t_list **lst, void (*del)(void *)) 16 | { 17 | t_list *position; 18 | 19 | if (!lst) 20 | return ; 21 | while (*lst != NULL) 22 | { 23 | position = (*lst)->next; 24 | ft_lstdelone(*lst, del); 25 | *lst = position; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstiter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:54:03 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:54:43 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstiter(t_list *lst, void (*f)(void *)) 16 | { 17 | t_list *position; 18 | 19 | if (!lst) 20 | return ; 21 | position = lst; 22 | while (position != NULL) 23 | { 24 | (*f)(position->content); 25 | position = position->next; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /02_myown/ft_lstclear.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstclear.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:51:37 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:52:06 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstclear(t_list **lst, void (*del)(void *)) 16 | { 17 | t_list *position; 18 | 19 | if (!lst) 20 | return ; 21 | while (*lst != NULL) 22 | { 23 | position = (*lst)->next; 24 | ft_lstdelone(*lst, del); 25 | *lst = position; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /02_myown/ft_memchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:04:53 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:05:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memchr(const void *s, int c, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | if (*((unsigned char *)s + idx) == (unsigned char)c) 23 | return ((void *)s + idx); 24 | idx++; 25 | } 26 | return (NULL); 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_lstadd_back.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd_back.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:46:36 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:47:33 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstadd_back(t_list **lst, t_list *new) 16 | { 17 | t_list *position; 18 | 19 | if (!lst || !new) 20 | return ; 21 | if (*lst == NULL) 22 | *lst = new; 23 | else 24 | { 25 | position = ft_lstlast(*lst); 26 | position->next = new; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /01_original/ft_memchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:04:53 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:05:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memchr(const void *s, int c, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | if (*((unsigned char *)s + idx) == (unsigned char)c) 23 | return ((void *)s + idx); 24 | idx++; 25 | } 26 | return (NULL); 27 | } 28 | -------------------------------------------------------------------------------- /02_myown/ft_lstadd_back.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstadd_back.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:46:36 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 14:47:33 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_lstadd_back(t_list **lst, t_list *new) 16 | { 17 | t_list *position; 18 | 19 | if (!lst || !new) 20 | return ; 21 | if (*lst == NULL) 22 | *lst = new; 23 | else 24 | { 25 | position = ft_lstlast(*lst); 26 | position->next = new; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /01_original/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:09:14 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 16:47:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memcpy(void *dest, const void *src, size_t n) 16 | { 17 | size_t idx; 18 | 19 | if (dest == src || !n) 20 | return (dest); 21 | idx = 0; 22 | while (idx < n) 23 | { 24 | *((char *)dest + idx) = *((char *)src + idx); 25 | idx++; 26 | } 27 | return (dest); 28 | } 29 | -------------------------------------------------------------------------------- /02_myown/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:09:14 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 16:47:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memcpy(void *dest, const void *src, size_t n) 16 | { 17 | size_t idx; 18 | 19 | if (dest == src || !n) 20 | return (dest); 21 | idx = 0; 22 | while (idx < n) 23 | { 24 | *((char *)dest + idx) = *((char *)src + idx); 25 | idx++; 26 | } 27 | return (dest); 28 | } 29 | -------------------------------------------------------------------------------- /02_myown/ft_strdup.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdup.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:28:26 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:41 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strdup(const char *str) 16 | { 17 | int idx; 18 | char *dest; 19 | 20 | if (!(dest = (char *)malloc(sizeof(char) * (ft_strlen(str) + 1)))) 21 | return (NULL); 22 | idx = 0; 23 | while (str[idx]) 24 | { 25 | dest[idx] = str[idx]; 26 | idx++; 27 | } 28 | dest[idx] = '\0'; 29 | return (dest); 30 | } 31 | -------------------------------------------------------------------------------- /01_original/ft_strdup.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdup.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:28:26 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:41 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strdup(const char *str) 16 | { 17 | int idx; 18 | char *dest; 19 | 20 | if (!(dest = (char *)malloc(sizeof(char) * (ft_strlen(str) + 1)))) 21 | return (NULL); 22 | idx = 0; 23 | while (str[idx]) 24 | { 25 | dest[idx] = str[idx]; 26 | idx++; 27 | } 28 | dest[idx] = '\0'; 29 | return (dest); 30 | } 31 | -------------------------------------------------------------------------------- /01_original/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:06:03 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 20:40:20 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_memcmp(const void *s1, const void *s2, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | if (*((unsigned char *)s1 + idx) == 23 | *((unsigned char *)s2 + idx)) 24 | idx++; 25 | else 26 | return ((*((unsigned char *)s1 + idx)) - 27 | *((unsigned char *)s2 + idx)); 28 | } 29 | return (0); 30 | } 31 | -------------------------------------------------------------------------------- /02_myown/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:06:03 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 20:40:20 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_memcmp(const void *s1, const void *s2, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | if (*((unsigned char *)s1 + idx) == 23 | *((unsigned char *)s2 + idx)) 24 | idx++; 25 | else 26 | return ((*((unsigned char *)s1 + idx)) - 27 | *((unsigned char *)s2 + idx)); 28 | } 29 | return (0); 30 | } 31 | -------------------------------------------------------------------------------- /02_myown/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strtrim.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:57:15 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:19 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strtrim(char const *s1, char const *set) 16 | { 17 | size_t size_s1; 18 | 19 | if (!s1 || !set) 20 | return (NULL); 21 | while (ft_strchr(set, *s1) && *s1 != '\0') 22 | s1++; 23 | size_s1 = ft_strlen((char *)s1); 24 | while (ft_strchr(set, s1[size_s1]) && size_s1 != 0) 25 | size_s1--; 26 | return (ft_substr((char *)s1, 0, size_s1 + 1)); 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strtrim.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:57:15 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:19 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strtrim(char const *s1, char const *set) 16 | { 17 | size_t size_s1; 18 | 19 | if (!s1 || !set) 20 | return (NULL); 21 | while (ft_strchr(set, *s1) && *s1 != '\0') 22 | s1++; 23 | size_s1 = ft_strlen((char *)s1); 24 | while (ft_strchr(set, s1[size_s1]) && size_s1 != 0) 25 | size_s1--; 26 | return (ft_substr((char *)s1, 0, size_s1 + 1)); 27 | } 28 | -------------------------------------------------------------------------------- /01_original/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memccpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:03:04 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 16:59:57 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memccpy(void *dest, const void *src, int c, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | *((unsigned char *)dest + idx) = *((unsigned char *)src + idx); 23 | if (*((unsigned char *)src + idx) == (unsigned char)c) 24 | { 25 | return (dest + idx + 1); 26 | break ; 27 | } 28 | idx++; 29 | } 30 | return (NULL); 31 | } 32 | -------------------------------------------------------------------------------- /02_myown/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memccpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:03:04 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 16:59:57 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memccpy(void *dest, const void *src, int c, size_t n) 16 | { 17 | size_t idx; 18 | 19 | idx = 0; 20 | while (idx < n) 21 | { 22 | *((unsigned char *)dest + idx) = *((unsigned char *)src + idx); 23 | if (*((unsigned char *)src + idx) == (unsigned char)c) 24 | { 25 | return (dest + idx + 1); 26 | break ; 27 | } 28 | idx++; 29 | } 30 | return (NULL); 31 | } 32 | -------------------------------------------------------------------------------- /01_original/ft_strlcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:52:40 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 23:55:13 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlcpy(char *dest, const char *src, size_t size) 16 | { 17 | size_t idx; 18 | size_t count; 19 | 20 | idx = 0; 21 | count = 0; 22 | if (!dest || !src) 23 | return (0); 24 | while (src[count]) 25 | count++; 26 | while (src[idx] && idx + 1 < size) 27 | { 28 | dest[idx] = src[idx]; 29 | idx++; 30 | } 31 | if (size) 32 | dest[idx] = '\0'; 33 | return (count); 34 | } 35 | -------------------------------------------------------------------------------- /02_myown/ft_strlcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:52:40 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 23:55:13 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlcpy(char *dest, const char *src, size_t size) 16 | { 17 | size_t idx; 18 | size_t count; 19 | 20 | idx = 0; 21 | count = 0; 22 | if (!dest || !src) 23 | return (0); 24 | while (src[count]) 25 | count++; 26 | while (src[idx] && idx + 1 < size) 27 | { 28 | dest[idx] = src[idx]; 29 | idx++; 30 | } 31 | if (size) 32 | dest[idx] = '\0'; 33 | return (count); 34 | } 35 | -------------------------------------------------------------------------------- /01_original/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strmapi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:54:02 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:28 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strmapi(const char *s, char (*f)(unsigned int, char)) 16 | { 17 | size_t idx; 18 | char *tmp; 19 | 20 | if (!s || !f || 21 | !(tmp = (char *)malloc(sizeof(char) * (ft_strlen((char *)s) + 1)))) 22 | return (NULL); 23 | idx = 0; 24 | while (idx < (ft_strlen((char *)s))) 25 | { 26 | tmp[idx] = f(idx, s[idx]); 27 | idx++; 28 | } 29 | tmp[idx] = '\0'; 30 | return (tmp); 31 | } 32 | -------------------------------------------------------------------------------- /02_myown/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strmapi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:54:02 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:28 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strmapi(const char *s, char (*f)(unsigned int, char)) 16 | { 17 | size_t idx; 18 | char *tmp; 19 | 20 | if (!s || !f || 21 | !(tmp = (char *)malloc(sizeof(char) * (ft_strlen((char *)s) + 1)))) 22 | return (NULL); 23 | idx = 0; 24 | while (idx < (ft_strlen((char *)s))) 25 | { 26 | tmp[idx] = f(idx, s[idx]); 27 | idx++; 28 | } 29 | tmp[idx] = '\0'; 30 | return (tmp); 31 | } 32 | -------------------------------------------------------------------------------- /02_myown/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:55:37 by jwon #+# #+# */ 9 | /* Updated: 2020/04/14 18:04:37 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strnstr(const char *str, const char *to_find, size_t len) 16 | { 17 | size_t position; 18 | 19 | if (*to_find == '\0') 20 | return ((char *)str); 21 | position = ft_strlen((char *)to_find); 22 | while (*str != '\0' && len-- >= position) 23 | { 24 | if (*str == *to_find && ft_memcmp(str, to_find, position) == 0) 25 | return ((char *)str); 26 | str++; 27 | } 28 | return (NULL); 29 | } 30 | -------------------------------------------------------------------------------- /01_original/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:54:56 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:21:39 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strncmp(const char *s1, const char *s2, size_t n) 16 | { 17 | size_t idx; 18 | 19 | if (n == 0) 20 | return (0); 21 | idx = 0; 22 | while (idx < n) 23 | { 24 | if (s1[idx] && s1[idx] == s2[idx]) 25 | { 26 | while (s1[idx] && s1[idx] == s2[idx] && idx < n) 27 | idx++; 28 | } 29 | else 30 | return ((unsigned char)s1[idx] - (unsigned char)s2[idx]); 31 | } 32 | return (0); 33 | } 34 | -------------------------------------------------------------------------------- /01_original/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:55:37 by jwon #+# #+# */ 9 | /* Updated: 2020/04/14 18:04:37 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strnstr(const char *str, const char *to_find, size_t len) 16 | { 17 | size_t position; 18 | 19 | if (*to_find == '\0') 20 | return ((char *)str); 21 | position = ft_strlen((char *)to_find); 22 | while (*str != '\0' && len-- >= position) 23 | { 24 | if (*str == *to_find && ft_memcmp(str, to_find, position) == 0) 25 | return ((char *)str); 26 | str++; 27 | } 28 | return (NULL); 29 | } 30 | -------------------------------------------------------------------------------- /02_myown/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:54:56 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:21:39 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strncmp(const char *s1, const char *s2, size_t n) 16 | { 17 | size_t idx; 18 | 19 | if (n == 0) 20 | return (0); 21 | idx = 0; 22 | while (idx < n) 23 | { 24 | if (s1[idx] && s1[idx] == s2[idx]) 25 | { 26 | while (s1[idx] && s1[idx] == s2[idx] && idx < n) 27 | idx++; 28 | } 29 | else 30 | return ((unsigned char)s1[idx] - (unsigned char)s2[idx]); 31 | } 32 | return (0); 33 | } 34 | -------------------------------------------------------------------------------- /02_myown/ft_substr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_substr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:58:03 by jwon #+# #+# */ 9 | /* Updated: 2020/04/13 01:17:05 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_substr(char const *s, unsigned int start, size_t len) 16 | { 17 | unsigned int idx; 18 | char *modified_s; 19 | 20 | if (!s || !(modified_s = malloc(sizeof(char) * (len + 1)))) 21 | return (NULL); 22 | idx = 0; 23 | while (start < ft_strlen((char *)s) && s[start + idx] && idx < len) 24 | { 25 | modified_s[idx] = s[start + idx]; 26 | idx++; 27 | } 28 | modified_s[idx] = '\0'; 29 | return (modified_s); 30 | } 31 | -------------------------------------------------------------------------------- /01_original/ft_substr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_substr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:58:03 by jwon #+# #+# */ 9 | /* Updated: 2020/04/13 01:17:05 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_substr(char const *s, unsigned int start, size_t len) 16 | { 17 | unsigned int idx; 18 | char *modified_s; 19 | 20 | if (!s || !(modified_s = malloc(sizeof(char) * (len + 1)))) 21 | return (NULL); 22 | idx = 0; 23 | while (start < ft_strlen((char *)s) && s[start + idx] && idx < len) 24 | { 25 | modified_s[idx] = s[start + idx]; 26 | idx++; 27 | } 28 | modified_s[idx] = '\0'; 29 | return (modified_s); 30 | } 31 | -------------------------------------------------------------------------------- /02_myown/ft_chrdel.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_chrdel.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/06/25 17:58:03 by jwon #+# #+# */ 9 | /* Updated: 2020/06/25 21:17:05 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_chrdel(char const *s, char c) 16 | { 17 | unsigned int idx_s; 18 | unsigned int idx_buf; 19 | char *buf; 20 | 21 | if (!s || !(buf = malloc(sizeof(char) * (ft_strlen(s) + 1)))) 22 | return (NULL); 23 | idx_s = 0; 24 | idx_buf = 0; 25 | while (s[idx_s]) 26 | { 27 | if (s[idx_s] == c) 28 | { 29 | idx_s++; 30 | continue ; 31 | } 32 | buf[idx_buf++] = s[idx_s++]; 33 | } 34 | buf[idx_buf] = '\0'; 35 | return (buf); 36 | } 37 | -------------------------------------------------------------------------------- /02_myown/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:17:17 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:18:01 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putnbr_fd(int n, int fd) 16 | { 17 | if (n == -2147483648) 18 | { 19 | ft_putchar_fd('-', fd); 20 | ft_putchar_fd('2', fd); 21 | ft_putnbr_fd(147483648, fd); 22 | } 23 | else if (n < 0) 24 | { 25 | ft_putchar_fd('-', fd); 26 | ft_putnbr_fd(n * -1, fd); 27 | } 28 | else if (n < 10) 29 | ft_putchar_fd((char)(n + '0'), fd); 30 | else 31 | { 32 | ft_putnbr_fd(n / 10, fd); 33 | ft_putchar_fd(n % 10 + '0', fd); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /01_original/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:17:17 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 15:18:01 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putnbr_fd(int n, int fd) 16 | { 17 | if (n == -2147483648) 18 | { 19 | ft_putchar_fd('-', fd); 20 | ft_putchar_fd('2', fd); 21 | ft_putnbr_fd(147483648, fd); 22 | } 23 | else if (n < 0) 24 | { 25 | ft_putchar_fd('-', fd); 26 | ft_putnbr_fd(n * -1, fd); 27 | } 28 | else if (n < 10) 29 | ft_putchar_fd((char)(n + '0'), fd); 30 | else 31 | { 32 | ft_putnbr_fd(n / 10, fd); 33 | ft_putchar_fd(n % 10 + '0', fd); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /02_myown/ft_memmove.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memmove.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:10:13 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 16:50:44 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memmove(void *dest, const void *src, size_t n) 16 | { 17 | size_t idx; 18 | 19 | if (dest == src || !n) 20 | return (dest); 21 | idx = 0; 22 | if (dest < src) 23 | { 24 | while (idx < n) 25 | { 26 | *((char *)dest + idx) = *((char *)src + idx); 27 | idx++; 28 | } 29 | } 30 | else 31 | { 32 | while (n > 0) 33 | { 34 | *((char *)dest + n - 1) = *((char *)src + n - 1); 35 | n--; 36 | } 37 | } 38 | return (dest); 39 | } 40 | -------------------------------------------------------------------------------- /01_original/ft_memmove.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memmove.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:10:13 by jwon #+# #+# */ 9 | /* Updated: 2020/04/06 16:50:44 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memmove(void *dest, const void *src, size_t n) 16 | { 17 | size_t idx; 18 | 19 | if (dest == src || !n) 20 | return (dest); 21 | idx = 0; 22 | if (dest < src) 23 | { 24 | while (idx < n) 25 | { 26 | *((char *)dest + idx) = *((char *)src + idx); 27 | idx++; 28 | } 29 | } 30 | else 31 | { 32 | while (n > 0) 33 | { 34 | *((char *)dest + n - 1) = *((char *)src + n - 1); 35 | n--; 36 | } 37 | } 38 | return (dest); 39 | } 40 | -------------------------------------------------------------------------------- /02_myown/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strjoin.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:48:53 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:37 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strjoin(char const *s1, char const *s2) 16 | { 17 | int idx; 18 | int idx_join; 19 | char *join; 20 | 21 | if (!s1 || !s2 || !(join = malloc(sizeof(char) * 22 | (ft_strlen((char *)s1) + ft_strlen((char *)s2) + 1)))) 23 | return (NULL); 24 | idx = 0; 25 | idx_join = 0; 26 | while (s1[idx]) 27 | join[idx_join++] = s1[idx++]; 28 | idx = 0; 29 | while (s2[idx]) 30 | join[idx_join++] = s2[idx++]; 31 | join[idx_join] = '\0'; 32 | return (join); 33 | } 34 | -------------------------------------------------------------------------------- /02_myown/ft_strstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/08/15 13:07:07 by jwon #+# #+# */ 9 | /* Updated: 2020/08/15 13:15:09 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | int str_compare(const char *str1, const char *str2) 14 | { 15 | while (*str2) 16 | { 17 | if (*str1 != *str2) 18 | return (0); 19 | str1++; 20 | str2++; 21 | } 22 | return (1); 23 | } 24 | 25 | char *ft_strstr(const char *str, const char *to_find) 26 | { 27 | if (*to_find == '\0') 28 | return ((char *)str); 29 | while (*str) 30 | { 31 | if (*str == *to_find) 32 | { 33 | if (str_compare(str, to_find)) 34 | return ((char *)str); 35 | } 36 | str++; 37 | } 38 | return (0); 39 | } 40 | -------------------------------------------------------------------------------- /01_original/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strjoin.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:48:53 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:17:37 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strjoin(char const *s1, char const *s2) 16 | { 17 | int idx; 18 | int idx_join; 19 | char *join; 20 | 21 | if (!s1 || !s2 || !(join = malloc(sizeof(char) * 22 | (ft_strlen((char *)s1) + ft_strlen((char *)s2) + 1)))) 23 | return (NULL); 24 | idx = 0; 25 | idx_join = 0; 26 | while (s1[idx]) 27 | join[idx_join++] = s1[idx++]; 28 | idx = 0; 29 | while (s2[idx]) 30 | join[idx_join++] = s2[idx++]; 31 | join[idx_join] = '\0'; 32 | return (join); 33 | } 34 | -------------------------------------------------------------------------------- /02_myown/ft_atoi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_atoi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:27:11 by jwon #+# #+# */ 9 | /* Updated: 2020/04/14 18:13:45 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_atoi(const char *str) 16 | { 17 | int sign; 18 | long long value; 19 | 20 | sign = 1; 21 | value = 0; 22 | while (*str == ' ' || *str == '\f' || *str == '\n' || 23 | *str == '\r' || *str == '\t' || *str == '\v') 24 | str++; 25 | if (*str == '-') 26 | sign = -1; 27 | if (*str == '-' || *str == '+') 28 | ++str; 29 | while (ft_isdigit(*str)) 30 | { 31 | value = value * 10 + (*str - '0'); 32 | str++; 33 | } 34 | value = sign == 1 ? value : -value; 35 | return (value); 36 | } 37 | -------------------------------------------------------------------------------- /01_original/ft_atoi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_atoi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:27:11 by jwon #+# #+# */ 9 | /* Updated: 2020/04/14 18:13:45 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_atoi(const char *str) 16 | { 17 | int sign; 18 | long long value; 19 | 20 | sign = 1; 21 | value = 0; 22 | while (*str == ' ' || *str == '\f' || *str == '\n' || 23 | *str == '\r' || *str == '\t' || *str == '\v') 24 | str++; 25 | if (*str == '-') 26 | sign = -1; 27 | if (*str == '-' || *str == '+') 28 | ++str; 29 | while (ft_isdigit(*str)) 30 | { 31 | value = value * 10 + (*str - '0'); 32 | str++; 33 | } 34 | value = sign == 1 ? value : -value; 35 | return (value); 36 | } 37 | -------------------------------------------------------------------------------- /02_myown/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:51:46 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 23:54:55 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlcat(char *dest, const char *src, size_t size) 16 | { 17 | size_t idx; 18 | size_t src_idx; 19 | size_t value; 20 | 21 | if (size == 0) 22 | return (ft_strlen(src)); 23 | else if (size < ft_strlen(dest)) 24 | value = ft_strlen(src) + size; 25 | else 26 | value = ft_strlen(src) + ft_strlen(dest); 27 | idx = 0; 28 | while (dest[idx] != '\0') 29 | idx++; 30 | src_idx = 0; 31 | while (src[src_idx] != '\0' && idx + 1 < size) 32 | { 33 | dest[idx] = src[src_idx]; 34 | src_idx++; 35 | idx++; 36 | } 37 | dest[idx] = '\0'; 38 | return (value); 39 | } 40 | -------------------------------------------------------------------------------- /01_original/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:51:46 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 23:54:55 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlcat(char *dest, const char *src, size_t size) 16 | { 17 | size_t idx; 18 | size_t src_idx; 19 | size_t value; 20 | 21 | if (size == 0) 22 | return (ft_strlen(src)); 23 | else if (size < ft_strlen(dest)) 24 | value = ft_strlen(src) + size; 25 | else 26 | value = ft_strlen(src) + ft_strlen(dest); 27 | idx = 0; 28 | while (dest[idx] != '\0') 29 | idx++; 30 | src_idx = 0; 31 | while (src[src_idx] != '\0' && idx + 1 < size) 32 | { 33 | dest[idx] = src[src_idx]; 34 | src_idx++; 35 | idx++; 36 | } 37 | dest[idx] = '\0'; 38 | return (value); 39 | } 40 | -------------------------------------------------------------------------------- /02_myown/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstmap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/08 15:59:35 by jwon #+# #+# */ 9 | /* Updated: 2020/04/08 16:33:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)) 16 | { 17 | t_list *new_lst; 18 | t_list *position_new; 19 | t_list *position_old; 20 | 21 | if (!lst || !(new_lst = ft_lstnew((*f)(lst->content)))) 22 | return (NULL); 23 | position_new = new_lst; 24 | position_old = lst->next; 25 | while (position_old) 26 | { 27 | if (!(position_new->next = ft_lstnew((*f)(position_old->content)))) 28 | { 29 | ft_lstclear(&new_lst, del); 30 | return (NULL); 31 | } 32 | position_new = position_new->next; 33 | position_old = position_old->next; 34 | } 35 | return (new_lst); 36 | } 37 | -------------------------------------------------------------------------------- /01_original/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_lstmap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/08 15:59:35 by jwon #+# #+# */ 9 | /* Updated: 2020/04/08 16:33:46 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)) 16 | { 17 | t_list *new_lst; 18 | t_list *position_new; 19 | t_list *position_old; 20 | 21 | if (!lst || !(new_lst = ft_lstnew((*f)(lst->content)))) 22 | return (NULL); 23 | position_new = new_lst; 24 | position_old = lst->next; 25 | while (position_old) 26 | { 27 | if (!(position_new->next = ft_lstnew((*f)(position_old->content)))) 28 | { 29 | ft_lstclear(&new_lst, del); 30 | return (NULL); 31 | } 32 | position_new = position_new->next; 33 | position_old = position_old->next; 34 | } 35 | return (new_lst); 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## :notebook_with_decorative_cover: Libft 2 | 3 | #### :page_facing_up: Program name 4 | 5 | - **`libft.a`** 6 | 7 | #### :page_facing_up: Turn in files 8 | 9 | - `*.c`, `libft.h`, `Makefile` 10 | 11 | #### :page_facing_up: Description 12 | 13 | - Write your own library, containing an extract of important functions for your cursus. 14 | - You are free to add any function to your libft as you see fit. 15 | 16 | #### :page_facing_up: Functions List 17 | 18 | - Part 1 - Libc functions 19 | 20 | ``` 21 | memset, bzero, memcpy, memccpy, memmove, memchr, memcmp, 22 | strlen, strlcpy, strlcat, strchr, strrchr, strnstr, strncmp, 23 | atoi, isalpha, isdigit, isalnum, isascii, isprint, toupper, tolower, 24 | calloc, strdup 25 | ``` 26 | 27 | - Part 2 - Additional functions (~100) 28 | 29 | ``` 30 | substr, strjoin, strtrim, split, itoa, strmapi, 31 | putchar_fd, putstr_fd, putendl_fd, putnbr_fd 32 | ``` 33 | 34 | - Bonus Part (~115) 35 | 36 | ``` 37 | lstnew, lstadd_front, lstsize, lstlast, 38 | lstadd_back, lstdelone, lstclear, lstiter, lstmap 39 | ``` 40 | 41 | - [My own functions](/02_myown) 42 | 43 | - [get_next_line](/02_myown/get_next_line.c) 44 | 45 | ```c 46 | int get_next_line(int fd, char **line); 47 | ``` 48 | 49 | Write a function which returns a line read from a file descriptor, without the newline. 50 | 51 | - [isspace](/02_myown/ft_isspace.c) 52 | 53 | ```c 54 | int ft_isspace(int c); 55 | ``` 56 | 57 | Checks for white-space characters. (`" "`, `\f`, `\n`, `\r`, `\t`, `\v`) 58 | 59 | - [chrdel](/02_myown/ft_chrdel.c) 60 | 61 | ```c 62 | char *ft_chrdel(char const *s, char c); 63 | ``` 64 | 65 | Remove all specific characters(c) from a string(s). 66 | 67 | ------ 68 | 69 | #### :link: Test Tools Links 70 | 71 | - [**Libftest** by jtoty](https://github.com/jtoty/Libftest) 72 | - [**libft-unit-test** by alelievr](https://github.com/alelievr/libft-unit-test) 73 | - [**libft-war-machine** by ska42](https://github.com/ska42/libft-war-machine) 74 | 75 | -------------------------------------------------------------------------------- /02_myown/ft_split.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_split.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:18:41 by jwon #+# #+# */ 9 | /* Updated: 2020/04/13 16:58:55 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t get_cnt(char const *s, char c) 16 | { 17 | size_t cnt; 18 | 19 | cnt = 0; 20 | while (*s != '\0') 21 | { 22 | if (*s == c) 23 | s++; 24 | else 25 | { 26 | cnt++; 27 | while (*s != '\0' && *s != c) 28 | s++; 29 | } 30 | } 31 | return (cnt); 32 | } 33 | 34 | char **free_machine(char **s, size_t idx) 35 | { 36 | while (s[idx] != NULL && idx >= 0) 37 | { 38 | free(s[idx]); 39 | s[idx] = NULL; 40 | idx--; 41 | } 42 | free(s); 43 | s = NULL; 44 | return (NULL); 45 | } 46 | 47 | char **ft_split(char const *s, char c) 48 | { 49 | size_t idx; 50 | size_t len; 51 | size_t word_cnt; 52 | char **words; 53 | 54 | if (!s || !(words = (char **)malloc(sizeof(char *) * (get_cnt(s, c) + 1)))) 55 | return (NULL); 56 | word_cnt = get_cnt(s, c); 57 | idx = 0; 58 | while (*s) 59 | { 60 | if (*s == c) 61 | s++; 62 | else 63 | { 64 | len = 0; 65 | while (*(s + len) && *(s + len) != c) 66 | len++; 67 | if (idx < word_cnt && !(words[idx++] = ft_substr(s, 0, len))) 68 | return (free_machine(words, idx)); 69 | s += len; 70 | } 71 | } 72 | words[idx] = 0; 73 | return (words); 74 | } 75 | -------------------------------------------------------------------------------- /01_original/ft_split.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_split.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 15:18:41 by jwon #+# #+# */ 9 | /* Updated: 2020/04/13 16:58:55 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t get_cnt(char const *s, char c) 16 | { 17 | size_t cnt; 18 | 19 | cnt = 0; 20 | while (*s != '\0') 21 | { 22 | if (*s == c) 23 | s++; 24 | else 25 | { 26 | cnt++; 27 | while (*s != '\0' && *s != c) 28 | s++; 29 | } 30 | } 31 | return (cnt); 32 | } 33 | 34 | char **free_machine(char **s, size_t idx) 35 | { 36 | while (s[idx] != NULL && idx >= 0) 37 | { 38 | free(s[idx]); 39 | s[idx] = NULL; 40 | idx--; 41 | } 42 | free(s); 43 | s = NULL; 44 | return (NULL); 45 | } 46 | 47 | char **ft_split(char const *s, char c) 48 | { 49 | size_t idx; 50 | size_t len; 51 | size_t word_cnt; 52 | char **words; 53 | 54 | if (!s || !(words = (char **)malloc(sizeof(char *) * (get_cnt(s, c) + 1)))) 55 | return (NULL); 56 | word_cnt = get_cnt(s, c); 57 | idx = 0; 58 | while (*s) 59 | { 60 | if (*s == c) 61 | s++; 62 | else 63 | { 64 | len = 0; 65 | while (*(s + len) && *(s + len) != c) 66 | len++; 67 | if (idx < word_cnt && !(words[idx++] = ft_substr(s, 0, len))) 68 | return (free_machine(words, idx)); 69 | s += len; 70 | } 71 | } 72 | words[idx] = 0; 73 | return (words); 74 | } 75 | -------------------------------------------------------------------------------- /01_original/ft_itoa.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_itoa.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:41:54 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:33 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrev(char *str) 16 | { 17 | int idx; 18 | int size; 19 | char tmp; 20 | 21 | size = ft_strlen(str); 22 | idx = 0; 23 | while (idx < (size / 2)) 24 | { 25 | tmp = str[idx]; 26 | str[idx] = str[size - idx - 1]; 27 | str[size - idx - 1] = tmp; 28 | idx++; 29 | } 30 | return (str); 31 | } 32 | 33 | int ft_intlen(int n) 34 | { 35 | int idx; 36 | long long tmp; 37 | 38 | tmp = n; 39 | idx = 1; 40 | if (tmp < 0) 41 | { 42 | tmp = tmp * -1; 43 | idx++; 44 | } 45 | while (tmp >= 10) 46 | { 47 | tmp = tmp / 10; 48 | idx++; 49 | } 50 | return (idx); 51 | } 52 | 53 | char *ft_itoa(int n) 54 | { 55 | int idx; 56 | int is_negative; 57 | unsigned int positive_n; 58 | char *value; 59 | 60 | if (n == 0) 61 | return (ft_strdup("0")); 62 | if (!(value = (char *)malloc(sizeof(char) * (ft_intlen(n) + 1)))) 63 | return (NULL); 64 | ft_memset(value, '\0', (ft_intlen(n) + 1)); 65 | is_negative = n < 0 ? 1 : 0; 66 | positive_n = n < 0 ? -n : n; 67 | idx = 0; 68 | while (positive_n != 0) 69 | { 70 | value[idx++] = (positive_n % 10) + '0'; 71 | positive_n = positive_n / 10; 72 | } 73 | if (is_negative) 74 | value[idx++] = '-'; 75 | return (ft_strrev(value)); 76 | } 77 | -------------------------------------------------------------------------------- /02_myown/ft_itoa.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_itoa.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 14:41:54 by jwon #+# #+# */ 9 | /* Updated: 2020/04/10 22:18:33 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrev(char *str) 16 | { 17 | int idx; 18 | int size; 19 | char tmp; 20 | 21 | size = ft_strlen(str); 22 | idx = 0; 23 | while (idx < (size / 2)) 24 | { 25 | tmp = str[idx]; 26 | str[idx] = str[size - idx - 1]; 27 | str[size - idx - 1] = tmp; 28 | idx++; 29 | } 30 | return (str); 31 | } 32 | 33 | int ft_intlen(int n) 34 | { 35 | int idx; 36 | long long tmp; 37 | 38 | tmp = n; 39 | idx = 1; 40 | if (tmp < 0) 41 | { 42 | tmp = tmp * -1; 43 | idx++; 44 | } 45 | while (tmp >= 10) 46 | { 47 | tmp = tmp / 10; 48 | idx++; 49 | } 50 | return (idx); 51 | } 52 | 53 | char *ft_itoa(int n) 54 | { 55 | int idx; 56 | int is_negative; 57 | unsigned int positive_n; 58 | char *value; 59 | 60 | if (n == 0) 61 | return (ft_strdup("0")); 62 | if (!(value = (char *)malloc(sizeof(char) * (ft_intlen(n) + 1)))) 63 | return (NULL); 64 | ft_memset(value, '\0', (ft_intlen(n) + 1)); 65 | is_negative = n < 0 ? 1 : 0; 66 | positive_n = n < 0 ? -n : n; 67 | idx = 0; 68 | while (positive_n != 0) 69 | { 70 | value[idx++] = (positive_n % 10) + '0'; 71 | positive_n = positive_n / 10; 72 | } 73 | if (is_negative) 74 | value[idx++] = '-'; 75 | return (ft_strrev(value)); 76 | } 77 | -------------------------------------------------------------------------------- /02_myown/get_next_line.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* get_next_line.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/09 16:44:33 by jwon #+# #+# */ 9 | /* Updated: 2020/05/26 18:11:17 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int read_buffer(int fd, char **store) 16 | { 17 | int bytes; 18 | char *tmp; 19 | char *buf; 20 | 21 | buf = (BUFFER_SIZE > 0) ? malloc(sizeof(char) * (BUFFER_SIZE + 1)) : NULL; 22 | if ((bytes = read(fd, buf, BUFFER_SIZE)) < 0 || buf == NULL) 23 | return (-1); 24 | buf[bytes] = '\0'; 25 | tmp = ft_strjoin(*store, buf); 26 | free(*store); 27 | *store = tmp; 28 | free(buf); 29 | buf = NULL; 30 | return ((bytes > 1) ? 1 : bytes); 31 | } 32 | 33 | void split_store(char **store, char **line) 34 | { 35 | size_t len; 36 | char *tmp; 37 | 38 | len = ft_strchr(*store, '\n') - *store; 39 | *line = ft_substr(*store, 0, len); 40 | tmp = ft_substr(*store, len + 1, ft_strlen(*store) - len); 41 | free(*store); 42 | *store = tmp; 43 | } 44 | 45 | int get_next_line(int fd, char **line) 46 | { 47 | int bytes; 48 | static char *store[OPEN_MAX]; 49 | 50 | if (fd < 0 || fd > OPEN_MAX || !line || BUFFER_SIZE <= 0) 51 | return (-1); 52 | store[fd] = (store[fd] == NULL) ? ft_strdup("") : store[fd]; 53 | bytes = 1; 54 | while (bytes > 0 && !ft_strchr(store[fd], '\n')) 55 | bytes = read_buffer(fd, &store[fd]); 56 | if (ft_strchr(store[fd], '\n')) 57 | split_store(&store[fd], line); 58 | if (bytes == 0 && !ft_strchr(store[fd], '\n')) 59 | { 60 | *line = ft_strdup(store[fd]); 61 | free(store[fd]); 62 | store[fd] = NULL; 63 | } 64 | return ((bytes > 1) ? 1 : bytes); 65 | } 66 | -------------------------------------------------------------------------------- /02_myown/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: jwon +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2020/04/08 19:07:10 by jwon #+# #+# # 9 | # Updated: 2020/04/08 19:28:16 by jwon ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | 15 | SRCS = ft_memset.c \ 16 | ft_bzero.c \ 17 | ft_memcpy.c \ 18 | ft_memccpy.c \ 19 | ft_memmove.c \ 20 | ft_memchr.c \ 21 | ft_memcmp.c \ 22 | ft_strlen.c \ 23 | ft_strlcpy.c \ 24 | ft_strlcat.c \ 25 | ft_strchr.c \ 26 | ft_strrchr.c \ 27 | ft_strnstr.c \ 28 | ft_strncmp.c \ 29 | ft_atoi.c \ 30 | ft_isalpha.c \ 31 | ft_isdigit.c \ 32 | ft_isalnum.c \ 33 | ft_isascii.c \ 34 | ft_isprint.c \ 35 | ft_toupper.c \ 36 | ft_tolower.c \ 37 | ft_calloc.c \ 38 | ft_strdup.c \ 39 | ft_substr.c \ 40 | ft_strjoin.c \ 41 | ft_strtrim.c \ 42 | ft_split.c \ 43 | ft_itoa.c \ 44 | ft_strmapi.c \ 45 | ft_putchar_fd.c \ 46 | ft_putstr_fd.c \ 47 | ft_putendl_fd.c \ 48 | ft_putnbr_fd.c \ 49 | ft_lstnew.c \ 50 | ft_lstadd_front.c \ 51 | ft_lstsize.c \ 52 | ft_lstlast.c \ 53 | ft_lstadd_back.c \ 54 | ft_lstdelone.c \ 55 | ft_lstclear.c \ 56 | ft_lstiter.c \ 57 | ft_lstmap.c \ 58 | get_next_line.c \ 59 | ft_isspace.c \ 60 | ft_isspace_str.c \ 61 | ft_chrdel.c \ 62 | ft_strstr.c \ 63 | 64 | 65 | OBJS = $(SRCS:%.c=%.o) 66 | 67 | FLAGS = -Wall -Wextra -Werror 68 | 69 | $(NAME): 70 | gcc $(FLAGS) -c $(SRCS) -I./ 71 | ar rc $(NAME) $(OBJS) 72 | 73 | all: $(NAME) 74 | 75 | clean: 76 | rm -f $(OBJS) 77 | 78 | fclean: clean 79 | rm -f $(NAME) 80 | 81 | re: fclean all 82 | -------------------------------------------------------------------------------- /01_original/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: jwon +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2020/04/08 19:07:10 by jwon #+# #+# # 9 | # Updated: 2020/04/08 19:28:16 by jwon ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | 15 | SRCS = ft_memset.c \ 16 | ft_bzero.c \ 17 | ft_memcpy.c \ 18 | ft_memccpy.c \ 19 | ft_memmove.c \ 20 | ft_memchr.c \ 21 | ft_memcmp.c \ 22 | ft_strlen.c \ 23 | ft_strlcpy.c \ 24 | ft_strlcat.c \ 25 | ft_strchr.c \ 26 | ft_strrchr.c \ 27 | ft_strnstr.c \ 28 | ft_strncmp.c \ 29 | ft_atoi.c \ 30 | ft_isalpha.c \ 31 | ft_isdigit.c \ 32 | ft_isalnum.c \ 33 | ft_isascii.c \ 34 | ft_isprint.c \ 35 | ft_toupper.c \ 36 | ft_tolower.c \ 37 | ft_calloc.c \ 38 | ft_strdup.c \ 39 | ft_substr.c \ 40 | ft_strjoin.c \ 41 | ft_strtrim.c \ 42 | ft_split.c \ 43 | ft_itoa.c \ 44 | ft_strmapi.c \ 45 | ft_putchar_fd.c \ 46 | ft_putstr_fd.c \ 47 | ft_putendl_fd.c \ 48 | ft_putnbr_fd.c 49 | 50 | BNS_SRCS = ft_lstnew.c \ 51 | ft_lstadd_front.c \ 52 | ft_lstsize.c \ 53 | ft_lstlast.c \ 54 | ft_lstadd_back.c \ 55 | ft_lstdelone.c \ 56 | ft_lstclear.c \ 57 | ft_lstiter.c \ 58 | ft_lstmap.c \ 59 | 60 | OBJS = $(SRCS:%.c=%.o) 61 | 62 | BNS_OBJS = $(BNS_SRCS:%.c=%.o) 63 | 64 | FLAGS = -Wall -Werror -Wextra 65 | 66 | $(NAME): 67 | gcc $(FLAGS) -c $(SRCS) -I ./ 68 | ar rc $(NAME) $(OBJS) 69 | 70 | all: $(NAME) 71 | 72 | bonus: $(NAME) 73 | gcc $(FLAGS) -c $(BNS_SRCS) -I ./ 74 | ar rc $(NAME) $(BNS_OBJS) 75 | 76 | clean: 77 | rm -f $(OBJS) $(BNS_OBJS) 78 | 79 | fclean: clean 80 | rm -f $(NAME) 81 | 82 | re: fclean all 83 | -------------------------------------------------------------------------------- /01_original/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 13:56:39 by jwon #+# #+# */ 9 | /* Updated: 2020/04/13 16:37:20 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | 16 | # include 17 | # include 18 | 19 | void *ft_memset(void *str, int c, size_t n); 20 | void ft_bzero(void *str, size_t n); 21 | void *ft_memcpy(void *dest, const void *src, size_t n); 22 | void *ft_memccpy(void *dest, const void *src, int c, size_t n); 23 | void *ft_memmove(void *dest, const void *src, size_t n); 24 | void *ft_memchr(const void *s, int c, size_t n); 25 | int ft_memcmp(const void *s1, const void *s2, size_t n); 26 | size_t ft_strlen(const char *str); 27 | size_t ft_strlcpy(char *dest, const char *src, size_t size); 28 | size_t ft_strlcat(char *dest, const char *src, size_t size); 29 | char *ft_strchr(const char *str, int c); 30 | char *ft_strrchr(const char *str, int c); 31 | char *ft_strnstr(const char *str, const char *to_find, \ 32 | size_t len); 33 | int ft_strncmp(const char *s1, const char *s2, size_t n); 34 | int ft_atoi(const char *str); 35 | int ft_isalpha(int c); 36 | int ft_isdigit(int c); 37 | int ft_isalnum(int c); 38 | int ft_isascii(int c); 39 | int ft_isprint(int c); 40 | int ft_toupper(int c); 41 | int ft_tolower(int c); 42 | void *ft_calloc(size_t nmemb, size_t size); 43 | char *ft_strdup(const char *str); 44 | 45 | char *ft_substr(char const *s, unsigned int start, size_t len); 46 | char *ft_strjoin(char const *s1, char const *s2); 47 | char *ft_strtrim(char const *s1, char const *set); 48 | char **ft_split(char const *s, char c); 49 | char *ft_itoa(int n); 50 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); 51 | void ft_putchar_fd(char c, int fd); 52 | void ft_putstr_fd(char *s, int fd); 53 | void ft_putendl_fd(char *s, int fd); 54 | void ft_putnbr_fd(int n, int fd); 55 | 56 | typedef struct s_list 57 | { 58 | void *content; 59 | struct s_list *next; 60 | } t_list; 61 | t_list *ft_lstnew(void *content); 62 | void ft_lstadd_front(t_list **lst, t_list *new); 63 | int ft_lstsize(t_list *lst); 64 | t_list *ft_lstlast(t_list *lst); 65 | void ft_lstadd_back(t_list **lst, t_list *new); 66 | void ft_lstdelone(t_list *lst, void (*del)(void *)); 67 | void ft_lstclear(t_list **lst, void (*del)(void *)); 68 | void ft_lstiter(t_list *lst, void (*f)(void *)); 69 | t_list *ft_lstmap(t_list *lst, void *(*f)(void *), \ 70 | void (*del)(void *)); 71 | #endif 72 | -------------------------------------------------------------------------------- /02_myown/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jwon +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2020/04/06 13:56:39 by jwon #+# #+# */ 9 | /* Updated: 2020/08/15 13:15:21 by jwon ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | 16 | # include 17 | # include 18 | # include 19 | 20 | # define BUFFER_SIZE 1 21 | 22 | void *ft_memset(void *str, int c, size_t n); 23 | void ft_bzero(void *str, size_t n); 24 | void *ft_memcpy(void *dest, const void *src, size_t n); 25 | void *ft_memccpy(void *dest, const void *src, int c, size_t n); 26 | void *ft_memmove(void *dest, const void *src, size_t n); 27 | void *ft_memchr(const void *s, int c, size_t n); 28 | int ft_memcmp(const void *s1, const void *s2, size_t n); 29 | size_t ft_strlen(const char *str); 30 | size_t ft_strlcpy(char *dest, const char *src, size_t size); 31 | size_t ft_strlcat(char *dest, const char *src, size_t size); 32 | char *ft_strchr(const char *str, int c); 33 | char *ft_strrchr(const char *str, int c); 34 | char *ft_strnstr(const char *str, const char *to_find, \ 35 | size_t len); 36 | int ft_strncmp(const char *s1, const char *s2, size_t n); 37 | int ft_atoi(const char *str); 38 | int ft_isalpha(int c); 39 | int ft_isdigit(int c); 40 | int ft_isalnum(int c); 41 | int ft_isascii(int c); 42 | int ft_isprint(int c); 43 | int ft_toupper(int c); 44 | int ft_tolower(int c); 45 | void *ft_calloc(size_t nmemb, size_t size); 46 | char *ft_strdup(const char *str); 47 | 48 | char *ft_substr(char const *s, unsigned int start, size_t len); 49 | char *ft_strjoin(char const *s1, char const *s2); 50 | char *ft_strtrim(char const *s1, char const *set); 51 | char **ft_split(char const *s, char c); 52 | char *ft_itoa(int n); 53 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); 54 | void ft_putchar_fd(char c, int fd); 55 | void ft_putstr_fd(char *s, int fd); 56 | void ft_putendl_fd(char *s, int fd); 57 | void ft_putnbr_fd(int n, int fd); 58 | 59 | typedef struct s_list 60 | { 61 | void *content; 62 | struct s_list *next; 63 | } t_list; 64 | t_list *ft_lstnew(void *content); 65 | void ft_lstadd_front(t_list **lst, t_list *new); 66 | int ft_lstsize(t_list *lst); 67 | t_list *ft_lstlast(t_list *lst); 68 | void ft_lstadd_back(t_list **lst, t_list *new); 69 | void ft_lstdelone(t_list *lst, void (*del)(void *)); 70 | void ft_lstclear(t_list **lst, void (*del)(void *)); 71 | void ft_lstiter(t_list *lst, void (*f)(void *)); 72 | t_list *ft_lstmap(t_list *lst, void *(*f)(void *), \ 73 | void (*del)(void *)); 74 | 75 | int get_next_line(int fd, char **line); 76 | int ft_isspace(int c); 77 | int ft_isspace_str(char *str); 78 | char *ft_chrdel(char const *s, char c); 79 | char *ft_strstr(const char *str, const char *to_find); 80 | 81 | #endif 82 | --------------------------------------------------------------------------------