mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
adding split substr strlen
This commit is contained in:
2
Makefile
2
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
|
||||
|
||||
|
||||
@@ -13,8 +13,14 @@
|
||||
#ifndef PARSING_H
|
||||
# define PARSING_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#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
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <stdlib.h>
|
||||
#include "parsing.h"
|
||||
|
||||
static size_t count_words(char const *s, char c)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <stdlib.h>
|
||||
#include "parsing.h"
|
||||
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user