nicolas-arnaud
2 years ago
14 changed files with 455 additions and 102 deletions
@ -0,0 +1,130 @@ |
|||
[ |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_printf.p.o", |
|||
"srcs/ft_printf.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_printf.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_printf.p.o" |
|||
}, |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_print_chars.p.o", |
|||
"srcs/ft_print_chars.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_print_chars.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_print_chars.p.o" |
|||
}, |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_print_hexs.p.o", |
|||
"srcs/ft_print_hexs.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_print_hexs.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_print_hexs.p.o" |
|||
}, |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_print_nbrs.p.o", |
|||
"srcs/ft_print_nbrs.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_print_nbrs.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_print_nbrs.p.o" |
|||
}, |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_print_opts.p.o", |
|||
"srcs/ft_print_opts.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_print_opts.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_print_opts.p.o" |
|||
}, |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_print_ptrs.p.o", |
|||
"srcs/ft_print_ptrs.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_print_ptrs.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_print_ptrs.p.o" |
|||
}, |
|||
{ |
|||
"arguments": [ |
|||
"/usr/bin/gcc", |
|||
"-Werror", |
|||
"-Wall", |
|||
"-Wextra", |
|||
"-c", |
|||
"-g", |
|||
"-D", |
|||
"FPRINTF", |
|||
"-I", |
|||
"includes", |
|||
"-o", |
|||
"srcs/ft_printf.f.o", |
|||
"srcs/ft_printf.c" |
|||
], |
|||
"directory": "/home/nicolas/Development/ft_printf", |
|||
"file": "/home/nicolas/Development/ft_printf/srcs/ft_printf.c", |
|||
"output": "/home/nicolas/Development/ft_printf/srcs/ft_printf.f.o" |
|||
} |
|||
] |
@ -0,0 +1,110 @@ |
|||
/* ************************************************************************** */ |
|||
/* */ |
|||
/* ::: :::::::: */ |
|||
/* libft.h :+: :+: :+: */ |
|||
/* +:+ +:+ +:+ */ |
|||
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
|||
/* +#+#+#+#+#+ +#+ */ |
|||
/* Created: 2021/10/19 14:42:45 by narnaud #+# #+# */ |
|||
/* Updated: 2022/05/18 16:25:27 by narnaud@stude ### ########.fr */ |
|||
/* */ |
|||
/* ************************************************************************** */ |
|||
|
|||
#pragma once |
|||
|
|||
# include <stddef.h> |
|||
# include <stdlib.h> |
|||
# include <unistd.h> |
|||
|
|||
typedef struct s_slist |
|||
{ |
|||
void *content; |
|||
struct s_slist *next; |
|||
} t_slist; |
|||
|
|||
typedef struct s_i_slist |
|||
{ |
|||
int nb; |
|||
struct s_i_slist *next; |
|||
} t_i_slist; |
|||
|
|||
typedef struct s_dlist |
|||
{ |
|||
void *content; |
|||
size_t size; |
|||
struct s_dlist *next; |
|||
struct s_dlist *previous; |
|||
} t_dlist; |
|||
|
|||
int ft_atoi(const char *str); |
|||
void ft_bzero(void *s, size_t n); |
|||
void *ft_calloc( size_t num, size_t size ); |
|||
int ft_isalpha(int ch); |
|||
int ft_isascii(int ch); |
|||
int ft_isdigit(int ch); |
|||
int ft_isprint(int ch); |
|||
int ft_isalnum(int ch); |
|||
int ft_isspace(int ch); |
|||
int ft_isnumber(char *str); |
|||
void *ft_memchr(const void *b, int c, size_t n); |
|||
int ft_memcmp(const void *s1, const void *s2, size_t n); |
|||
void *ft_memcpy(void *dst, const void *src, size_t n); |
|||
void *ft_memmove(void *dst, const void *src, size_t n); |
|||
void ft_free_split(char **split); |
|||
|
|||
size_t ft_ilen(int nbr); |
|||
size_t ft_ulen(unsigned int nbr); |
|||
size_t ft_longbaselen(long nbr, size_t base); |
|||
int ft_croissant(int a, int b); |
|||
int ft_decroissant(int a, int b); |
|||
int ft_max(int a, int b); |
|||
int ft_min(int a, int b); |
|||
|
|||
void *ft_memset(void *b, int c, size_t len); |
|||
char *ft_strchr(const char *s, int c); |
|||
char *ft_strdup(const char *src); |
|||
size_t ft_strlcat(char *dst, const char *src, size_t dstsize); |
|||
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize); |
|||
size_t ft_strlen(const char *s); |
|||
size_t ft_strlen_to(const char *str, char ch); |
|||
int ft_strncmp(const char *s1, const char *s2, size_t n); |
|||
char *ft_strnstr(const char *haystack, const char *needle, size_t len); |
|||
char *ft_strrchr(const char *s, int c); |
|||
void ft_strrev(char **str, unsigned int neg); |
|||
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(const char *s1, const char *s2); |
|||
char *ft_strjoin_with(char *s1, char *s2, char *inter); |
|||
char *ft_strtrim(char const *s1, char const *set); |
|||
char **ft_split(char const *str, char ch); |
|||
char *ft_itoa(int n); |
|||
char *ft_itox(unsigned long n, const char *base); |
|||
char *ft_utoa(unsigned 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_putnstr_fd(size_t n, char *s, int fd); |
|||
void ft_putendl_fd(char *s, int fd); |
|||
void ft_putnbr_fd(int n, int fd); |
|||
char *ft_append(char *s1, char *s2); |
|||
char *ft_strnew(int n, char c); |
|||
|
|||
t_slist *ft_slst_new(void *content); |
|||
void ft_slst_add_front(t_slist **alst, t_slist *new_e); |
|||
int ft_slst_size(t_slist *lst); |
|||
t_slist *ft_slst_last(t_slist *lst); |
|||
void ft_slst_add_back(t_slist **alst, t_slist *new_e); |
|||
void ft_slst_delone(t_slist *lst, void (*del)(void *)); |
|||
void ft_slst_clear(t_slist **lst, void (*del)(void *)); |
|||
void ft_slst_iter(t_slist *lst, void (*f)(void *)); |
|||
t_slist *ft_slst_map(t_slist *lst, void *(*f)(void *), void (*del)(void *)); |
|||
|
|||
size_t ft_ilst_first(t_i_slist *lst, int (*fct)(int a, int b)); |
|||
void ft_ilst_free(t_i_slist *list); |
|||
int ft_ilst_is_in(int value, t_i_slist lst); |
|||
|
|||
t_dlist *ft_dlst_add(t_dlist *prev, void *content); |
|||
t_dlist *ft_dlst_n(t_dlist *lst, size_t n); |
|||
char **ft_dlst_to_arr(t_dlist *ptr); |
@ -1 +1 @@ |
|||
Subproject commit 91542393af2673f7cba570fc4b868294810f1abc |
|||
Subproject commit 824c048555039c45207bd153a2333a1c2e2174a2 |
@ -0,0 +1,45 @@ |
|||
/* ************************************************************************** */ |
|||
/* */ |
|||
/* ::: :::::::: */ |
|||
/* ft_print_strings.c :+: :+: :+: */ |
|||
/* +:+ +:+ +:+ */ |
|||
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
|||
/* +#+#+#+#+#+ +#+ */ |
|||
/* Created: 2021/10/27 08:09:49 by narnaud #+# #+# */ |
|||
/* Updated: 2021/11/17 09:40:16 by narnaud ### ########.fr */ |
|||
/* */ |
|||
/* ************************************************************************** */ |
|||
|
|||
#include "ft_printf.h" |
|||
|
|||
static t_dlist *list = NULL; |
|||
|
|||
void add_string(char *str, size_t size) |
|||
{ |
|||
list = ft_dlst_add(list, str); |
|||
list->size = size; |
|||
} |
|||
|
|||
t_dlist *get_last(void) |
|||
{ |
|||
return list; |
|||
} |
|||
|
|||
t_dlist *get_first(void) |
|||
{ |
|||
t_dlist *tmp = list; |
|||
while (tmp->previous) |
|||
tmp = tmp->previous; |
|||
return tmp; |
|||
} |
|||
|
|||
void clean_list(void) |
|||
{ |
|||
while (list) |
|||
{ |
|||
free(list->content); |
|||
free(list); |
|||
list = list->previous; |
|||
} |
|||
list = NULL; |
|||
} |
Loading…
Reference in new issue