summaryrefslogtreecommitdiffstats
path: root/libft/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'libft/main.c')
-rw-r--r--libft/main.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/libft/main.c b/libft/main.c
new file mode 100644
index 0000000..d0cacd5
--- /dev/null
+++ b/libft/main.c
@@ -0,0 +1,122 @@
+#include "libft.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <limits.h>
+#include <inttypes.h>
+
+/*
+** static void
+** putlst(t_list *lst, t_list *init)
+** {
+** uint8_t i;
+**
+** i = 0;
+** printf("list:\n");
+** while (lst != NULL)
+** {
+** printf("lst[%d] (%s)\n", i, (char*)lst->content);
+** lst = lst->next;
+** i++;
+** }
+** lst = init;
+** }
+**
+** static void
+** delfunc(void *content)
+** {
+** free(content);
+** }
+**
+** #include <unistd.h>
+** int main(void) {
+** t_list *lst = NULL;
+** t_list *init = NULL;
+**
+** char *c0;
+** char *c1;
+** char *c2;
+** char *c3;
+** char *c4;
+** char *c5;
+** char *c6;
+** char *c7;
+**
+** c0 = (char *)ft_calloc(6, sizeof(char));
+** c1 = (char *)ft_calloc(6, sizeof(char));
+** c2 = (char *)ft_calloc(6, sizeof(char));
+** c3 = (char *)ft_calloc(6, sizeof(char));
+** c4 = (char *)ft_calloc(6, sizeof(char));
+** c5 = (char *)ft_calloc(6, sizeof(char));
+** c6 = (char *)ft_calloc(6, sizeof(char));
+** c7 = (char *)ft_calloc(6, sizeof(char));
+** if (!c0 || !c1 || !c2 || !c3 || !c4 || !c5 || !c6 || !c7)
+** return 1;
+** memcpy(c0, "first", 6);
+** memcpy(c1, "secon", 6);
+** memcpy(c2, "third", 6);
+** memcpy(c3, "fooba", 6);
+** memcpy(c4, "qweqw", 6);
+** memcpy(c5, "AAAAA", 6);
+** memcpy(c6, "front", 6);
+** memcpy(c7, "_back", 6);
+**
+** // INIT
+** printf("INIT\n");
+** lst = ft_lstnew(c0);
+** init = lst;
+** lst->next = ft_lstnew(c1);
+** lst = lst->next;
+** lst->next = ft_lstnew(c2);
+** lst = lst->next;
+** lst->next = ft_lstnew(c3);
+** lst = lst->next;
+** lst->next = ft_lstnew(c4);
+** lst = lst->next;
+** lst->next = ft_lstnew(c5);
+** lst = lst->next;
+** lst = init;
+** putlst(lst, init);
+**
+*/ /* ADD FRONT */
+/* printf("\n\nft_lstadd_front\n");
+** ft_lstadd_front(&lst, ft_lstnew(c6));
+** putlst(lst, init);
+**
+*/ /* ADD BACK */
+/* printf("\n\nft_lstadd_back\n");
+** ft_lstadd_back(&lst, ft_lstnew(c7));
+** putlst(lst, init);
+**
+*/ /* DELONE */
+/* printf("\n\nft_lstdelone\n");
+** ft_lstdelone(lst->next->next, &delfunc);
+** putlst(lst, init);
+** lst->next->next = ft_lstnew(c3);
+**
+*/ /* CLEAR */
+/* printf("\n\nft_lstclear\n");
+** ft_lstclear(&lst, &delfunc);
+** putlst(lst, init);
+**
+** char dst[40] = "foo";
+** char src[40] = "foo";
+** size_t len = 4;
+** printf("%s\n", ft_strnstr(dst, src, len));
+** return 0;
+** }
+*/
+
+int main(void) {
+ char dst[40] = "bar";
+ char src[40] = "Foobar";
+
+ char dst2[40] = "bar";
+ char src2[40] = "Foobar";
+
+ size_t len = 8;
+ printf("FT_RETURN (%s)\n", ft_memmove(dst, src, len));
+ printf("C__RETURN (%s)\n", memmove(dst2, src2, len));
+ return (0);
+}