diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 0eea3a1..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.Makefile.swn b/.Makefile.swn deleted file mode 100644 index 960de40..0000000 Binary files a/.Makefile.swn and /dev/null differ diff --git a/.Makefile.swo b/.Makefile.swo deleted file mode 100644 index d86cddc..0000000 Binary files a/.Makefile.swo and /dev/null differ diff --git a/.Makefile.swp b/.Makefile.swp deleted file mode 100644 index e533034..0000000 Binary files a/.Makefile.swp and /dev/null differ diff --git a/Makefile b/Makefile index 22f712f..ac940e7 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ CFLAGS += -Wall -Wextra -Werror SRCS = ft_memset.c \ ft_bzero.c \ ft_memcpy.c \ + ft_memccpy.c \ ft_memmove.c \ ft_memchr.c \ ft_memcmp.c \ @@ -38,8 +39,8 @@ SRCS = ft_memset.c \ ft_strlcat.c \ ft_strnstr.c \ ft_atoi.c \ - ft_strdup.c \ ft_calloc.c \ + ft_strdup.c \ \ ft_substr.c \ ft_strjoin.c \ @@ -56,12 +57,12 @@ ODIR = ./builds OBJS = $(SRCS:%.c=$(ODIR)/%.o) SRCB = ft_lstnew.c \ - ft_lstadd.c \ + ft_lstadd_front.c \ ft_lstsize \ ft_lstlast \ ft_lstadd_back \ ft_lstdelone.c \ - ft_lstdel.c \ + ft_lstclear.c \ ft_lstiter.c \ ft_lstmap.c \ \ @@ -81,7 +82,6 @@ SRCB = ft_lstnew.c \ ft_strnequ.c \ ft_strnew.c \ ft_memalloc.c \ - ft_memccpy.c \ ft_memdel.c \ ft_putchar.c \ ft_putendl.c \ diff --git a/OLDMakefile b/OLDMakefile deleted file mode 100644 index 6f1cbeb..0000000 --- a/OLDMakefile +++ /dev/null @@ -1,223 +0,0 @@ -## -# # ------------------------------------------------------ -# # utiliser le makefile pour creer une librairie statique -# # ------------------------------------------------------ -## -## -## - - - - - - - - -## compiler des .o -## - - - - - - - - -## -## -## quand on ecrit un programme il contient un main et les -## fonctions dont le main a besoin (ex ft_putchar) : -## -### #include -### -### void ft_putchar(char c) -### { -### write(1, &c, 1); -### } -### -### int main() -### { -### ft_putchar('0'); -### return (0); -### } -## -## on peut compiler ce fichier avec gcc en faisant : -## gcc file.c -## et ca sort un executable a.out -## si on l'execute "./a.out" ca ecrit 0 dans la console -## -## mais pour ne pas reecrire a chaque fois ft_putchar -## on peut la mettre dans une librairie qu'on inclue dans -## le fichier qui l'utilise... -## si on sort ft_putchar du fichier : -## -### int main() -### { -### ft_putchar('0'); -### return (0); -### } -## -## et qu'on l'execute "gcc file.c" on va avoir une erreur -## car file.c utilise ft_putchar mais gcc ne sait pas ce -## que c'est, donc il faut qu'on le rajoute a la compilation -## on peut par exemple l'ecrire dans un fichier ft_putchar.c -## -### #include -### -### void ft_putchar(char c) -### { -### write(1, &c, 1); -### } -## -## et compiler les deux : -## gcc file.c ft_putchar.c -## -## ca fonctionne mais gcc doit a chaque fois recompiler -## ft_putchar.c alors qu'il n'est pas modifie, donc on peut -## le compiler une bonne fois pour toute et le rajouter a la -## compilation finale quand on en a besoin sans que l'ordi -## ait a tout retraduire dans son langage -## -## mais si on essaye de compiler ft_putchar seul -## gcc ft_putchar.c -## ca nous donne une erreur car pour compiler, gcc a besoin -## de trouver un main ! -## -## on va donc utiliser l'option -c pour -## creer une fichier objet .o qui est deja traduit en langue -## d'ordinateur et pret a etre rajoute a la compilation : -## gcc -c ft_putchar.c --> donne ft_putchar.o -## qu'on peut compiler avec le fichier qui contient le main : -## -## gcc file.c ft_putchar.o -## -## on a nos bouts de codes comme ft_putchar.o dans des fichiers -## objets prets a etre ajoutes a la compilation du main -## -## on va maintenant voir comment faire une libraire qui contien -## tous nos fichiers objets -## -## -## - - - - - - - - -## creer une lib.a -## - - - - - - - - -## -## -## pour mettre tous les fichiers .o dans un seul fichier .a -## on utilise un programme d'archive ar avec les options rc -## r indique d'inserer les .o en remplacant si necessaire -## c de creer une nouvelle archive -## le nom de l'archive doit commencer par lib et finir en .a : -## ar rc nom_de_l'archive fichier_1.o fichier_2.o etc -## -## ar rc libtest.a ft_putchar.o -## -## on obtient un fichier libtest.a qui contient les fichiers -## objets .o -## -## on peut l'utiliser a la compilation de cette manniere : -## -## gcc file.c -L. -ltest -## -## -L indique ou est la librairie (ici elle est dans le -## dossier courant .) -## -l indique son nom ("test" car on n'indique pas lib et .a) -## -## -# # ----------------------------------------------- -# # ecrire un make file pour aider a la compilation -# # ----------------------------------------------- -## -## -## exemple d'un makefilede basic -## -### NAME = libtest.h -### CC = gcc -### CFLAGS = -I. -c -### SRCS = example01.c \ -### example02.c -### OBJ = $(SRCS:.c=.o) |ecrit les fichiers .c en .o -### -### all: $(NAME) |make execute sa premiere regle NAME -### $(NAME): $(OBJ) |NAME execute d'abord OBJ -### ar -rc $@ $< | -## -## Make a des built-in pattern rules : -## https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html -## par exemple pour construire des .o a partir de .c -## qui sont utilisees par défaut si les variables -## sont bien nomee (genre CC ou CFLAGS) -## -## cependant si on veut mettre les fichiers .o dans un -## sous-fichier BUILDS il n'y a pas de built-in pattern -## il faut donc l'ecrire nous-meme : -## -### NAME = libtest.h -### CC = gcc -### CFLAGS = -I. -### SRCS = example01.c \ -### example02.c -### ODIR = ./builds -### OBJS = $(addprefix $(ODIR)/, $(SRCS:.c=.o)) -### -### all: $(NAME) -### $(NAME): $(OBJS) -### ar -rc $@ $< -### -### $(ODIR)/%.o : %.c -### $(COMPILE.c) -o $@ $< -## -## cette regle est appellee par $(OBJS) puisque -## cette variable appelle la regle $(ODIR/file.o) -## -## COMPILE est une built-in variable qui execute -## les regles CC et CFLAGS avec l'option -c -## -## % = "tout" -## $@ = "la valeur a gauche de :" -## $< = "la premiere valeur a droite de :" -## $^ = "toutes les valeurs a droite de :" -## -## - - -# ----------------------------------------------------------- # -# # -# variables modifiables # -# # -# ----------------------------------------------------------- # - -NAME = libft.a - -DEPS = libft.h - -SDIR = ./src -ODIR = ./build -IDIR = ./includes - -CC = gcc -CFLAGS = -Wall -Wextra -Werror -I$(IDIR) - - -# ----------------------------------------------------------- # -# # -# ne pas modifier en dessous # -# # -# ----------------------------------------------------------- # - -## SUB_SDIR sera utilise pour creer les sous dossiers : -## avec mkdir -p ODIR/subdir1 ODIR/subdir2 ODIR/subdir3 etc... -## find $(SDIR) cherche recursivement tous le contenu de SDIR -## -type d ne trouve que les dossiers, pas les fichiers -## -mindepth 1 ne liste pas le dossier SDIR -## subst transform arg1 en arg2 dans arg3 - -SUB_SDIR = $(shell find $(SDIR) -mindepth 1 -type d) -SRC = $(shell find $(SDIR) -type f -not -name '.*' -name '*.c') -OBJ = $(subst $(SDIR), $(ODIR), $(SRC:.c=.o)) - -all: $(ODIR) $(NAME) - -$(ODIR): - mkdir -p $(subst $(SDIR), $(ODIR), $(SUB_SDIR)) - -$(ODIR)/%.o: $(SDIR)/%.c - $(COMPILE.c) -o $@ $< - -$(NAME): $(OBJ) - ar -rc $@ $^ - @ranlib $@ - -clean: - /bin/rm -rf $(ODIR) - -fclean: clean - /bin/rm -f $(NAME) - -re: fclean all - -.PHONY: clean diff --git a/OLDauteur b/OLDauteur deleted file mode 100644 index a9ee745..0000000 --- a/OLDauteur +++ /dev/null @@ -1 +0,0 @@ -hulamy diff --git a/OLDbuild/is/ft_isalnum.o b/OLDbuild/is/ft_isalnum.o deleted file mode 100644 index c550def..0000000 Binary files a/OLDbuild/is/ft_isalnum.o and /dev/null differ diff --git a/OLDbuild/is/ft_isalpha.o b/OLDbuild/is/ft_isalpha.o deleted file mode 100644 index 00aa3a5..0000000 Binary files a/OLDbuild/is/ft_isalpha.o and /dev/null differ diff --git a/OLDbuild/is/ft_isascii.o b/OLDbuild/is/ft_isascii.o deleted file mode 100644 index 284f168..0000000 Binary files a/OLDbuild/is/ft_isascii.o and /dev/null differ diff --git a/OLDbuild/is/ft_isdigit.o b/OLDbuild/is/ft_isdigit.o deleted file mode 100644 index 234b69f..0000000 Binary files a/OLDbuild/is/ft_isdigit.o and /dev/null differ diff --git a/OLDbuild/is/ft_isprint.o b/OLDbuild/is/ft_isprint.o deleted file mode 100644 index 9b508d1..0000000 Binary files a/OLDbuild/is/ft_isprint.o and /dev/null differ diff --git a/OLDbuild/is/ft_issort.o b/OLDbuild/is/ft_issort.o deleted file mode 100644 index e2f1c64..0000000 Binary files a/OLDbuild/is/ft_issort.o and /dev/null differ diff --git a/OLDbuild/lst/ft_lstadd.o b/OLDbuild/lst/ft_lstadd.o deleted file mode 100644 index b92ce3f..0000000 Binary files a/OLDbuild/lst/ft_lstadd.o and /dev/null differ diff --git a/OLDbuild/lst/ft_lstdel.o b/OLDbuild/lst/ft_lstdel.o deleted file mode 100644 index 279aef0..0000000 Binary files a/OLDbuild/lst/ft_lstdel.o and /dev/null differ diff --git a/OLDbuild/lst/ft_lstdelone.o b/OLDbuild/lst/ft_lstdelone.o deleted file mode 100644 index 63ded3c..0000000 Binary files a/OLDbuild/lst/ft_lstdelone.o and /dev/null differ diff --git a/OLDbuild/lst/ft_lstiter.o b/OLDbuild/lst/ft_lstiter.o deleted file mode 100644 index 5e63e80..0000000 Binary files a/OLDbuild/lst/ft_lstiter.o and /dev/null differ diff --git a/OLDbuild/lst/ft_lstmap.o b/OLDbuild/lst/ft_lstmap.o deleted file mode 100644 index 328a1b9..0000000 Binary files a/OLDbuild/lst/ft_lstmap.o and /dev/null differ diff --git a/OLDbuild/lst/ft_lstnew.o b/OLDbuild/lst/ft_lstnew.o deleted file mode 100644 index f07afea..0000000 Binary files a/OLDbuild/lst/ft_lstnew.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memalloc.o b/OLDbuild/mem/ft_memalloc.o deleted file mode 100644 index 6fb3851..0000000 Binary files a/OLDbuild/mem/ft_memalloc.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memccpy.o b/OLDbuild/mem/ft_memccpy.o deleted file mode 100644 index 649106a..0000000 Binary files a/OLDbuild/mem/ft_memccpy.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memchr.o b/OLDbuild/mem/ft_memchr.o deleted file mode 100644 index af28ef4..0000000 Binary files a/OLDbuild/mem/ft_memchr.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memcmp.o b/OLDbuild/mem/ft_memcmp.o deleted file mode 100644 index 9b0bab0..0000000 Binary files a/OLDbuild/mem/ft_memcmp.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memcpy.o b/OLDbuild/mem/ft_memcpy.o deleted file mode 100644 index 98c19e4..0000000 Binary files a/OLDbuild/mem/ft_memcpy.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memdel.o b/OLDbuild/mem/ft_memdel.o deleted file mode 100644 index 3e3bdc3..0000000 Binary files a/OLDbuild/mem/ft_memdel.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memmove.o b/OLDbuild/mem/ft_memmove.o deleted file mode 100644 index 9a50bd1..0000000 Binary files a/OLDbuild/mem/ft_memmove.o and /dev/null differ diff --git a/OLDbuild/mem/ft_memset.o b/OLDbuild/mem/ft_memset.o deleted file mode 100644 index a09db88..0000000 Binary files a/OLDbuild/mem/ft_memset.o and /dev/null differ diff --git a/OLDbuild/put/ft_putchar.o b/OLDbuild/put/ft_putchar.o deleted file mode 100644 index 7c11af6..0000000 Binary files a/OLDbuild/put/ft_putchar.o and /dev/null differ diff --git a/OLDbuild/put/ft_putchar_fd.o b/OLDbuild/put/ft_putchar_fd.o deleted file mode 100644 index 6726c55..0000000 Binary files a/OLDbuild/put/ft_putchar_fd.o and /dev/null differ diff --git a/OLDbuild/put/ft_putendl.o b/OLDbuild/put/ft_putendl.o deleted file mode 100644 index 340001a..0000000 Binary files a/OLDbuild/put/ft_putendl.o and /dev/null differ diff --git a/OLDbuild/put/ft_putendl_fd.o b/OLDbuild/put/ft_putendl_fd.o deleted file mode 100644 index 35db2d0..0000000 Binary files a/OLDbuild/put/ft_putendl_fd.o and /dev/null differ diff --git a/OLDbuild/put/ft_putnbr.o b/OLDbuild/put/ft_putnbr.o deleted file mode 100644 index f8b58de..0000000 Binary files a/OLDbuild/put/ft_putnbr.o and /dev/null differ diff --git a/OLDbuild/put/ft_putnbr_fd.o b/OLDbuild/put/ft_putnbr_fd.o deleted file mode 100644 index a9f3813..0000000 Binary files a/OLDbuild/put/ft_putnbr_fd.o and /dev/null differ diff --git a/OLDbuild/put/ft_putnbrbase.o b/OLDbuild/put/ft_putnbrbase.o deleted file mode 100644 index d36722a..0000000 Binary files a/OLDbuild/put/ft_putnbrbase.o and /dev/null differ diff --git a/OLDbuild/put/ft_putnbrendl.o b/OLDbuild/put/ft_putnbrendl.o deleted file mode 100644 index fa72cc7..0000000 Binary files a/OLDbuild/put/ft_putnbrendl.o and /dev/null differ diff --git a/OLDbuild/put/ft_putnbrendl_fd.o b/OLDbuild/put/ft_putnbrendl_fd.o deleted file mode 100644 index 34b1edb..0000000 Binary files a/OLDbuild/put/ft_putnbrendl_fd.o and /dev/null differ diff --git a/OLDbuild/put/ft_putstr.o b/OLDbuild/put/ft_putstr.o deleted file mode 100644 index 726aac0..0000000 Binary files a/OLDbuild/put/ft_putstr.o and /dev/null differ diff --git a/OLDbuild/put/ft_putstr_fd.o b/OLDbuild/put/ft_putstr_fd.o deleted file mode 100644 index 32f5e62..0000000 Binary files a/OLDbuild/put/ft_putstr_fd.o and /dev/null differ diff --git a/OLDbuild/str/ft_strcat.o b/OLDbuild/str/ft_strcat.o deleted file mode 100644 index 958cb0d..0000000 Binary files a/OLDbuild/str/ft_strcat.o and /dev/null differ diff --git a/OLDbuild/str/ft_strchr.o b/OLDbuild/str/ft_strchr.o deleted file mode 100644 index 0ddb557..0000000 Binary files a/OLDbuild/str/ft_strchr.o and /dev/null differ diff --git a/OLDbuild/str/ft_strclr.o b/OLDbuild/str/ft_strclr.o deleted file mode 100644 index 95256bc..0000000 Binary files a/OLDbuild/str/ft_strclr.o and /dev/null differ diff --git a/OLDbuild/str/ft_strcmp.o b/OLDbuild/str/ft_strcmp.o deleted file mode 100644 index 58b8dc1..0000000 Binary files a/OLDbuild/str/ft_strcmp.o and /dev/null differ diff --git a/OLDbuild/str/ft_strcpy.o b/OLDbuild/str/ft_strcpy.o deleted file mode 100644 index 3a2f41a..0000000 Binary files a/OLDbuild/str/ft_strcpy.o and /dev/null differ diff --git a/OLDbuild/str/ft_strdel.o b/OLDbuild/str/ft_strdel.o deleted file mode 100644 index e566359..0000000 Binary files a/OLDbuild/str/ft_strdel.o and /dev/null differ diff --git a/OLDbuild/str/ft_strdup.o b/OLDbuild/str/ft_strdup.o deleted file mode 100644 index 7b78c32..0000000 Binary files a/OLDbuild/str/ft_strdup.o and /dev/null differ diff --git a/OLDbuild/str/ft_strequ.o b/OLDbuild/str/ft_strequ.o deleted file mode 100644 index d64fc08..0000000 Binary files a/OLDbuild/str/ft_strequ.o and /dev/null differ diff --git a/OLDbuild/str/ft_striter.o b/OLDbuild/str/ft_striter.o deleted file mode 100644 index f138a56..0000000 Binary files a/OLDbuild/str/ft_striter.o and /dev/null differ diff --git a/OLDbuild/str/ft_striteri.o b/OLDbuild/str/ft_striteri.o deleted file mode 100644 index b8b5b88..0000000 Binary files a/OLDbuild/str/ft_striteri.o and /dev/null differ diff --git a/OLDbuild/str/ft_strjoin.o b/OLDbuild/str/ft_strjoin.o deleted file mode 100644 index dd28e10..0000000 Binary files a/OLDbuild/str/ft_strjoin.o and /dev/null differ diff --git a/OLDbuild/str/ft_strjoinfree.o b/OLDbuild/str/ft_strjoinfree.o deleted file mode 100644 index 2830e74..0000000 Binary files a/OLDbuild/str/ft_strjoinfree.o and /dev/null differ diff --git a/OLDbuild/str/ft_strlcat.o b/OLDbuild/str/ft_strlcat.o deleted file mode 100644 index 5a7fdb0..0000000 Binary files a/OLDbuild/str/ft_strlcat.o and /dev/null differ diff --git a/OLDbuild/str/ft_strlen.o b/OLDbuild/str/ft_strlen.o deleted file mode 100644 index 6d73d1f..0000000 Binary files a/OLDbuild/str/ft_strlen.o and /dev/null differ diff --git a/OLDbuild/str/ft_strmap.o b/OLDbuild/str/ft_strmap.o deleted file mode 100644 index 81a08b4..0000000 Binary files a/OLDbuild/str/ft_strmap.o and /dev/null differ diff --git a/OLDbuild/str/ft_strmapi.o b/OLDbuild/str/ft_strmapi.o deleted file mode 100644 index 9143813..0000000 Binary files a/OLDbuild/str/ft_strmapi.o and /dev/null differ diff --git a/OLDbuild/str/ft_strmultisplit.o b/OLDbuild/str/ft_strmultisplit.o deleted file mode 100644 index 0ff102e..0000000 Binary files a/OLDbuild/str/ft_strmultisplit.o and /dev/null differ diff --git a/OLDbuild/str/ft_strncat.o b/OLDbuild/str/ft_strncat.o deleted file mode 100644 index eb4bd76..0000000 Binary files a/OLDbuild/str/ft_strncat.o and /dev/null differ diff --git a/OLDbuild/str/ft_strncmp.o b/OLDbuild/str/ft_strncmp.o deleted file mode 100644 index 8a7d822..0000000 Binary files a/OLDbuild/str/ft_strncmp.o and /dev/null differ diff --git a/OLDbuild/str/ft_strncpy.o b/OLDbuild/str/ft_strncpy.o deleted file mode 100644 index bfa5b87..0000000 Binary files a/OLDbuild/str/ft_strncpy.o and /dev/null differ diff --git a/OLDbuild/str/ft_strnequ.o b/OLDbuild/str/ft_strnequ.o deleted file mode 100644 index a88b721..0000000 Binary files a/OLDbuild/str/ft_strnequ.o and /dev/null differ diff --git a/OLDbuild/str/ft_strnew.o b/OLDbuild/str/ft_strnew.o deleted file mode 100644 index 492623c..0000000 Binary files a/OLDbuild/str/ft_strnew.o and /dev/null differ diff --git a/OLDbuild/str/ft_strnstr.o b/OLDbuild/str/ft_strnstr.o deleted file mode 100644 index 3dfa322..0000000 Binary files a/OLDbuild/str/ft_strnstr.o and /dev/null differ diff --git a/OLDbuild/str/ft_strrchr.o b/OLDbuild/str/ft_strrchr.o deleted file mode 100644 index 71650b4..0000000 Binary files a/OLDbuild/str/ft_strrchr.o and /dev/null differ diff --git a/OLDbuild/str/ft_strsplit.o b/OLDbuild/str/ft_strsplit.o deleted file mode 100644 index 6bd50aa..0000000 Binary files a/OLDbuild/str/ft_strsplit.o and /dev/null differ diff --git a/OLDbuild/str/ft_strstr.o b/OLDbuild/str/ft_strstr.o deleted file mode 100644 index 3d16449..0000000 Binary files a/OLDbuild/str/ft_strstr.o and /dev/null differ diff --git a/OLDbuild/str/ft_strsub.o b/OLDbuild/str/ft_strsub.o deleted file mode 100644 index 83424c8..0000000 Binary files a/OLDbuild/str/ft_strsub.o and /dev/null differ diff --git a/OLDbuild/str/ft_strtrim.o b/OLDbuild/str/ft_strtrim.o deleted file mode 100644 index 26619e8..0000000 Binary files a/OLDbuild/str/ft_strtrim.o and /dev/null differ diff --git a/OLDbuild/tab/ft_any.o b/OLDbuild/tab/ft_any.o deleted file mode 100644 index 707de11..0000000 Binary files a/OLDbuild/tab/ft_any.o and /dev/null differ diff --git a/OLDbuild/tab/ft_arraymap.o b/OLDbuild/tab/ft_arraymap.o deleted file mode 100644 index 3dabc9a..0000000 Binary files a/OLDbuild/tab/ft_arraymap.o and /dev/null differ diff --git a/OLDbuild/tab/ft_foreach.o b/OLDbuild/tab/ft_foreach.o deleted file mode 100644 index fcb885b..0000000 Binary files a/OLDbuild/tab/ft_foreach.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_atoi.o b/OLDbuild/trsf/ft_atoi.o deleted file mode 100644 index 1448cce..0000000 Binary files a/OLDbuild/trsf/ft_atoi.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_atoibase.o b/OLDbuild/trsf/ft_atoibase.o deleted file mode 100644 index 39d22e7..0000000 Binary files a/OLDbuild/trsf/ft_atoibase.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_bzero.o b/OLDbuild/trsf/ft_bzero.o deleted file mode 100644 index d7962b2..0000000 Binary files a/OLDbuild/trsf/ft_bzero.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_convertbase.o b/OLDbuild/trsf/ft_convertbase.o deleted file mode 100644 index f742d92..0000000 Binary files a/OLDbuild/trsf/ft_convertbase.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_itoa.o b/OLDbuild/trsf/ft_itoa.o deleted file mode 100644 index bc455fd..0000000 Binary files a/OLDbuild/trsf/ft_itoa.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_tolower.o b/OLDbuild/trsf/ft_tolower.o deleted file mode 100644 index 44af047..0000000 Binary files a/OLDbuild/trsf/ft_tolower.o and /dev/null differ diff --git a/OLDbuild/trsf/ft_toupper.o b/OLDbuild/trsf/ft_toupper.o deleted file mode 100644 index 3a5a4c5..0000000 Binary files a/OLDbuild/trsf/ft_toupper.o and /dev/null differ diff --git a/OLDlibft.a b/OLDlibft.a deleted file mode 100644 index 4c900aa..0000000 Binary files a/OLDlibft.a and /dev/null differ diff --git a/OLDlibft.fr.pdf b/OLDlibft.fr.pdf deleted file mode 100644 index fdf8bbe..0000000 Binary files a/OLDlibft.fr.pdf and /dev/null differ diff --git a/OLDsrc/is/ft_isalnum.c b/OLDsrc/is/ft_isalnum.c deleted file mode 100644 index 21bfad0..0000000 --- a/OLDsrc/is/ft_isalnum.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isalnum.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:09:33 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:09:37 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isalnum(int c) -{ - return (ft_isalpha(c) || ft_isdigit(c)); -} diff --git a/OLDsrc/is/ft_isalpha.c b/OLDsrc/is/ft_isalpha.c deleted file mode 100644 index b754b0b..0000000 --- a/OLDsrc/is/ft_isalpha.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isalpha.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:09:44 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:09:46 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isalpha(int c) -{ - return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); -} diff --git a/OLDsrc/is/ft_isascii.c b/OLDsrc/is/ft_isascii.c deleted file mode 100644 index 054f504..0000000 --- a/OLDsrc/is/ft_isascii.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isascii.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:09:53 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:09:55 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isascii(int c) -{ - return (c >= 0 && c <= 127); -} diff --git a/OLDsrc/is/ft_isdigit.c b/OLDsrc/is/ft_isdigit.c deleted file mode 100644 index 1dd5840..0000000 --- a/OLDsrc/is/ft_isdigit.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isdigit.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:10:01 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:10:05 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isdigit(int c) -{ - return (c >= '0' && c <= '9'); -} diff --git a/OLDsrc/is/ft_isprint.c b/OLDsrc/is/ft_isprint.c deleted file mode 100644 index f45cbaf..0000000 --- a/OLDsrc/is/ft_isprint.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isprint.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:10:19 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:10:20 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isprint(int c) -{ - return (c >= 32 && c < 127); -} diff --git a/OLDsrc/is/ft_issort.c b/OLDsrc/is/ft_issort.c deleted file mode 100644 index 842195b..0000000 --- a/OLDsrc/is/ft_issort.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_issort.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:18:14 by hulamy #+# #+# */ -/* Updated: 2018/11/16 15:18:15 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_issort(int *tab, int length, int (*f)(int, int)) -{ - int i; - - i = -1; - if (!tab) - return (0); - while (++i < length - 1) - if (f(tab[i], tab[i + 1]) > 0) - return (0); - return (1); -} diff --git a/OLDsrc/lst/ft_lstadd.c b/OLDsrc/lst/ft_lstadd.c deleted file mode 100644 index d0bed31..0000000 --- a/OLDsrc/lst/ft_lstadd.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstadd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:10:33 by hulamy #+# #+# */ -/* Updated: 2018/11/16 13:58:54 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_lstadd(t_list **alst, t_list *new) -{ - new->next = *alst; - *alst = new; -} diff --git a/OLDsrc/lst/ft_lstdel.c b/OLDsrc/lst/ft_lstdel.c deleted file mode 100644 index bbe792d..0000000 --- a/OLDsrc/lst/ft_lstdel.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstdel.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:10:49 by hulamy #+# #+# */ -/* Updated: 2018/11/16 13:59:10 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) -{ - if ((*alst)->next) - ft_lstdel(&(*alst)->next, del); - ft_lstdelone(alst, del); -} diff --git a/OLDsrc/lst/ft_lstdelone.c b/OLDsrc/lst/ft_lstdelone.c deleted file mode 100644 index e2b85c2..0000000 --- a/OLDsrc/lst/ft_lstdelone.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstdelone.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:10:59 by hulamy #+# #+# */ -/* Updated: 2018/11/16 13:59:22 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)) -{ - del((*alst)->content, (*alst)->content_size); - free(*alst); - *alst = NULL; -} diff --git a/OLDsrc/lst/ft_lstiter.c b/OLDsrc/lst/ft_lstiter.c deleted file mode 100644 index 0f791be..0000000 --- a/OLDsrc/lst/ft_lstiter.c +++ /dev/null @@ -1,22 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstiter.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:11:14 by hulamy #+# #+# */ -/* Updated: 2018/11/16 14:01:10 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_lstiter(t_list *lst, void (*f)(t_list *elem)) -{ - if (!lst) - return ; - if (lst->next) - ft_lstiter(lst->next, f); - f(lst); -} diff --git a/OLDsrc/lst/ft_lstmap.c b/OLDsrc/lst/ft_lstmap.c deleted file mode 100644 index 6b9a2c8..0000000 --- a/OLDsrc/lst/ft_lstmap.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstmap.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:11:20 by hulamy #+# #+# */ -/* Updated: 2018/11/16 14:01:23 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)) -{ - t_list *new; - t_list *tmp; - - if (!lst) - return (NULL); - tmp = f(lst); - new = tmp; - while (lst->next) - { - lst = lst->next; - if (!(tmp->next = f(lst))) - { - free(tmp->next); - return (NULL); - } - tmp = tmp->next; - } - return (new); -} diff --git a/OLDsrc/lst/ft_lstnew.c b/OLDsrc/lst/ft_lstnew.c deleted file mode 100644 index 6d00337..0000000 --- a/OLDsrc/lst/ft_lstnew.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstnew.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:11:42 by hulamy #+# #+# */ -/* Updated: 2018/11/16 14:01:36 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -t_list *ft_lstnew(void const *content, size_t content_size) -{ - t_list *lst; - - if (!(lst = (t_list *)malloc(sizeof(*lst)))) - return (NULL); - if (!content) - { - lst->content = NULL; - lst->content_size = 0; - } - else - { - if (!(lst->content = malloc(content_size))) - return (NULL); - ft_memcpy(lst->content, content, content_size); - lst->content_size = content_size; - } - lst->next = NULL; - return (lst); -} diff --git a/OLDsrc/mem/ft_memalloc.c b/OLDsrc/mem/ft_memalloc.c deleted file mode 100644 index 13f7ad3..0000000 --- a/OLDsrc/mem/ft_memalloc.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memalloc.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:11:58 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:42:06 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** allocate size byte of memory and return a pointer to the allocated memory -*/ - -#include "libft.h" - -void *ft_memalloc(size_t size) -{ - void *tmp; - - if (!(tmp = malloc(size))) - return (NULL); - ft_bzero(tmp, size); - return (tmp); -} diff --git a/OLDsrc/mem/ft_memccpy.c b/OLDsrc/mem/ft_memccpy.c deleted file mode 100644 index a8bf1ee..0000000 --- a/OLDsrc/mem/ft_memccpy.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memccpy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:12:10 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:42:41 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** copy string until character is found and place cursor in dst -** after last byte copied -*/ - -#include "libft.h" - -void *ft_memccpy(void *dst, const void *src, int c, size_t n) -{ - unsigned char *dest; - unsigned char *sourc; - size_t i; - - i = -1; - dest = (unsigned char *)dst; - sourc = (unsigned char *)src; - while (++i < n) - { - dest[i] = sourc[i]; - if (sourc[i] == (unsigned char)c) - return (dst + i + 1); - } - return (NULL); -} diff --git a/OLDsrc/mem/ft_memchr.c b/OLDsrc/mem/ft_memchr.c deleted file mode 100644 index f6254ed..0000000 --- a/OLDsrc/mem/ft_memchr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memchr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:12:32 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:43:14 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** locate character in string and return its position -*/ - -#include "libft.h" - -void *ft_memchr(const void *s, int c, size_t n) -{ - unsigned char *sbis; - size_t i; - - sbis = (unsigned char *)s; - i = -1; - while (++i < n) - if (sbis[i] == (unsigned char)c) - return ((void *)sbis + i); - return (NULL); -} diff --git a/OLDsrc/mem/ft_memcmp.c b/OLDsrc/mem/ft_memcmp.c deleted file mode 100644 index d881cba..0000000 --- a/OLDsrc/mem/ft_memcmp.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memcmp.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:13:04 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:43:41 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** compare two bytes strings (doesnt recognize a null terminated string) -** and return value of difference between first two different character -*/ - -#include "libft.h" - -int ft_memcmp(const void *s1, const void *s2, size_t n) -{ - unsigned char *frst; - unsigned char *scnd; - size_t i; - - i = 0; - frst = (unsigned char *)s1; - scnd = (unsigned char *)s2; - while (i < n && frst[i] == scnd[i]) - i++; - return ((i == n) ? 0 : frst[i] - scnd[i]); -} diff --git a/OLDsrc/mem/ft_memcpy.c b/OLDsrc/mem/ft_memcpy.c deleted file mode 100644 index d21a57c..0000000 --- a/OLDsrc/mem/ft_memcpy.c +++ /dev/null @@ -1,31 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memcpy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:13:17 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:43:56 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** copy n characters from src to dst and return dst -*/ - -#include "libft.h" - -void *ft_memcpy(void *dst, const void *src, size_t n) -{ - size_t i; - char *ptr; - char *ptr2; - - ptr = (char *)dst; - ptr2 = (char *)src; - i = -1; - while (++i < n) - ptr[i] = ptr2[i]; - return (dst); -} diff --git a/OLDsrc/mem/ft_memdel.c b/OLDsrc/mem/ft_memdel.c deleted file mode 100644 index f057043..0000000 --- a/OLDsrc/mem/ft_memdel.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memdel.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:13:26 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:44:12 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** free memory -*/ - -#include "libft.h" - -void ft_memdel(void **ap) -{ - if (ap && *ap) - { - free(*ap); - *ap = 0; - } -} diff --git a/OLDsrc/mem/ft_memmove.c b/OLDsrc/mem/ft_memmove.c deleted file mode 100644 index 51af09b..0000000 --- a/OLDsrc/mem/ft_memmove.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memmove.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:13:34 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:44:28 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** copy n characters from src to dst in a non destructive way and return dst -*/ - -#include "libft.h" - -void *ft_memmove(void *dst, const void *src, size_t len) -{ - int i; - char *source; - char *dest; - - i = -1; - source = (char *)src; - dest = (char *)dst; - if (source < dest) - while ((int)(--len) >= 0) - dest[len] = source[len]; - else - while (++i < (int)len) - dest[i] = source[i]; - return (dst); -} diff --git a/OLDsrc/mem/ft_memset.c b/OLDsrc/mem/ft_memset.c deleted file mode 100644 index b3df393..0000000 --- a/OLDsrc/mem/ft_memset.c +++ /dev/null @@ -1,29 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memset.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:13:41 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:44:44 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** copy n time a character in a string and return the string -*/ - -#include "libft.h" - -void *ft_memset(void *b, int c, size_t len) -{ - char *ptr; - size_t i; - - ptr = (char *)b; - i = 0; - while (i < len) - ptr[i++] = c; - return (b); -} diff --git a/OLDsrc/put/ft_putchar.c b/OLDsrc/put/ft_putchar.c deleted file mode 100644 index b0aa9cb..0000000 --- a/OLDsrc/put/ft_putchar.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putchar.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:14:00 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:14:01 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putchar(char c) -{ - write(1, &c, 1); -} diff --git a/OLDsrc/put/ft_putchar_fd.c b/OLDsrc/put/ft_putchar_fd.c deleted file mode 100644 index e12e154..0000000 --- a/OLDsrc/put/ft_putchar_fd.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putchar_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:14:14 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:14:15 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putchar_fd(char c, int fd) -{ - write(fd, &c, 1); -} diff --git a/OLDsrc/put/ft_putendl.c b/OLDsrc/put/ft_putendl.c deleted file mode 100644 index c1d9a6a..0000000 --- a/OLDsrc/put/ft_putendl.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putendl.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:14:32 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:14:33 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putendl(char const *s) -{ - ft_putstr(s); - ft_putchar('\n'); -} diff --git a/OLDsrc/put/ft_putendl_fd.c b/OLDsrc/put/ft_putendl_fd.c deleted file mode 100644 index 73b5dec..0000000 --- a/OLDsrc/put/ft_putendl_fd.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putendl_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:14:47 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:14:48 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putendl_fd(char const *s, int fd) -{ - ft_putstr_fd(s, fd); - ft_putchar_fd('\n', fd); -} diff --git a/OLDsrc/put/ft_putnbr.c b/OLDsrc/put/ft_putnbr.c deleted file mode 100644 index bb8e2d7..0000000 --- a/OLDsrc/put/ft_putnbr.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putnbr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:14:57 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:14:58 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putnbr(int n) -{ - ft_putnbr_fd(n, 1); -} diff --git a/OLDsrc/put/ft_putnbr_fd.c b/OLDsrc/put/ft_putnbr_fd.c deleted file mode 100644 index 66a4a9d..0000000 --- a/OLDsrc/put/ft_putnbr_fd.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putnbr_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:15:09 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:15:10 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putnbr_fd(int n, int fd) -{ - long l; - - l = n; - if (l < 0) - { - ft_putchar_fd('-', fd); - l *= -1; - } - if (l >= 10) - ft_putnbr_fd(l / 10, fd); - ft_putchar_fd((l % 10) + '0', fd); -} diff --git a/OLDsrc/put/ft_putnbrbase.c b/OLDsrc/put/ft_putnbrbase.c deleted file mode 100644 index bf0d627..0000000 --- a/OLDsrc/put/ft_putnbrbase.c +++ /dev/null @@ -1,59 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putnbrbase.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:17:00 by hulamy #+# #+# */ -/* Updated: 2018/11/16 15:23:43 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -static int check(char *base) -{ - int i; - int j; - - i = 0; - while (base[i]) - { - j = i + 1; - while (base[j]) - { - if (base[i] == base[j]) - return (0); - j++; - } - if (base[i] == '-' || base[i] == '+') - return (0); - i++; - } - if (i >= 2) - return (1); - return (0); -} - -void ft_putnbrbase(int nbr, char *base) -{ - int i; - long n; - - i = 0; - n = nbr; - if (check(base)) - { - if (n < 0) - { - ft_putchar('-'); - n = -n; - } - while (base[i]) - i++; - if (n >= i) - ft_putnbrbase(n / i, base); - ft_putchar(base[n % i]); - } -} diff --git a/OLDsrc/put/ft_putnbrendl.c b/OLDsrc/put/ft_putnbrendl.c deleted file mode 100644 index ddd05f6..0000000 --- a/OLDsrc/put/ft_putnbrendl.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putnbrendl.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/02/19 10:38:07 by hulamy #+# #+# */ -/* Updated: 2019/02/19 10:42:46 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putnbrendl(int n) -{ - ft_putnbrendl_fd(n, 1); -} diff --git a/OLDsrc/put/ft_putnbrendl_fd.c b/OLDsrc/put/ft_putnbrendl_fd.c deleted file mode 100644 index 266dc55..0000000 --- a/OLDsrc/put/ft_putnbrendl_fd.c +++ /dev/null @@ -1,29 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putnbrendl_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/02/19 10:37:58 by hulamy #+# #+# */ -/* Updated: 2019/02/19 10:42:48 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putnbrendl_fd(int n, int fd) -{ - long l; - - l = n; - if (l < 0) - { - ft_putchar_fd('-', fd); - l *= -1; - } - if (l >= 10) - ft_putnbr_fd(l / 10, fd); - ft_putchar_fd((l % 10) + '0', fd); - ft_putchar_fd('\n', fd); -} diff --git a/OLDsrc/put/ft_putstr.c b/OLDsrc/put/ft_putstr.c deleted file mode 100644 index 78617eb..0000000 --- a/OLDsrc/put/ft_putstr.c +++ /dev/null @@ -1,22 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putstr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:15:19 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:15:19 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putstr(char const *s) -{ - int i; - - i = 0; - while (s && s[i]) - ft_putchar(s[i++]); -} diff --git a/OLDsrc/put/ft_putstr_fd.c b/OLDsrc/put/ft_putstr_fd.c deleted file mode 100644 index 65607b1..0000000 --- a/OLDsrc/put/ft_putstr_fd.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putstr_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:15:31 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:15:32 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_putstr_fd(char const *s, int fd) -{ - while (s && *s) - ft_putchar_fd(*s++, fd); -} diff --git a/OLDsrc/str/ft_strcat.c b/OLDsrc/str/ft_strcat.c deleted file mode 100644 index d78543c..0000000 --- a/OLDsrc/str/ft_strcat.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strcat.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:15:40 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:12:58 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** append src to dest (dest must have sufficient space) and return dest -*/ - -#include "libft.h" - -char *ft_strcat(char *dest, const char *src) -{ - int i; - int j; - - i = 0; - j = 0; - while (dest[i]) - i++; - while (src[j]) - dest[i++] = src[j++]; - dest[i] = '\0'; - return (dest); -} diff --git a/OLDsrc/str/ft_strchr.c b/OLDsrc/str/ft_strchr.c deleted file mode 100644 index 095c87e..0000000 --- a/OLDsrc/str/ft_strchr.c +++ /dev/null @@ -1,33 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strchr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:15:48 by hulamy #+# #+# */ -/* Updated: 2019/04/16 17:28:46 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** locate the first occurence of character c in string s -** and return pointer to its location -*/ - -#include "libft.h" - -char *ft_strchr(const char *s, int c) -{ - int i; - int j; - - i = 0; - j = -1; - while (s[i]) - i++; - while (++j < i + 1) - if (s[j] == c) - return ((char *)s + j); - return (NULL); -} diff --git a/OLDsrc/str/ft_strclr.c b/OLDsrc/str/ft_strclr.c deleted file mode 100644 index 5e3952c..0000000 --- a/OLDsrc/str/ft_strclr.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strclr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:15:58 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:17:42 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** fill string with zeros -*/ - -#include "libft.h" - -void ft_strclr(char *s) -{ - if (s) - ft_bzero(s, ft_strlen(s)); -} diff --git a/OLDsrc/str/ft_strcmp.c b/OLDsrc/str/ft_strcmp.c deleted file mode 100644 index f6603c3..0000000 --- a/OLDsrc/str/ft_strcmp.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strcmp.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:16:08 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:18:30 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** compare two null terminated strings and return value -** of difference between first two different character -*/ - -#include "libft.h" - -int ft_strcmp(const char *s1, const char *s2) -{ - int i; - - i = 0; - while (s1[i] && s1[i] == s2[i]) - i++; - return ((unsigned char)s1[i] - (unsigned char)s2[i]); -} diff --git a/OLDsrc/str/ft_strcpy.c b/OLDsrc/str/ft_strcpy.c deleted file mode 100644 index 7d2a45b..0000000 --- a/OLDsrc/str/ft_strcpy.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strcpy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:16:17 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:19:19 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** copy string src to dst including '\0' and return dst -*/ - -#include "libft.h" - -char *ft_strcpy(char *dest, const char *src) -{ - int i; - - i = -1; - while (src[++i]) - dest[i] = src[i]; - dest[i] = '\0'; - return (dest); -} diff --git a/OLDsrc/str/ft_strdel.c b/OLDsrc/str/ft_strdel.c deleted file mode 100644 index 82cbc2e..0000000 --- a/OLDsrc/str/ft_strdel.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strdel.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:16:25 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:19:54 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** free memory -*/ - -#include "libft.h" - -void ft_strdel(char **as) -{ - if (as && *as) - { - free(*as); - *as = 0; - } -} diff --git a/OLDsrc/str/ft_strdup.c b/OLDsrc/str/ft_strdup.c deleted file mode 100644 index 6fc8594..0000000 --- a/OLDsrc/str/ft_strdup.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strdup.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:16:32 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:20:22 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** save a copy of string src by allocating memory and return pointer to copy -*/ - -#include "libft.h" - -char *ft_strdup(const char *src) -{ - int i; - char *str; - - i = 0; - while (src[i] != '\0') - i++; - if (!(str = (char*)malloc(sizeof(*str) * (i + 1)))) - return (NULL); - while (i-- >= 0) - str[i + 1] = src[i + 1]; - return (str); -} diff --git a/OLDsrc/str/ft_strequ.c b/OLDsrc/str/ft_strequ.c deleted file mode 100644 index fa4d4e4..0000000 --- a/OLDsrc/str/ft_strequ.c +++ /dev/null @@ -1,24 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strequ.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:16:44 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:21:02 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** return 0 if strings s1 and s2 are identical and 1 if not -*/ - -#include "libft.h" - -int ft_strequ(char const *s1, char const *s2) -{ - if (!s1 || !s2) - return (0); - return (ft_strcmp(s1, s2) == 0); -} diff --git a/OLDsrc/str/ft_striter.c b/OLDsrc/str/ft_striter.c deleted file mode 100644 index 9d3b21f..0000000 --- a/OLDsrc/str/ft_striter.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_striter.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:16:53 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:21:14 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** apply function f to each element of string s -*/ - -#include "libft.h" - -void ft_striter(char *s, void (*f)(char *)) -{ - while (s && *s && f) - f(s++); -} diff --git a/OLDsrc/str/ft_striteri.c b/OLDsrc/str/ft_striteri.c deleted file mode 100644 index 60fd7f6..0000000 --- a/OLDsrc/str/ft_striteri.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_striteri.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:17:04 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:21:27 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** apply function f to each element of string s with index specified -*/ - -#include "libft.h" - -void ft_striteri(char *s, void (*f)(unsigned int, char *)) -{ - int i; - - i = 0; - while (s && *s && f) - f(i++, s++); -} diff --git a/OLDsrc/str/ft_strjoin.c b/OLDsrc/str/ft_strjoin.c deleted file mode 100644 index 48f95a1..0000000 --- a/OLDsrc/str/ft_strjoin.c +++ /dev/null @@ -1,54 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strjoin.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:17:12 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:31:03 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a new string by concatenating the two strings s1 and s2 -*/ - -#include "libft.h" - -static char *ft_doit(char const *s1, char const *s2, char *dest) -{ - int j; - int i; - - j = 0; - i = 0; - while (s1[j] != '\0') - { - dest[i] = s1[j]; - i++; - j++; - } - j = 0; - while (s2[j] != '\0') - { - dest[i] = s2[j]; - i++; - j++; - } - dest[i] = '\0'; - return (dest); -} - -char *ft_strjoin(char const *s1, char const *s2) -{ - char *str; - - if (!s1 || !s2) - return (NULL); - if (!(str = (char *)malloc(sizeof(char) * - (ft_strlen(s1) + ft_strlen(s2) + 1)))) - return (NULL); - str = ft_doit(s1, s2, str); - return (str); -} diff --git a/OLDsrc/str/ft_strjoinfree.c b/OLDsrc/str/ft_strjoinfree.c deleted file mode 100644 index 8e0247b..0000000 --- a/OLDsrc/str/ft_strjoinfree.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strjoinfree.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/03/05 15:05:28 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:22:28 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a new string by concatenating the two strings s1 -** and s2 then freeing them -*/ - -#include "libft.h" - -char *ft_strjoinfree(char *s1, char *s2) -{ - char *str; - - if (!(str = ft_strjoin(s1, s2))) - return (NULL); - free(s1); - return (str); -} diff --git a/OLDsrc/str/ft_strlcat.c b/OLDsrc/str/ft_strlcat.c deleted file mode 100644 index 6917fbb..0000000 --- a/OLDsrc/str/ft_strlcat.c +++ /dev/null @@ -1,109 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strlcat.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:17:22 by hulamy #+# #+# */ -/* Updated: 2019/11/19 14:40:09 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** append src to sized dest and return size of final dest -** -** TESTS : -*/ - -/* -** #include -** #include -** #include -** -** size_t ft_strlcat(char *dest, const char *src, size_t size); -** -** size_t ft_strlcat2(char *dest, char *src, size_t size); -** -** int ft_strlen(char *str) -** { -** int i; -** -** i = 0; -** while (str[i]) -** i++; -** return (i); -** } -** -** int main(int ac, char **av) -** { -** char tmp1[100]; -** char tmp2[100]; -** int i; -** -** i = atoi(av[3]); -** strcpy(tmp1, av[1]); -** strcpy(tmp2, av[2]); -** -** if (ac == 4) -** { -** printf("----strlcat: %zu - %s - %s\n", strlcat(tmp1, tmp2, i), tmp1, tmp2); -** -** strcpy(tmp1, av[1]); -** strcpy(tmp2, av[2]); -** -** printf("-ft_strlcat: %zu - %s - %s\n", ft_strlcat(tmp1, tmp2, i), tmp1, tmp2); -** -** strcpy(tmp1, av[1]); -** strcpy(tmp2, av[2]); -** -** printf("ft_strlcat2: %zu - %s - %s\n", ft_strlcat2(tmp1, tmp2, i), tmp1, tmp2); -** } -** } -** -** size_t ft_strlcat2(char *dest, char *src, size_t size) -** { -** size_t i; -** size_t dest_length; -** size_t src_length; -** -** i = 0; -** dest_length = ft_strlen(dest); -** src_length = ft_strlen(src); -** if (size > dest_length + 1) -** { -** while (i < (size - dest_length - 1)) -** { -** dest[i + dest_length] = src[i]; -** i++; -** } -** dest[dest_length + i] = '\0'; -** } -** if (size >= dest_length) -** return (dest_length + src_length); -** return (src_length + size); -** } -*/ - -#include "libft.h" - -size_t ft_strlcat(char *dest, const char *src, size_t size) -{ - size_t i; - size_t j; - - i = 0; - j = 0; - while (dest[i] && i < size) - i++; - while (src[j]) - { - if (j + i < size - 1 && size) - { - dest[i + j] = src[j]; - dest[i + j + 1] = '\0'; - } - j++; - } - return (i + j); -} diff --git a/OLDsrc/str/ft_strlen.c b/OLDsrc/str/ft_strlen.c deleted file mode 100644 index 59cc818..0000000 --- a/OLDsrc/str/ft_strlen.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strlen.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:17:32 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:23:00 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** return length of of string -*/ - -#include "libft.h" - -size_t ft_strlen(const char *str) -{ - size_t i; - - i = 0; - while (str[i]) - i++; - return (i); -} diff --git a/OLDsrc/str/ft_strmap.c b/OLDsrc/str/ft_strmap.c deleted file mode 100644 index ef82f97..0000000 --- a/OLDsrc/str/ft_strmap.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strmap.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:17:49 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:23:12 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a new array with the result of function f on every element of s -*/ - -#include "libft.h" - -char *ft_strmap(char const *s, char (*f)(char)) -{ - char *str; - int i; - - if (!s) - return (NULL); - if (!(str = ft_strnew(ft_strlen(s)))) - return (NULL); - i = -1; - while (s[++i]) - str[i] = f(s[i]); - return (str); -} diff --git a/OLDsrc/str/ft_strmapi.c b/OLDsrc/str/ft_strmapi.c deleted file mode 100644 index d9fb527..0000000 --- a/OLDsrc/str/ft_strmapi.c +++ /dev/null @@ -1,33 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strmapi.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:18:03 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:28:21 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a new array with the result of function f -** on every element of s by index i -*/ - -#include "libft.h" - -char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) -{ - char *str; - int i; - - if (!s) - return (NULL); - if (!(str = ft_strnew(ft_strlen(s)))) - return (NULL); - i = -1; - while (s[++i]) - str[i] = f(i, s[i]); - return (str); -} diff --git a/OLDsrc/str/ft_strmultisplit.c b/OLDsrc/str/ft_strmultisplit.c deleted file mode 100644 index ed2ed98..0000000 --- a/OLDsrc/str/ft_strmultisplit.c +++ /dev/null @@ -1,83 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strmultisplit.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:18:29 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:23:57 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** return an array of string with each word found in str -** with any character of charset difining a separator -*/ - -#include "libft.h" - -static int ft_is_separator(char c, char *charset, int i) -{ - while (charset[i]) - { - if (c == charset[i]) - return (1); - i++; - } - c = charset[i]; - return (0); -} - -static int ft_count(char *str, int word, char **tab, char *charset) -{ - int i; - int j; - int k; - - k = 0; - i = 0; - while (ft_is_separator(str[k], charset, 0) == 1) - k++; - while (str[k] != '\0' && i != word) - { - j = 0; - while (!ft_is_separator(str[k + j], charset, 0) && str[k + j] != '\0') - { - if (word == -2) - tab[i][j] = str[k + j]; - j++; - } - k += j; - while (ft_is_separator(str[k], charset, 0)) - k++; - i++; - } - if (word == -1) - return (i); - return (j); -} - -char **ft_strmultisplit(char *str, char *charset) -{ - char **tab; - int i; - int j; - int k; - - k = 0; - tab = 0; - i = ft_count(str, -1, tab, charset); - if (!(tab = (char**)malloc(sizeof(tab) * (i + 1)))) - return (NULL); - tab[i] = 0; - while (k < i) - { - j = ft_count(str, k + 1, tab, charset); - tab[k] = (char*)malloc(sizeof(*tab) * (j + 1)); - tab[k][j] = '\0'; - k++; - } - ft_count(str, -2, tab, charset); - return (tab); -} diff --git a/OLDsrc/str/ft_strncat.c b/OLDsrc/str/ft_strncat.c deleted file mode 100644 index cf52aae..0000000 --- a/OLDsrc/str/ft_strncat.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strncat.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:18:24 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:24:11 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** append n character of src to dest and return dest -*/ - -#include "libft.h" - -char *ft_strncat(char *dest, const char *src, size_t nb) -{ - size_t i; - size_t j; - - i = 0; - j = 0; - while (dest[i]) - i++; - while (src[j] && j < nb) - dest[i++] = src[j++]; - dest[i] = '\0'; - return (dest); -} diff --git a/OLDsrc/str/ft_strncmp.c b/OLDsrc/str/ft_strncmp.c deleted file mode 100644 index 5d51c2d..0000000 --- a/OLDsrc/str/ft_strncmp.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strncmp.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:18:34 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:24:35 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** compare size first character of two null terminated strings -** and return value of difference between first two different character -*/ - -#include "libft.h" - -int ft_strncmp(const char *s1, const char *s2, size_t n) -{ - size_t i; - int res; - - i = 0; - res = 0; - while (s1[i] && s1[i] == s2[i] && i < n - 1) - i++; - if (n != 0) - res = (unsigned char)s1[i] - (unsigned char)s2[i]; - return (res); -} diff --git a/OLDsrc/str/ft_strncpy.c b/OLDsrc/str/ft_strncpy.c deleted file mode 100644 index 91ea1b3..0000000 --- a/OLDsrc/str/ft_strncpy.c +++ /dev/null @@ -1,30 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strncpy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:18:44 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:24:59 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** copy n characters from string src to dst including '\0' -** if space remain it's filled zith '\0', and return dst -*/ - -#include "libft.h" - -char *ft_strncpy(char *dest, const char *src, size_t n) -{ - size_t i; - - i = -1; - while (++i < n && src[i]) - dest[i] = src[i]; - while (i < n) - dest[i++] = '\0'; - return (dest); -} diff --git a/OLDsrc/str/ft_strnequ.c b/OLDsrc/str/ft_strnequ.c deleted file mode 100644 index 668f3fa..0000000 --- a/OLDsrc/str/ft_strnequ.c +++ /dev/null @@ -1,25 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strnequ.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:18:55 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:25:20 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** return 0 if n first character of strings s1 and s2 are identical -** and 1 if not -*/ - -#include "libft.h" - -int ft_strnequ(char const *s1, char const *s2, size_t n) -{ - if (!s1 || !s2) - return (0); - return (ft_strncmp(s1, s2, n) == 0); -} diff --git a/OLDsrc/str/ft_strnew.c b/OLDsrc/str/ft_strnew.c deleted file mode 100644 index c7855ad..0000000 --- a/OLDsrc/str/ft_strnew.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strnew.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:19:08 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:25:38 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a new string of length size, fill with zero, and return pointer to it -*/ - -#include "libft.h" - -char *ft_strnew(size_t size) -{ - char *str; - - if (!(str = (char *)malloc(sizeof(char) * (size + 1)))) - return (NULL); - ft_bzero(str, size + 1); - return (str); -} diff --git a/OLDsrc/str/ft_strnstr.c b/OLDsrc/str/ft_strnstr.c deleted file mode 100644 index 5dbb8c0..0000000 --- a/OLDsrc/str/ft_strnstr.c +++ /dev/null @@ -1,42 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strnstr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:19:16 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:25:57 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** locate the first occurence of the string little in len first characters -** of big and return a pointer to this occurence if found -*/ - -#include "libft.h" - -char *ft_strnstr(const char *big, const char *little, size_t len) -{ - size_t i; - size_t j; - - j = 0; - i = 0; - if (!ft_strlen(little)) - return ((char *)big); - while (i == 0 && j <= len) - { - while (little[i] == big[j + i] && little[i] && j + i <= len) - i++; - if (little[i]) - { - j++; - if (!big[j] || j >= len) - return (0); - i = 0; - } - } - return ((char *)big + j); -} diff --git a/OLDsrc/str/ft_strrchr.c b/OLDsrc/str/ft_strrchr.c deleted file mode 100644 index b512fe7..0000000 --- a/OLDsrc/str/ft_strrchr.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strrchr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:19:23 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:26:21 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** locate the last occurence of character c in string s -** and return pointer to its location -*/ - -#include "libft.h" - -char *ft_strrchr(const char *s, int c) -{ - int i; - - i = 0; - while (s[i]) - i++; - i++; - while (i--) - if (s[i] == c) - return ((char *)s + i); - return (NULL); -} diff --git a/OLDsrc/str/ft_strsplit.c b/OLDsrc/str/ft_strsplit.c deleted file mode 100644 index bcdba85..0000000 --- a/OLDsrc/str/ft_strsplit.c +++ /dev/null @@ -1,62 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strsplit.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:19:36 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:26:39 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** return an array of string with each word found in str, with c as separator -*/ - -#include "libft.h" - -static int ft_count_word(char const *s, char c) -{ - int i; - int len; - - i = -1; - len = 0; - while (s[++i]) - if (s[i] != c) - { - len++; - while (s[i] && s[i] != c) - i++; - } - return (len); -} - -char **ft_strsplit(char const *s, char c) -{ - char **array; - int i; - int j; - int len; - - i = -1; - j = 0; - if (!s || !c) - return (0); - if (!(array = (char **)malloc(sizeof(char *) * (ft_count_word(s, c) + 1)))) - return (NULL); - while (s[++i]) - { - if (s[i] != c) - { - len = 0; - while (s[i + len] && s[i + len] != c) - len++; - array[j++] = ft_strsub(s, i, len); - i = i + len - 1; - } - } - array[j] = 0; - return (array); -} diff --git a/OLDsrc/str/ft_strstr.c b/OLDsrc/str/ft_strstr.c deleted file mode 100644 index c7a3535..0000000 --- a/OLDsrc/str/ft_strstr.c +++ /dev/null @@ -1,42 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strstr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:19:45 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:26:59 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** locate the first occurence of the string little in big -** and return a pointer to this occurence if found -*/ - -#include "libft.h" - -char *ft_strstr(const char *str, const char *to_find) -{ - int i; - int j; - - j = 0; - i = 0; - if (!ft_strlen(to_find)) - return ((char *)str); - while (i == 0) - { - while (to_find[i] && to_find[i] == str[j + i]) - i++; - if (to_find[i]) - { - j++; - if (str[j] == '\0' && to_find[i]) - return (0); - i = 0; - } - } - return ((char *)str + j); -} diff --git a/OLDsrc/str/ft_strsub.c b/OLDsrc/str/ft_strsub.c deleted file mode 100644 index 74fc38a..0000000 --- a/OLDsrc/str/ft_strsub.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strsub.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:19:52 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:27:14 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a copy of a portion of s, begining at start and of length len -*/ - -#include "libft.h" - -char *ft_strsub(char const *s, unsigned int start, size_t len) -{ - char *str; - size_t i; - - if (!s) - return (NULL); - if (!(str = ft_strnew(len))) - return (NULL); - i = 0; - while (i < len) - str[i++] = s[start++]; - return (str); -} diff --git a/OLDsrc/str/ft_strtrim.c b/OLDsrc/str/ft_strtrim.c deleted file mode 100644 index 7133c7e..0000000 --- a/OLDsrc/str/ft_strtrim.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strtrim.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:20:09 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:12:04 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** create a copy of s without the firsts and lasts empty characters -*/ - -#include "libft.h" - -char *ft_strtrim(char const *s) -{ - int len; - char *str; - - if (!s) - return (NULL); - while (*s == ' ' || *s == '\t' || *s == '\n') - s++; - len = ft_strlen(s) - 1; - while (len >= 0 && (s[len] == ' ' || s[len] == '\t' || s[len] == '\n')) - len--; - len++; - if (!(str = ft_strsub(s, 0, len))) - return (NULL); - return (str); -} diff --git a/OLDsrc/tab/ft_any.c b/OLDsrc/tab/ft_any.c deleted file mode 100644 index 349e3a9..0000000 --- a/OLDsrc/tab/ft_any.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_any.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:14:49 by hulamy #+# #+# */ -/* Updated: 2018/11/16 15:14:53 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_any(char **tab, int (*f)(char*)) -{ - int i; - - i = -1; - if (!tab) - return (0); - while (tab[++i]) - if (f(tab[i]) == 1) - return (1); - return (0); -} diff --git a/OLDsrc/tab/ft_arraymap.c b/OLDsrc/tab/ft_arraymap.c deleted file mode 100644 index 267510a..0000000 --- a/OLDsrc/tab/ft_arraymap.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_arraymap.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:17:24 by hulamy #+# #+# */ -/* Updated: 2018/11/16 15:17:27 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int *ft_arraymap(int *tab, int length, int (*f)(int)) -{ - int i; - int *newtab; - - i = -1; - if (!tab) - return (NULL); - if (!(newtab = (int*)malloc(sizeof(*newtab) * (length + 1)))) - return (NULL); - while (++i < length) - newtab[i] = (*f)(tab[i]); - return (newtab); -} diff --git a/OLDsrc/tab/ft_foreach.c b/OLDsrc/tab/ft_foreach.c deleted file mode 100644 index aaf7649..0000000 --- a/OLDsrc/tab/ft_foreach.c +++ /dev/null @@ -1,22 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_foreach.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:16:10 by hulamy #+# #+# */ -/* Updated: 2018/11/16 15:16:11 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_foreach(int *tab, int length, void (*f)(int)) -{ - int i; - - i = 0; - while (i < length && tab && tab[i]) - (*f)(tab[i++]); -} diff --git a/OLDsrc/trsf/ft_atoi.c b/OLDsrc/trsf/ft_atoi.c deleted file mode 100644 index 5c10b59..0000000 --- a/OLDsrc/trsf/ft_atoi.c +++ /dev/null @@ -1,39 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_atoi.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:09:04 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:38:12 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_atoi(const char *str) -{ - long long nbr; - int i; - int n; - - i = 0; - n = 1; - nbr = 0; - while ((str[i] == 32) || (str[i] > 8 && str[i] < 14)) - i++; - if (str[i] == '-') - n = -1; - if (str[i] == '+' || str[i] == '-') - i++; - while (str[i] >= '0' && str[i] <= '9') - { - if ((nbr >= 922337203685477580 - && ((str[i] > 8 && n < 0) || (str[i] > 7 && n > 0)))) - return ((n > 0) ? -1 : 0); - else - nbr = nbr * 10 + (str[i++] - '0'); - } - return (nbr * n); -} diff --git a/OLDsrc/trsf/ft_atoibase.c b/OLDsrc/trsf/ft_atoibase.c deleted file mode 100644 index fdb92d1..0000000 --- a/OLDsrc/trsf/ft_atoibase.c +++ /dev/null @@ -1,75 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_atoibase.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:15:31 by hulamy #+# #+# */ -/* Updated: 2018/11/16 15:22:34 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -static int is_valid_base(char *base, int i, int j) -{ - while (base[i]) - { - j = i + 1; - while (base[j]) - { - if (base[i] == base[j]) - return (0); - j++; - } - if (base[i] == '-' || base[i] == '+') - return (0); - i++; - } - if (i >= 2) - return (1); - return (0); -} - -static int skip(int i, char *str, int *n) -{ - while ((str[i] == 32) || (str[i] > 8 && str[i] < 14)) - i++; - if (str[i] == '+' || str[i] == '-') - { - if (str[i] == '-') - *n = -1; - i++; - } - return (i); -} - -int ft_atoibase(char *str, char *base) -{ - int i; - int j; - int length; - int res; - int n; - - length = 0; - res = 0; - n = 1; - if (!is_valid_base(base, 0, 0)) - return (0); - while (base[length]) - length++; - i = skip(0, str, &n); - while (str[i] && str[i] > 32 && str[i] != '-' && str[i] != '+') - { - j = 0; - while (str[i] != base[j] && base[j]) - j++; - if (base[j] == '\0') - return (0); - res = (res * length) + j; - i++; - } - return (res * n); -} diff --git a/OLDsrc/trsf/ft_bzero.c b/OLDsrc/trsf/ft_bzero.c deleted file mode 100644 index ed2c7eb..0000000 --- a/OLDsrc/trsf/ft_bzero.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_bzero.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:09:19 by hulamy #+# #+# */ -/* Updated: 2018/11/15 21:43:05 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -void ft_bzero(void *s, size_t n) -{ - size_t i; - unsigned char *ptr; - - if (n) - { - ptr = (unsigned char *)s; - i = 0; - while (i < n) - ptr[i++] = '\0'; - } -} diff --git a/OLDsrc/trsf/ft_convertbase.c b/OLDsrc/trsf/ft_convertbase.c deleted file mode 100644 index 7fe9bad..0000000 --- a/OLDsrc/trsf/ft_convertbase.c +++ /dev/null @@ -1,86 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_convertbase.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/16 15:15:55 by hulamy #+# #+# */ -/* Updated: 2019/04/17 17:09:35 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -static int ft_malloc_size(int decimal, int length, int i) -{ - if (decimal <= 0) - i++; - while (decimal) - { - decimal /= length; - i++; - } - return (i); -} - -static char *ft_decimal_to_base(int decimal, char *base, char *res, int size) -{ - long nb; - int i; - - nb = decimal; - i = 0; - while (base[i]) - i++; - if (nb < 0) - nb = -nb; - while (--size >= 0) - { - res[size] = base[nb % i]; - nb /= i; - } - return (res); -} - -static int ft_base_to_decimal(char *nbr, char *base, int length, int i) -{ - long decimal; - int j; - - decimal = 0; - if (nbr[i] == '-') - i++; - while (nbr[i]) - { - j = 0; - while (nbr[i] != base[j] && base[j]) - j++; - decimal = (decimal * length) + j; - i++; - } - if (nbr[0] == '-') - decimal = -decimal; - return (decimal); -} - -char *ft_convertbase(char *nbr, char *base_from, char *base_to) -{ - int length; - int size; - int decimal; - char *res; - - res = 0; - length = 0; - while (base_from[length]) - length++; - decimal = ft_base_to_decimal(nbr, base_from, length, 0); - length = 0; - while (base_to[length]) - length++; - size = ft_malloc_size(decimal, length, 0); - res = (char *)malloc(sizeof(char) * (size + 1)); - res[size] = '\0'; - return (ft_decimal_to_base(decimal, base_to, res, size)); -} diff --git a/OLDsrc/trsf/ft_itoa.c b/OLDsrc/trsf/ft_itoa.c deleted file mode 100644 index 65fbfa7..0000000 --- a/OLDsrc/trsf/ft_itoa.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_itoa.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:10:25 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:36:38 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -char *ft_itoa(int n) -{ - char *str; - int len; - long int nbis; - - len = (n < 0) ? 2 : 1; - nbis = n; - while (nbis /= 10) - len++; - nbis = n; - nbis *= (nbis < 0) ? -1 : 1; - if (!(str = ft_strnew(len))) - return (NULL); - str[--len] = nbis % 10 + '0'; - while (nbis /= 10) - str[--len] = nbis % 10 + '0'; - if (n < 0) - str[0] = '-'; - return (str); -} diff --git a/OLDsrc/trsf/ft_tolower.c b/OLDsrc/trsf/ft_tolower.c deleted file mode 100644 index e8f2b0f..0000000 --- a/OLDsrc/trsf/ft_tolower.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_tolower.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:20:19 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:20:20 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_tolower(int c) -{ - if (c >= 'A' && c <= 'Z') - return (c + 32); - return (c); -} diff --git a/OLDsrc/trsf/ft_toupper.c b/OLDsrc/trsf/ft_toupper.c deleted file mode 100644 index e0e0271..0000000 --- a/OLDsrc/trsf/ft_toupper.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_toupper.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: hulamy +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:20:26 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:20:27 by hulamy ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_toupper(int c) -{ - if (c >= 'a' && c <= 'z') - return (c - 32); - return (c); -} diff --git a/OLDincludes/libft.h b/libft.h similarity index 76% rename from OLDincludes/libft.h rename to libft.h index 89918a8..b5589a5 100644 --- a/OLDincludes/libft.h +++ b/libft.h @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:22:07 by hulamy #+# #+# */ -/* Updated: 2019/04/07 14:22:04 by hulamy ### ########.fr */ +/* Created: 2019/11/25 14:45:53 by hulamy #+# #+# */ +/* Updated: 2019/11/25 15:45:05 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,77 +16,79 @@ # include # include -int ft_atoi(const char *str); +void *ft_memset(void *b, int c, size_t len); void ft_bzero(void *s, size_t n); -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_memccpy(void *dst, const void *restrict src, - int c, size_t n); +void *ft_memcpy(void *dst, const void *src, size_t n); +void *ft_memccpy(void *dst, const void *src, int c, size_t n); +void *ft_memmove(void *dst, const void *src, size_t len); 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 *dst, const void *src, size_t n); -void *ft_memmove(void *dst, const void *src, size_t len); -void *ft_memset(void *b, int c, size_t len); -char *ft_strcat(char *s1, const char *s2); +size_t ft_strlen(const char *str); +int ft_isalpha(int c); +int ft_isdigit(int c); +int ft_isalnum(int c); +int ft_isascii(int c); +int ft_isprint(int c); +int ft_toupper(int c); +int ft_tolower(int c); char *ft_strchr(const char *s, int c); +char *ft_strrchr(const char *s, int c); +int ft_strncmp(const char *s1, const char *s2, size_t n); +size_t ft_strlcpy(char *dst, const char *src, size_t size); +size_t ft_strlcat(char *dst, const char *src, size_t size); +char *ft_strnstr(const char *b, const char *l, size_t s); +int ft_atoi(const char *str); +void *ft_calloc(size_t count, size_t size); +char *ft_strdup(const char *s1); + +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_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); + +t_list *ft_lstnew(void *content); +void ft_lstadd_front(t_list **alst, t_list *n); +int ft_lstsize(t_list *lst); +t_list *ft_lstlast(t_list *lst); +void ft_lstadd_back(t_list **alst, t_list *n); +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 *l, void *(*f)(void*), void (*d)(void*)); + +typedef struct s_list +{ + void *content; + struct s_list *next; +} t_list; + +char *ft_strcat(char *s1, const char *s2); int ft_strcmp(const char *s1, const char *s2); char *ft_strcpy(char *dst, const char *src); -char *ft_strdup(const char *s1); -size_t ft_strlcat(char *dst, const char *src, size_t size); -size_t ft_strlen(const char *str); char *ft_strncat(char *s1, const char *s2, size_t n); -int ft_strncmp(const char *s1, const char *s2, size_t n); char *ft_strncpy(char *dst, const char *src, size_t len); -char *ft_strnstr(const char *big, const char *little, - size_t len); -char *ft_strrchr(const char *s, int c); char *ft_strstr(const char *big, const char *little); -int ft_tolower(int c); -int ft_toupper(int c); - -char *ft_itoa(int n); -void *ft_memalloc(size_t size); -void ft_memdel(void **ap); -void ft_putchar(char c); -void ft_putchar_fd(char c, int fd); -void ft_putendl(char const *str); -void ft_putendl_fd(char const *s, int fd); -void ft_putnbr(int nbr); -void ft_putnbr_fd(int n, int fd); -void ft_putstr(char const *str); -void ft_putstr_fd(char const *s, int fd); void ft_strclr(char *s); void ft_strdel(char **as); int ft_strequ(char const *s1, char const *s2); void ft_striter(char *s, void (*f)(char *)); void ft_striteri(char *s, void (*f)(unsigned int, char *)); -char *ft_strjoin(char const *s1, char const *s2); char *ft_strjoinfree(char *s1, char *s2); char *ft_strmap(char const *s, char (*f)(char)); -char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); int ft_strnequ(char const *s1, char const *s2, size_t n); char *ft_strnew(size_t size); -char **ft_strsplit(char const *s, char c); -char *ft_strsub(char const *s, unsigned int start, size_t len); -char *ft_strtrim(char const *s); - -typedef struct s_list -{ - void *content; - size_t content_size; - struct s_list *next; -} t_list; - -t_list *ft_lstnew(const void *content, size_t content_size); -void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)); -void ft_lstdel(t_list **alst, void (*del)(void *, size_t)); -void ft_lstadd(t_list **alst, t_list *n); -void ft_lstiter(t_list *lst, void (*f)(t_list *elem)); -t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)); - +void *ft_memalloc(size_t size); +void ft_memdel(void **ap); +void ft_putchar(char c); +void ft_putendl(char const *str); +void ft_putnbr(int nbr); +void ft_putstr(char const *str); void ft_putnbrbase(int nbr, char *base); int ft_atoibase(char *str, char *base); char *ft_convertbase(char *nbr, char *base_from, char *base_to); diff --git a/srcs/bonus/ft_lstadd_back.c b/srcs/bonus/ft_lstadd_back.c index 401595b..37084d1 100644 --- a/srcs/bonus/ft_lstadd_back.c +++ b/srcs/bonus/ft_lstadd_back.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:11:53 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:11:57 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:36:12 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,19 +15,19 @@ ** or first if list has no element so far */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -37,9 +37,9 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_back(t_list **alst, t_list *new); -** +** ** int main(void) ** { ** char tresor; @@ -47,7 +47,7 @@ ** char friends; ** t_list *toto; ** t_list *tmp; -** +** ** tresor = 'a'; ** matos = 'b'; ** friends = 'c'; @@ -67,7 +67,7 @@ ** printf("toto->nxt->nxt->nxt :%s\n",(char*)(toto->next->next->next)); ** return (0); ** } -*/ +*/ #include "libft.h" @@ -89,4 +89,3 @@ void ft_lstadd_back(t_list **alst, t_list *new) new->next = NULL; } } - diff --git a/srcs/bonus/ft_lstadd_front.c b/srcs/bonus/ft_lstadd_front.c index 71b238a..3f90569 100644 --- a/srcs/bonus/ft_lstadd_front.c +++ b/srcs/bonus/ft_lstadd_front.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:12:02 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:13:14 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:36:54 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,21 +14,21 @@ ** add an element to the begining of a list */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** void *ft_memcpy(void *dst, const void *src, size_t n) ** { ** size_t i; ** char *ptr; ** char *ptr2; -** +** ** ptr = (char *)dst; ** ptr2 = (char *)src; ** i = -1; @@ -36,11 +36,11 @@ ** ptr[i] = ptr2[i]; ** return (dst); ** } -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -54,9 +54,9 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_front(t_list **alst, t_list *new); -** +** ** int main(void) ** { ** char tresor; @@ -64,7 +64,7 @@ ** char friends; ** t_list *toto; ** t_list *tmp; -** +** ** tresor = 'a'; ** matos = 'b'; ** friends = 'c'; @@ -83,7 +83,7 @@ ** printf("toto->nxt->nxt->dqta:%c\n",*(char*)(toto->next->next->content)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/bonus/ft_lstclear.c b/srcs/bonus/ft_lstclear.c index 8ef1ea1..b66cc39 100644 --- a/srcs/bonus/ft_lstclear.c +++ b/srcs/bonus/ft_lstclear.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:13:30 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:13:49 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:31:30 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,19 +14,19 @@ ** delete and free an element of the list and all the followings */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -36,11 +36,11 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_back(t_list **alst, t_list *new) ** { ** t_list *tmp; -** +** ** if (alst) ** { ** tmp = *alst; @@ -55,26 +55,26 @@ ** new->next = NULL; ** } ** } -** +** ** void ft_delete(void *element) ** { ** *(char*)element = '\0'; ** } -** +** ** void ft_lstdelone(t_list *lst, void (*del)(void *)) ** { ** del(lst->content); ** free(lst); ** lst = NULL; ** } -** +** ** void ft_lstclear(t_list **lst, void (*del)(void *)); -** +** ** int main(void) ** { ** t_list *toto; ** void (ft_delete)(void*); -** +** ** printf("sizeof(t_list)%lu\n",sizeof(t_list)); ** toto = ft_lstnew("a"); ** toto->next = ft_lstnew("b"); @@ -90,7 +90,7 @@ ** printf("toto->nxt->nxt :%s\n",(char*)(toto->next->next)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/bonus/ft_lstdelone.c b/srcs/bonus/ft_lstdelone.c index 15e1393..3ff3259 100644 --- a/srcs/bonus/ft_lstdelone.c +++ b/srcs/bonus/ft_lstdelone.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:14:03 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:14:05 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:35:53 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,19 +15,19 @@ ** next is not free */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -37,11 +37,11 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_back(t_list **alst, t_list *new) ** { ** t_list *tmp; -** +** ** if (alst) ** { ** tmp = *alst; @@ -56,19 +56,19 @@ ** new->next = NULL; ** } ** } -** +** ** void ft_delete(void *element) ** { ** *(char*)element = '\0'; ** } -** +** ** void ft_lstdelone(t_list *lst, void (*del)(void *)); -** +** ** int main(void) ** { ** t_list *toto; ** void (ft_delete)(void*); -** +** ** toto = ft_lstnew("a"); ** toto->next = ft_lstnew("b"); ** toto->next->next = ft_lstnew("c"); @@ -84,9 +84,9 @@ ** printf("toto->nxt->nxt->nxt :%s\n",(char*)(toto->next->next->next)); ** return (0); ** } -*/ +*/ -//#include "libft.h" +#include "libft.h" void ft_lstdelone(t_list *lst, void (*del)(void *)) { diff --git a/srcs/bonus/ft_lstiter.c b/srcs/bonus/ft_lstiter.c index 9cbaf51..52ab6ad 100644 --- a/srcs/bonus/ft_lstiter.c +++ b/srcs/bonus/ft_lstiter.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:14:11 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:14:29 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:34:59 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,19 +14,19 @@ ** go through all elements of the list and apply the function f to each of them */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -36,9 +36,9 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstiter(t_list *lst, void (*f)(void*)); -** +** ** void to_uppercase(void *element) ** { ** // *(char*)(((t_list*)element)->content) -= 32; @@ -48,11 +48,12 @@ ** tmp = (t_list*)element; ** *(char*)(tmp->content) -= 32; ** } +** ** int main(void) ** { ** t_list *toto; ** void to_uppercase(void*); -** +** ** toto = ft_lstnew("a"); ** toto->next = ft_lstnew("b"); ** toto->next->next = ft_lstnew("c"); @@ -68,7 +69,7 @@ ** printf("toto->nxt->nxt->nxt :%s\n",(char*)(toto->next->next->next)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/bonus/ft_lstlast.c b/srcs/bonus/ft_lstlast.c index 590ee4b..630b66a 100644 --- a/srcs/bonus/ft_lstlast.c +++ b/srcs/bonus/ft_lstlast.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:14:49 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:15:36 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:30:20 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,21 +14,21 @@ ** return a pointer to the last element of a list */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** void *ft_memcpy(void *dst, const void *src, size_t n) ** { ** size_t i; ** char *ptr; ** char *ptr2; -** +** ** ptr = (char *)dst; ** ptr2 = (char *)src; ** i = -1; @@ -36,11 +36,11 @@ ** ptr[i] = ptr2[i]; ** return (dst); ** } -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -54,21 +54,21 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_front(t_list **alst, t_list *new) ** { ** new->next = *alst; ** *alst = new; ** } -** +** ** t_list *ft_lstlast(t_list *lst); -** +** ** int main(void) ** { ** char tresor; ** t_list *toto; ** t_list *tmp; -** +** ** tresor = 'a'; ** toto = ft_lstnew(&tresor); ** tresor = 'b'; @@ -87,7 +87,7 @@ ** printf("toto->nxt->nxt->data:%c\n",*(char*)(toto->next->next->content)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/bonus/ft_lstmap.c b/srcs/bonus/ft_lstmap.c index 3508037..26d9002 100644 --- a/srcs/bonus/ft_lstmap.c +++ b/srcs/bonus/ft_lstmap.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:15:42 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:16:15 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:34:19 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,19 +15,19 @@ ** if necessary the function del is used to delete an element */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -37,11 +37,11 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_back(t_list **alst, t_list *new) ** { ** t_list *tmp; -** +** ** if (alst) ** { ** tmp = *alst; @@ -56,26 +56,26 @@ ** new->next = NULL; ** } ** } -** +** ** void *to_uppercase(void *element) ** { ** *(char*)(((t_list*)element)->content) -= 32; ** return (element); ** } -** +** ** void ft_delete(void *element) ** { ** *(char*)element = '\0'; ** } -** +** ** t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); -** +** ** int main(void) ** { ** t_list *toto; ** void *(to_uppercase)(void *); ** void (ft_delete)(void*); -** +** ** toto = ft_lstnew("a"); ** toto->next = ft_lstnew("b"); ** toto->next->next = ft_lstnew("c"); @@ -91,7 +91,7 @@ ** printf("toto->nxt->nxt->nxt :%s\n",(char*)(toto->next->next->next)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/bonus/ft_lstnew.c b/srcs/bonus/ft_lstnew.c index 966290d..401f6c9 100644 --- a/srcs/bonus/ft_lstnew.c +++ b/srcs/bonus/ft_lstnew.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:16:20 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:16:30 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:29:46 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,22 +14,22 @@ ** create a new list */ -/* +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content); -** +** ** int main(void) ** { ** char tresor; ** t_list *toto; -** +** ** tresor = 'd'; ** printf("tresor : %c\n",tresor); ** toto = ft_lstnew(&tresor); @@ -40,7 +40,7 @@ ** printf("and also toto->content: %c\n",*(char*)(toto->content)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/bonus/ft_lstsize.c b/srcs/bonus/ft_lstsize.c index cedcdb9..60a44c9 100644 --- a/srcs/bonus/ft_lstsize.c +++ b/srcs/bonus/ft_lstsize.c @@ -1,16 +1,32 @@ -/* +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstsize.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: hulamy +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/11/25 14:31:48 by hulamy #+# #+# */ +/* Updated: 2019/11/25 14:32:30 by hulamy ### ########.fr */ +/* */ +/* ************************************************************************** */ + +/* +** return the size of the linked list +*/ + +/* ** #include -** +** ** typedef struct s_list ** { ** void *content; ** struct s_list *next; ** } t_list; -** +** ** t_list *ft_lstnew(void *content) ** { ** t_list *lst; -** +** ** if (!(lst = (t_list *)malloc(sizeof(*lst)))) ** return (NULL); ** if (!content) @@ -20,21 +36,21 @@ ** lst->next = NULL; ** return (lst); ** } -** +** ** void ft_lstadd_front(t_list **alst, t_list *new) ** { ** new->next = *alst; ** *alst = new; ** } -** +** ** int ft_lstsize(t_list *lst); -** +** ** int main(void) ** { ** char tresor; ** t_list *toto; ** t_list *tmp; -** +** ** tresor = 'a'; ** toto = ft_lstnew(&tresor); ** tresor = 'b'; @@ -52,7 +68,7 @@ ** printf("toto->nxt->nxt->dqta:%c\n",*(char*)(toto->next->next->content)); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/a.out b/srcs/part1/.ft_strlcpy.c.swp old mode 100755 new mode 100644 similarity index 53% rename from a.out rename to srcs/part1/.ft_strlcpy.c.swp index a4b34af..a03db52 Binary files a/a.out and b/srcs/part1/.ft_strlcpy.c.swp differ diff --git a/srcs/part1/ft_calloc.c b/srcs/part1/ft_calloc.c index f44d0bd..611ce62 100644 --- a/srcs/part1/ft_calloc.c +++ b/srcs/part1/ft_calloc.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 13:54:53 by hulamy #+# #+# */ -/* Updated: 2019/11/25 13:54:57 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:28:35 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,7 @@ ** a = (int *)malloc(5 * sizeof(int)); //5*4bytes = 20 bytes ** free(a); ** a = (int *)calloc(5, sizeof(int)); -** +** ** allocate count * size byte of memory and ** return a pointer to the allocated memory */ diff --git a/srcs/add/ft_memccpy.c b/srcs/part1/ft_memccpy.c similarity index 83% rename from srcs/add/ft_memccpy.c rename to srcs/part1/ft_memccpy.c index a8bf1ee..fee3c2f 100644 --- a/srcs/add/ft_memccpy.c +++ b/srcs/part1/ft_memccpy.c @@ -5,14 +5,14 @@ /* +:+ +:+ +:+ */ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2018/11/14 21:12:10 by hulamy #+# #+# */ -/* Updated: 2019/04/03 15:42:41 by hulamy ### ########.fr */ +/* Created: 2019/11/25 15:24:51 by hulamy #+# #+# */ +/* Updated: 2019/11/25 15:25:09 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ /* -** copy string until character is found and place cursor in dst -** after last byte copied +** copy string until character is found and place cursor in dst +** after last byte copied */ #include "libft.h" diff --git a/srcs/part1/ft_strlcat.c b/srcs/part1/ft_strlcat.c index d81994f..91d14d8 100644 --- a/srcs/part1/ft_strlcat.c +++ b/srcs/part1/ft_strlcat.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 13:57:02 by hulamy #+# #+# */ -/* Updated: 2019/11/25 13:57:05 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:23:18 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,55 +14,58 @@ ** append src to sized dest and return size of final dest */ -/* +/* ** #include -** +** ** size_t ft_strlcat(char *dest, const char *src, size_t size); -** +** ** size_t ft_strlcat2(char *dest, char *src, size_t size); -** +** ** int ft_strlen(char *str) ** { ** int i; -** +** ** i = 0; ** while (str[i]) ** i++; ** return (i); ** } -** +** ** int main(int ac, char **av) ** { ** char tmp1[100]; ** char tmp2[100]; ** int i; -** +** ** i = atoi(av[3]); ** strcpy(tmp1, av[1]); ** strcpy(tmp2, av[2]); -** +** ** if (ac == 4) ** { -** printf("----strlcat: %zu - %s - %s\n", strlcat(tmp1, tmp2, i), tmp1, tmp2); -** +** printf("----strlcat: %zu - %s - %s\n", strlcat(tmp1, tmp2, i), +** tmp1, tmp2); +** ** strcpy(tmp1, av[1]); ** strcpy(tmp2, av[2]); -** -** printf("-ft_strlcat: %zu - %s - %s\n", ft_strlcat(tmp1, tmp2, i), tmp1, tmp2); -** +** +** printf("-ft_strlcat: %zu - %s - %s\n", ft_strlcat(tmp1, tmp2, i), +** tmp1, tmp2); +** ** strcpy(tmp1, av[1]); ** strcpy(tmp2, av[2]); -** -** printf("ft_strlcat2: %zu - %s - %s\n", ft_strlcat2(tmp1, tmp2, i), tmp1, tmp2); +** +** printf("ft_strlcat2: %zu - %s - %s\n", ft_strlcat2(tmp1, tmp2, i), +** tmp1, tmp2); ** } ** } -** +** ** size_t ft_strlcat2(char *dest, char *src, size_t size) ** { ** size_t i; ** size_t dest_length; ** size_t src_length; -** +** ** i = 0; ** dest_length = ft_strlen(dest); ** src_length = ft_strlen(src); @@ -79,7 +82,7 @@ ** return (dest_length + src_length); ** return (src_length + size); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/part1/ft_strlcpy.c b/srcs/part1/ft_strlcpy.c index f784918..45be72c 100644 --- a/srcs/part1/ft_strlcpy.c +++ b/srcs/part1/ft_strlcpy.c @@ -6,28 +6,28 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 13:57:19 by hulamy #+# #+# */ -/* Updated: 2019/11/25 13:57:22 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:28:12 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ -/* +/* ** copy size - 1 length of src into dest, ** terminate it with a '\0' ** and return size of src -*/ +*/ -/* +/* ** #include -** +** ** size_t ft_strlcpy(char *dest, const char *src, size_t size); -** +** ** int main(int argc, char **argv) ** { ** char str[100]; ** int i; ** unsigned int u; ** unsigned int v; -** +** ** i = atoi(argv[3]); ** strcpy(str, argv[2]); ** if (argc > 3) @@ -43,7 +43,7 @@ ** } ** return (0); ** } -*/ +*/ size_t ft_strlcpy(char *dest, const char *src, size_t size) { diff --git a/srcs/part2/ft_itoa.c b/srcs/part2/ft_itoa.c index 0baf45d..af0406b 100644 --- a/srcs/part2/ft_itoa.c +++ b/srcs/part2/ft_itoa.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 13:59:01 by hulamy #+# #+# */ -/* Updated: 2019/11/25 13:59:21 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:21:01 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,9 +16,9 @@ /* ** #include -** +** ** char *ft_itoa(int n) -** +** ** int main(int ac, char **av) ** { ** if (ac == 2) diff --git a/srcs/part2/ft_strmapi.c b/srcs/part2/ft_strmapi.c index f68be73..16060f2 100644 --- a/srcs/part2/ft_strmapi.c +++ b/srcs/part2/ft_strmapi.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:01:40 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:01:45 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:19:43 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,13 +15,13 @@ ** s by index i */ -/* +/* ** #include -** +** ** size_t ft_strlen(const char *str) ** { ** size_t i; -** +** ** i = 0; ** while (str[i]) ** i++; @@ -33,14 +33,14 @@ ** c -= 32; ** return (c); ** } -** +** ** char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); -** +** ** int main(int ac, char **av) ** { ** char *str; ** char touppercase(unsigned int, char); -** +** ** if (ac != 2) ** return (0); ** str = av[1]; @@ -49,7 +49,7 @@ ** printf("%s\n",str); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/part2/ft_strtrim.c b/srcs/part2/ft_strtrim.c index 881db23..46f6133 100644 --- a/srcs/part2/ft_strtrim.c +++ b/srcs/part2/ft_strtrim.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:01:49 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:01:54 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:20:41 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,14 +14,14 @@ ** create a copy of s without the firsts and lasts empty characters */ -/* +/* ** #include -** +** ** char *ft_substr(char const *s, unsigned int start, size_t len) ** { ** char *str; ** size_t i; -** +** ** if (!s) ** return (NULL); ** if (!(str = (char *)malloc(sizeof(char) * (len + 1)))) @@ -32,22 +32,22 @@ ** str[i++] = s[start++]; ** return (str); ** } -** +** ** size_t ft_strlen(const char *str) ** { ** size_t i; -** +** ** i = 0; ** while (str[i]) ** i++; ** return (i); ** } -** +** ** char *ft_strchr(const char *s, int c) ** { ** int i; ** int j; -** +** ** i = 0; ** j = -1; ** while (s[i]) @@ -57,17 +57,17 @@ ** return ((char *)s + j); ** return (NULL); ** } -** +** ** char *ft_strtrim(char const *s1, char const *set); -** +** ** int main(int ac, char **av) ** { ** if (ac == 3) ** printf("%s\n",ft_strtrim(av[1], av[2])); -** +** ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/srcs/part2/ft_substr.c b/srcs/part2/ft_substr.c index 189ba2c..16ebb54 100644 --- a/srcs/part2/ft_substr.c +++ b/srcs/part2/ft_substr.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/25 14:01:58 by hulamy #+# #+# */ -/* Updated: 2019/11/25 14:02:01 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 14:19:11 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,22 +14,22 @@ ** create a copy of a portion of s, begining at start and of length len */ -/* +/* ** #include -** +** ** char *ft_substr(char const *s, unsigned int start, size_t len); -** +** ** int main(int ac, char **av) ** { ** char *str; -** +** ** if (ac != 4) ** return (0); ** str = ft_substr(av[1], atoi(av[2]), atoi(av[3])); ** printf("%s\n",str); ** return (0); ** } -*/ +*/ #include "libft.h" diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index 82fb285..0000000 --- a/test/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -#-------------# -# VARIABLES # -#-------------# -NAME = libtest.a -CC = gcc -VPATH = srcs - -IDIR = includes -_DEPS = test.h -DEPS = $(_DEPS:%.h=$(IDIR)/%.h) - -LDIR = . -_LIBS = libtest.a -LIBS = $(_LIBS:lib%.a=%) - -SRCS = main.c to_uppercase.c putchar.c transform.c -ODIR = ./builds -OBJS = $(SRCS:%.c=$(ODIR)/%.o) - -CFLAGS = -I$(IDIR) -LFLAGS = -L$(LDIR) -l$(LIBS) - -#---------# -# RULES # -#---------# -all: $(ODIR) $(NAME) -#$(NAME): $(OBJS) $(DEPS) -# $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) -$(NAME): $(OBJS) $(DEPS) - ar rc $@ $(OBJS) -$(ODIR): - mkdir -p $@ -$(ODIR)/%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< - diff --git a/test/builds/main.o b/test/builds/main.o deleted file mode 100644 index 78735ef..0000000 Binary files a/test/builds/main.o and /dev/null differ diff --git a/test/builds/putchar.o b/test/builds/putchar.o deleted file mode 100644 index 824021b..0000000 Binary files a/test/builds/putchar.o and /dev/null differ diff --git a/test/builds/to_uppercase.o b/test/builds/to_uppercase.o deleted file mode 100644 index e8f61a5..0000000 Binary files a/test/builds/to_uppercase.o and /dev/null differ diff --git a/test/builds/transform.o b/test/builds/transform.o deleted file mode 100644 index 3c17dae..0000000 Binary files a/test/builds/transform.o and /dev/null differ diff --git a/test/includes/test.h b/test/includes/test.h deleted file mode 100644 index c40b808..0000000 --- a/test/includes/test.h +++ /dev/null @@ -1,10 +0,0 @@ -# ifndef TEST_H -# define TEST_H - -#include - -void ft_putchar(char c); -int transform(int a); -int to_uppercase(int a); - -# endif diff --git a/test/libdeux.a b/test/libdeux.a deleted file mode 100644 index 961c189..0000000 Binary files a/test/libdeux.a and /dev/null differ diff --git a/test/libtest.a b/test/libtest.a deleted file mode 100644 index 7318fbd..0000000 Binary files a/test/libtest.a and /dev/null differ diff --git a/test/libtrois.a b/test/libtrois.a deleted file mode 100644 index ab70bce..0000000 Binary files a/test/libtrois.a and /dev/null differ diff --git a/test/srcs/main.c b/test/srcs/main.c deleted file mode 100644 index e096911..0000000 --- a/test/srcs/main.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "test.h" - -int main() -{ - int a = 't'; - a = to_uppercase(a); - a = transform(a); - ft_putchar(a); - return(0); -} diff --git a/test/srcs/putchar.c b/test/srcs/putchar.c deleted file mode 100644 index 07d8c03..0000000 --- a/test/srcs/putchar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "test.h" - -void ft_putchar(char c) -{ - write(1, &c, 1); -} diff --git a/test/srcs/to_uppercase.c b/test/srcs/to_uppercase.c deleted file mode 100644 index 35d56ba..0000000 --- a/test/srcs/to_uppercase.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "test.h" - -int to_uppercase(int a) -{ - a -= 32; - return(a); -} diff --git a/test/srcs/transform.c b/test/srcs/transform.c deleted file mode 100644 index 744c097..0000000 --- a/test/srcs/transform.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "test.h" - -int transform(int a) -{ - return (--a); -} diff --git a/test/temp/putchar.c b/test/temp/putchar.c deleted file mode 100644 index 07d8c03..0000000 --- a/test/temp/putchar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "test.h" - -void ft_putchar(char c) -{ - write(1, &c, 1); -} diff --git a/test/temp/transform.c b/test/temp/transform.c deleted file mode 100644 index 744c097..0000000 --- a/test/temp/transform.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "test.h" - -int transform(int a) -{ - return (--a); -} diff --git a/test/test b/test/test deleted file mode 100755 index 8b65d74..0000000 Binary files a/test/test and /dev/null differ