purge ancien files et mise a jour libftH
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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 *))
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -1,16 +1,32 @@
|
||||
/*
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lstsize.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
BIN
srcs/part1/.ft_strlcpy.c.swp
Normal file
BIN
srcs/part1/.ft_strlcpy.c.swp
Normal file
Binary file not shown.
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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
|
||||
*/
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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"
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,28 +6,28 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** char *ft_itoa(int n)
|
||||
**
|
||||
**
|
||||
** int main(int ac, char **av)
|
||||
** {
|
||||
** if (ac == 2)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <libc.h>
|
||||
**
|
||||
**
|
||||
** 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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user