From 8dbf9f6c6edad95ea71e4802c8c416219f025efa Mon Sep 17 00:00:00 2001 From: Maoake Teriierooiterai Date: Thu, 8 Jan 2026 13:50:38 +0100 Subject: [PATCH] adding split substr strlen --- Makefile | 2 +- headers/parsing.h | 8 +++++++- parsing/ft_split.c | 3 ++- parsing/ft_substr.c | 3 ++- parsing/parsing.c | 8 ++++++++ test_one.c | 3 +-- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9911a0a..c6e3f5b 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ INSERTION = insertion.c FLAGS_FILES = algorithms_sort.c flag.c -PARSING = ft_atoi.c parsing.c ft_strncmp.c +PARSING = ft_atoi.c parsing.c ft_strncmp.c ft_split.c ft_strlen.c ft_substr.c STACK_UTILS = push.c rev_rotate.c rotate.c stack_add.c stack_remove.c stacks_len.c swap.c print_stacks.c diff --git a/headers/parsing.h b/headers/parsing.h index 72ac070..ad07753 100644 --- a/headers/parsing.h +++ b/headers/parsing.h @@ -13,8 +13,14 @@ #ifndef PARSING_H # define PARSING_H +#include +#include "push_swap.h" + int ft_atoi(const char *nptr); -t_stacks *init_big_stacks(int argc, char **argv); +t_stacks *init_piles(int argc, char **argv, int mod); int ft_strncmp(const char *s1, const char *s2, int n); +size_t ft_strlen(const char *s); +char *ft_substr(char const *s, unsigned int start, size_t len); +char **ft_split(char const *s, char c); #endif diff --git a/parsing/ft_split.c b/parsing/ft_split.c index 8c136cd..c205ad1 100644 --- a/parsing/ft_split.c +++ b/parsing/ft_split.c @@ -10,7 +10,8 @@ /* */ /* ************************************************************************** */ -#include "libft.h" +#include +#include "parsing.h" static size_t count_words(char const *s, char c) { diff --git a/parsing/ft_substr.c b/parsing/ft_substr.c index 24a4069..b234dc7 100644 --- a/parsing/ft_substr.c +++ b/parsing/ft_substr.c @@ -10,7 +10,8 @@ /* */ /* ************************************************************************** */ -#include "libft.h" +#include +#include "parsing.h" char *ft_substr(char const *s, unsigned int start, size_t len) { diff --git a/parsing/parsing.c b/parsing/parsing.c index 4ab2c44..90ffe1b 100644 --- a/parsing/parsing.c +++ b/parsing/parsing.c @@ -52,6 +52,14 @@ static t_stack *special_parsing(int argc, char **argv, int mod) t_stacks *piles; t_stack *first; t_stack *new; + char **split_tab; + int i; + + i = 0; + split_tab = ft_split(arv[wich_mod(mod)]); + if (!split_tab) + return (NULL); + while () } t_stacks *init_piles(int argc, char **argv, int mod) diff --git a/test_one.c b/test_one.c index 7ea1979..d451380 100644 --- a/test_one.c +++ b/test_one.c @@ -24,11 +24,10 @@ int test1(int argc, char **argv) piles = NULL; if (argc > 1) { - piles = init_big_stacks(argc, argv); + piles = init_piles(argc, argv, 0); preset = get_tabs(piles->a, range_bucket(piles->a)); bucket_algo(piles, preset, range_bucket(piles->a)); } free_all(piles); - free(piles); return (0); }