From 3256ce67f793af381c0cb979d2b4ebbf2eb274fc Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Thu, 22 Dec 2022 17:57:19 +0100 Subject: [PATCH] kekw --- Makefile | 32 ++++++++++++ gnl/Makefile | 39 ++++++++++++++ gnl/get_next_line.c | 104 +++++++++++++++++++++++++++++++++++++ gnl/get_next_line.h | 28 ++++++++++ gnl/get_next_line_utils.c | 106 ++++++++++++++++++++++++++++++++++++++ libft/Makefile | 87 +++++++++++++++++++++++++++++++ libft/ft_atoi.c | 39 ++++++++++++++ libft/ft_bzero.c | 18 +++++++ libft/ft_calloc.c | 26 ++++++++++ libft/ft_isalnum.c | 22 ++++++++ libft/ft_isalpha.c | 20 +++++++ libft/ft_isascii.c | 18 +++++++ libft/ft_isdigit.c | 20 +++++++ libft/ft_isprint.c | 18 +++++++ libft/ft_itoa.c | 55 ++++++++++++++++++++ libft/ft_lstadd_back.c | 26 ++++++++++ libft/ft_lstadd_front.c | 21 ++++++++ libft/ft_lstclear.c | 27 ++++++++++ libft/ft_lstdelone.c | 25 +++++++++ libft/ft_lstiter.c | 24 +++++++++ libft/ft_lstlast.c | 22 ++++++++ libft/ft_lstmap.c | 39 ++++++++++++++ libft/ft_lstnew.c | 25 +++++++++ libft/ft_lstsize.c | 26 ++++++++++ libft/ft_memchr.c | 31 +++++++++++ libft/ft_memcmp.c | 29 +++++++++++ libft/ft_memcpy.c | 32 ++++++++++++ libft/ft_memmove.c | 37 +++++++++++++ libft/ft_memset.c | 28 ++++++++++ libft/ft_putchar_fd.c | 18 +++++++ libft/ft_putendl_fd.c | 21 ++++++++ libft/ft_putnbr_fd.c | 34 ++++++++++++ libft/ft_putstr_fd.c | 21 ++++++++ libft/ft_split.c | 92 +++++++++++++++++++++++++++++++++ libft/ft_strchr.c | 24 +++++++++ libft/ft_strdup.c | 31 +++++++++++ libft/ft_striteri.c | 27 ++++++++++ libft/ft_strjoin.c | 38 ++++++++++++++ libft/ft_strlcat.c | 25 +++++++++ libft/ft_strlcpy.c | 28 ++++++++++ libft/ft_strlen.c | 22 ++++++++ libft/ft_strmapi.c | 33 ++++++++++++ libft/ft_strncmp.c | 25 +++++++++ libft/ft_strnstr.c | 35 +++++++++++++ libft/ft_strrchr.c | 24 +++++++++ libft/ft_strtrim.c | 44 ++++++++++++++++ libft/ft_substr.c | 35 +++++++++++++ libft/ft_tolower.c | 18 +++++++ libft/ft_toupper.c | 18 +++++++ libft/libft.h | 70 +++++++++++++++++++++++++ libftx.h | 73 ++++++++++++++++++++++++++ printf/Makefile | 36 +++++++++++++ printf/ft_dprintX.c | 18 +++++++ printf/ft_dprintarg.c | 34 ++++++++++++ printf/ft_dprintflag.c | 23 +++++++++ printf/ft_dprintl_base.c | 34 ++++++++++++ printf/ft_dprintptr.c | 27 ++++++++++ printf/ft_dprintul.c | 18 +++++++ printf/ft_dprintul_base.c | 81 +++++++++++++++++++++++++++++ printf/ft_dprintx.c | 18 +++++++ printf/ft_isarg.c | 29 +++++++++++ printf/ft_isdigit.c | 20 +++++++ printf/ft_printf.c | 24 +++++++++ printf/ft_printf.h | 40 ++++++++++++++ printf/ft_putchar_fd.c | 19 +++++++ printf/ft_putstr_fd.c | 25 +++++++++ printf/ft_skipflag.c | 30 +++++++++++ printf/ft_strlen.c | 25 +++++++++ printf/ft_vdprintf.c | 54 +++++++++++++++++++ printf/libftprintf.a | Bin 0 -> 30760 bytes 70 files changed, 2335 insertions(+) create mode 100644 Makefile create mode 100644 gnl/Makefile create mode 100644 gnl/get_next_line.c create mode 100644 gnl/get_next_line.h create mode 100644 gnl/get_next_line_utils.c create mode 100644 libft/Makefile create mode 100644 libft/ft_atoi.c create mode 100644 libft/ft_bzero.c create mode 100644 libft/ft_calloc.c create mode 100644 libft/ft_isalnum.c create mode 100644 libft/ft_isalpha.c create mode 100644 libft/ft_isascii.c create mode 100644 libft/ft_isdigit.c create mode 100644 libft/ft_isprint.c create mode 100644 libft/ft_itoa.c create mode 100644 libft/ft_lstadd_back.c create mode 100644 libft/ft_lstadd_front.c create mode 100644 libft/ft_lstclear.c create mode 100644 libft/ft_lstdelone.c create mode 100644 libft/ft_lstiter.c create mode 100644 libft/ft_lstlast.c create mode 100644 libft/ft_lstmap.c create mode 100644 libft/ft_lstnew.c create mode 100644 libft/ft_lstsize.c create mode 100644 libft/ft_memchr.c create mode 100644 libft/ft_memcmp.c create mode 100644 libft/ft_memcpy.c create mode 100644 libft/ft_memmove.c create mode 100644 libft/ft_memset.c create mode 100644 libft/ft_putchar_fd.c create mode 100644 libft/ft_putendl_fd.c create mode 100644 libft/ft_putnbr_fd.c create mode 100644 libft/ft_putstr_fd.c create mode 100644 libft/ft_split.c create mode 100644 libft/ft_strchr.c create mode 100644 libft/ft_strdup.c create mode 100644 libft/ft_striteri.c create mode 100644 libft/ft_strjoin.c create mode 100644 libft/ft_strlcat.c create mode 100644 libft/ft_strlcpy.c create mode 100644 libft/ft_strlen.c create mode 100644 libft/ft_strmapi.c create mode 100644 libft/ft_strncmp.c create mode 100644 libft/ft_strnstr.c create mode 100644 libft/ft_strrchr.c create mode 100644 libft/ft_strtrim.c create mode 100644 libft/ft_substr.c create mode 100644 libft/ft_tolower.c create mode 100644 libft/ft_toupper.c create mode 100644 libft/libft.h create mode 100644 libftx.h create mode 100644 printf/Makefile create mode 100644 printf/ft_dprintX.c create mode 100644 printf/ft_dprintarg.c create mode 100644 printf/ft_dprintflag.c create mode 100644 printf/ft_dprintl_base.c create mode 100644 printf/ft_dprintptr.c create mode 100644 printf/ft_dprintul.c create mode 100644 printf/ft_dprintul_base.c create mode 100644 printf/ft_dprintx.c create mode 100644 printf/ft_isarg.c create mode 100644 printf/ft_isdigit.c create mode 100644 printf/ft_printf.c create mode 100644 printf/ft_printf.h create mode 100644 printf/ft_putchar_fd.c create mode 100644 printf/ft_putstr_fd.c create mode 100644 printf/ft_skipflag.c create mode 100644 printf/ft_strlen.c create mode 100644 printf/ft_vdprintf.c create mode 100644 printf/libftprintf.a diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c3196db --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +OBJ = ${SRC:.c=.o} + +NAME = libftx.a + +LIBS = libft/libft.a gnl/get_next_line.a printf/ft_printf.a + +CC = clang + +FLAG = -Wall -Wextra -Werror + +all: ${NAME} + +${NAME}: ${OBJ} + make -C libft + make -C gnl + make -C printf + ar -rcT $(NAME) $(LIBS) + +clean: + make -C libft clean + make -C gnl clean + make -C printf clean + +fclean: clean + rm -f ${NAME} + make -C libft fclean + make -C printf fclean + make -C gnl fclean + +re: fclean all + +.PHONY: all clean fclean re diff --git a/gnl/Makefile b/gnl/Makefile new file mode 100644 index 0000000..429f249 --- /dev/null +++ b/gnl/Makefile @@ -0,0 +1,39 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: cchauvet +# include +# ifndef BUFFER_SIZE +# define BUFFER_SIZE 42 +# endif + +void *ft_calloc(size_t nmemb, size_t size); +void *ft_realloc(void *ptr, size_t size); +char *ft_strfjoin(char *dst, char *src); +char *ft_strndup(char *src, size_t n); +size_t ft_strlen(char *str); +ssize_t ft_strchr(char *str, char c); +char *get_next_line(int fd); +#endif diff --git a/gnl/get_next_line_utils.c b/gnl/get_next_line_utils.c new file mode 100644 index 0000000..9bd4a48 --- /dev/null +++ b/gnl/get_next_line_utils.c @@ -0,0 +1,106 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* get_next_line_utils.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = c && c >= '0') + || ('z' >= c && c >= 'a') + || ('Z' >= c && c >= 'A')) + return (1); + return (0); +} diff --git a/libft/ft_isalpha.c b/libft/ft_isalpha.c new file mode 100644 index 0000000..9573931 --- /dev/null +++ b/libft/ft_isalpha.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isalpha.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = c && c >= 'a') || ('Z' >= c && c >= 'A')) + return (1); + return (0); +} diff --git a/libft/ft_isascii.c b/libft/ft_isascii.c new file mode 100644 index 0000000..5706106 --- /dev/null +++ b/libft/ft_isascii.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isascii.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = 0 && 127 >= c) + return (1); + return (0); +} diff --git a/libft/ft_isdigit.c b/libft/ft_isdigit.c new file mode 100644 index 0000000..0db99f6 --- /dev/null +++ b/libft/ft_isdigit.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isdigit.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = c && c >= '0') + return (1); + return (0); +} diff --git a/libft/ft_isprint.c b/libft/ft_isprint.c new file mode 100644 index 0000000..fd6d523 --- /dev/null +++ b/libft/ft_isprint.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isprint.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet next = new; +} diff --git a/libft/ft_lstadd_front.c b/libft/ft_lstadd_front.c new file mode 100644 index 0000000..b17cc46 --- /dev/null +++ b/libft/ft_lstadd_front.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstadd_front.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet next = *lst; + *lst = new; +} diff --git a/libft/ft_lstclear.c b/libft/ft_lstclear.c new file mode 100644 index 0000000..e29060a --- /dev/null +++ b/libft/ft_lstclear.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstclear.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet next; + ft_lstdelone(*lst, del); + *lst = next; + } +} diff --git a/libft/ft_lstdelone.c b/libft/ft_lstdelone.c new file mode 100644 index 0000000..73ac454 --- /dev/null +++ b/libft/ft_lstdelone.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstdelone.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet content != NULL) + del(lst->content); + free(lst); + } +} diff --git a/libft/ft_lstiter.c b/libft/ft_lstiter.c new file mode 100644 index 0000000..1baa94d --- /dev/null +++ b/libft/ft_lstiter.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstiter.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet content); + lst = lst->next; + } +} diff --git a/libft/ft_lstlast.c b/libft/ft_lstlast.c new file mode 100644 index 0000000..ba0d9d7 --- /dev/null +++ b/libft/ft_lstlast.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstlast.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet next != NULL) + lst = lst->next; + return (lst); +} diff --git a/libft/ft_lstmap.c b/libft/ft_lstmap.c new file mode 100644 index 0000000..ed99c7c --- /dev/null +++ b/libft/ft_lstmap.c @@ -0,0 +1,39 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstmap.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet content)); + if (root == NULL) + return (NULL); + last = root; + lst = lst->next; + while (lst != NULL) + { + last->next = ft_lstnew(f(lst->content)); + if (last->next == NULL) + { + ft_lstclear(&root, del); + return (NULL); + } + lst = lst->next; + last = last->next; + } + return (root); +} diff --git a/libft/ft_lstnew.c b/libft/ft_lstnew.c new file mode 100644 index 0000000..705733e --- /dev/null +++ b/libft/ft_lstnew.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstnew.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet next = NULL; + new->content = content; + return (new); +} diff --git a/libft/ft_lstsize.c b/libft/ft_lstsize.c new file mode 100644 index 0000000..fa39de9 --- /dev/null +++ b/libft/ft_lstsize.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstsize.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet next; + } + return (count); +} diff --git a/libft/ft_memchr.c b/libft/ft_memchr.c new file mode 100644 index 0000000..28f3775 --- /dev/null +++ b/libft/ft_memchr.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memchr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet 9) + { + ft_putnbr_fd(n / 10, fd); + ft_putnbr_fd(n % 10, fd); + } + else + ft_putchar_fd(n + 48, fd); +} diff --git a/libft/ft_putstr_fd.c b/libft/ft_putstr_fd.c new file mode 100644 index 0000000..d8c87d2 --- /dev/null +++ b/libft/ft_putstr_fd.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putstr_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = size) + return (ft_strlen(src) + (size)); + return (len_dest + ft_strlcpy(dest + len_dest, src, size - len_dest)); +} diff --git a/libft/ft_strlcpy.c b/libft/ft_strlcpy.c new file mode 100644 index 0000000..677264b --- /dev/null +++ b/libft/ft_strlcpy.c @@ -0,0 +1,28 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strlcpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet + +size_t ft_strlen(const char *s) +{ + size_t length; + + length = 0; + while (s[length]) + length++; + return (length); +} diff --git a/libft/ft_strmapi.c b/libft/ft_strmapi.c new file mode 100644 index 0000000..de9e4a1 --- /dev/null +++ b/libft/ft_strmapi.c @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strmapi.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet 0) + if (s[i] == (char) c) + return ((char *) s + i); + return (NULL); +} diff --git a/libft/ft_strtrim.c b/libft/ft_strtrim.c new file mode 100644 index 0000000..229cb81 --- /dev/null +++ b/libft/ft_strtrim.c @@ -0,0 +1,44 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strtrim.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet len) + size = len; + ptr = malloc((size + 1) * sizeof(char)); + if (ptr == NULL) + return (NULL); + ptr[size] = '\0'; + while (size-- > 0) + ptr[size] = s[start + size]; + return (ptr); +} diff --git a/libft/ft_tolower.c b/libft/ft_tolower.c new file mode 100644 index 0000000..14d83da --- /dev/null +++ b/libft/ft_tolower.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_tolower.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = 'A' && 'Z' >= c)); +} diff --git a/libft/ft_toupper.c b/libft/ft_toupper.c new file mode 100644 index 0000000..3775f6d --- /dev/null +++ b/libft/ft_toupper.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_toupper.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = 'a' && 'z' >= c)); +} diff --git a/libft/libft.h b/libft/libft.h new file mode 100644 index 0000000..83437ae --- /dev/null +++ b/libft/libft.h @@ -0,0 +1,70 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet +# include + +int ft_atoi(const char *nptr); +void ft_bzero(void *s, size_t n); +void *ft_calloc(size_t nmemb, size_t size); +int ft_isalnum(int c); +int ft_isalpha(int c); +int ft_isascii(int c); +int ft_isdigit(int c); +int ft_isprint(int c); +void *ft_memchr(const void *s, int c, size_t n); +int ft_memcmp(const void *s1, const void *s2, size_t n); +void *ft_memcpy(void *dest, const void *src, size_t n); +void *ft_memmove(void *dest, const void *src, size_t n); +void *ft_memset(void *s, int c, size_t n); +char *ft_strchr(const char *s, int c); +char *ft_strdup(const char *s); +size_t ft_strlcat(char *dst, const char *src, size_t size); +size_t ft_strlcpy(char *dst, const char *src, size_t size); +size_t ft_strlen(const char *s); +int ft_strncmp(const char *s1, const char *s2, size_t n); +char *ft_strnstr(const char *big, const char *little, size_t len); +char *ft_strrchr(const char *s, int c); +int ft_tolower(int c); +int ft_toupper(int c); + +char *ft_substr(char const *s, unsigned int start, size_t len); +char *ft_strjoin(char const *s1, char const *s2); +char *ft_strtrim(char const *s1, char const *set); +char **ft_split(char const *s, char c); +char *ft_itoa(int n); +char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); +void ft_striteri(char *s, void (*f)(unsigned int, char*)); +void ft_putchar_fd(char c, int fd); +void ft_putstr_fd(char *s, int fd); +void ft_putendl_fd(char *s, int fd); +void ft_putnbr_fd(int n, int fd); + +typedef struct s_list +{ + void *content; + struct s_list *next; +} t_list; + +t_list *ft_lstnew(void *content); +void ft_lstadd_front(t_list **lst, t_list *new); +int ft_lstsize(t_list *lst); +t_list *ft_lstlast(t_list *lst); +void ft_lstadd_back(t_list **lst, t_list *new); +void ft_lstdelone(t_list *lst, void (*del)(void *)); +void ft_lstclear(t_list **lst, void (*del)(void *)); +void ft_lstiter(t_list *lst, void (*f)(void *)); +t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); + +#endif diff --git a/libftx.h b/libftx.h new file mode 100644 index 0000000..a1f2794 --- /dev/null +++ b/libftx.h @@ -0,0 +1,73 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libftx.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet +# include + +int ft_printf(const char *format, ...); +char *get_next_line(int fd); + +int ft_atoi(const char *nptr); +void ft_bzero(void *s, size_t n); +void *ft_calloc(size_t nmemb, size_t size); +int ft_isalnum(int c); +int ft_isalpha(int c); +int ft_isascii(int c); +int ft_isdigit(int c); +int ft_isprint(int c); +void *ft_memchr(const void *s, int c, size_t n); +int ft_memcmp(const void *s1, const void *s2, size_t n); +void *ft_memcpy(void *dest, const void *src, size_t n); +void *ft_memmove(void *dest, const void *src, size_t n); +void *ft_memset(void *s, int c, size_t n); +char *ft_strchr(const char *s, int c); +char *ft_strdup(const char *s); +size_t ft_strlcat(char *dst, const char *src, size_t size); +size_t ft_strlcpy(char *dst, const char *src, size_t size); +size_t ft_strlen(const char *s); +int ft_strncmp(const char *s1, const char *s2, size_t n); +char *ft_strnstr(const char *big, const char *little, size_t len); +char *ft_strrchr(const char *s, int c); +int ft_tolower(int c); +int ft_toupper(int c); + +char *ft_substr(char const *s, unsigned int start, size_t len); +char *ft_strjoin(char const *s1, char const *s2); +char *ft_strtrim(char const *s1, char const *set); +char **ft_split(char const *s, char c); +char *ft_itoa(int n); +char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); +void ft_striteri(char *s, void (*f)(unsigned int, char*)); +void ft_putchar_fd(char c, int fd); +void ft_putstr_fd(char *s, int fd); +void ft_putendl_fd(char *s, int fd); +void ft_putnbr_fd(int n, int fd); + +typedef struct s_list +{ + void *content; + struct s_list *next; +} t_list; + +t_list *ft_lstnew(void *content); +void ft_lstadd_front(t_list **lst, t_list *nouveau); +int ft_lstsize(t_list *lst); +t_list *ft_lstlast(t_list *lst); +void ft_lstadd_back(t_list **lst, t_list *nouveau); +void ft_lstdelone(t_list *lst, void (*del)(void *)); +void ft_lstclear(t_list **lst, void (*del)(void *)); +void ft_lstiter(t_list *lst, void (*f)(void *)); +t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); + +#endif diff --git a/printf/Makefile b/printf/Makefile new file mode 100644 index 0000000..e134948 --- /dev/null +++ b/printf/Makefile @@ -0,0 +1,36 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: cchauvet base_size - 1) + { + ft_dprintul_base(fd, n / base_size, base); + ft_putchar_fd(fd, base[n % base_size]); + } + else + ft_putchar_fd(fd, base[n]); + return (str_size - 1); +} diff --git a/printf/ft_dprintx.c b/printf/ft_dprintx.c new file mode 100644 index 0000000..6d6de6e --- /dev/null +++ b/printf/ft_dprintx.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_dprintx.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet = '0') + return (1); + return (0); +} diff --git a/printf/ft_printf.c b/printf/ft_printf.c new file mode 100644 index 0000000..80cedbe --- /dev/null +++ b/printf/ft_printf.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_printf.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet +# include + +size_t ft_strlen(const char *s); +char *ft_strchr(const char *s, int c); +int ft_isdigit(int c); +int ft_skipflag(const char *str); +int ft_isarg(int c); + +int ft_dprintptr(int fd, void *ptr); +int ft_dprintl_base(int fd, long long n, char *base); +int ft_dprintul_base(int fd, unsigned long long n, char *base); +int ft_dprintul(int fd, unsigned long long n); +int ft_dprintx(int fd, unsigned int n); +int ft_dprint_upperx(int fd, unsigned int n); +int ft_dprintflag(int fd, const char *flag, va_list va); +int ft_dprintarg(int fd, int c, va_list va); + +int ft_printf(const char *format, ...); + +int ft_vdprintf(int fd, const char *format, va_list va); + +int ft_putchar_fd(int fd, char c); +int ft_putstr_fd(int fd, char *str); + +#endif diff --git a/printf/ft_putchar_fd.c b/printf/ft_putchar_fd.c new file mode 100644 index 0000000..d509e9c --- /dev/null +++ b/printf/ft_putchar_fd.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putchar_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cchauvet `bRY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