mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
fix files
This commit is contained in:
@@ -44,4 +44,3 @@ void adaptive(t_stacks *piles)
|
||||
(void)piles;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ static void print_disorder(t_stacks *stacks)
|
||||
nbr = (int) stacks->disorder * 10000;
|
||||
str = ft_itoa(nbr);
|
||||
if (!str)
|
||||
exit ( EXIT_FAILURE );
|
||||
exit (EXIT_FAILURE);
|
||||
secure_write(2, "[bench] disorder: ", 18);
|
||||
if (ft_strlen(str) == 2)
|
||||
secure_write(2, "0", 1);
|
||||
|
||||
10
flags/flag.c
10
flags/flag.c
@@ -32,20 +32,20 @@ int calcul_mod(int argc, char **argv)
|
||||
{
|
||||
int mod;
|
||||
|
||||
if (verif_arg(argv[argc -1]))
|
||||
if (!verif_arg(argv[argc -1]))
|
||||
{
|
||||
if (ft_strncmp(argv[1], "--", 2) && ft_strncmp(argv[2], "--", 2))
|
||||
if (ft_strncmp("--", argv[1], 2) && ft_strncmp("--", argv[2], 2))
|
||||
mod = 2;
|
||||
else if (ft_strncmp(argv[1], "--", 2) && !ft_strncmp(argv[2], "--", 2))
|
||||
else if (ft_strncmp("--", argv[1], 2) && !ft_strncmp("--", argv[2], 2))
|
||||
mod = 1;
|
||||
else
|
||||
mod = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ft_strncmp(argv[1], "--", 2) && ft_strncmp(argv[2], "--", 2))
|
||||
if (ft_strncmp("--", argv[1], 2) && ft_strncmp("--", argv[2], 2))
|
||||
mod = 5;
|
||||
else if (ft_strncmp(argv[1], "--", 2) && !ft_strncmp(argv[2], "--", 2))
|
||||
else if (ft_strncmp("--", argv[1], 2) && !ft_strncmp("--", argv[2], 2))
|
||||
mod = 4;
|
||||
else
|
||||
mod = 3;
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
#ifndef PARSING_H
|
||||
# define PARSING_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "push_swap.h"
|
||||
# include <stdlib.h>
|
||||
# include "push_swap.h"
|
||||
|
||||
int ft_atoi(const char *nptr);
|
||||
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);
|
||||
void free_tab(char **tab);
|
||||
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);
|
||||
void free_tab(char **tab);
|
||||
int checker(int argc, char **argv);
|
||||
int len_split(char **tab);
|
||||
int len_split(char **tab);
|
||||
char *ft_itoa(int n);
|
||||
int ft_isdigit(int c);
|
||||
|
||||
|
||||
10
main.c
10
main.c
@@ -16,11 +16,11 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (!checker(argc, argv))
|
||||
{
|
||||
write(2, "Error !\n", 8);
|
||||
return (1);
|
||||
}
|
||||
// if (!checker(argc, argv))
|
||||
// {
|
||||
// write(2, "Error !\n", 8);
|
||||
// return (1);
|
||||
// }
|
||||
if (argc > 1)
|
||||
test1(argc, argv);
|
||||
return (0);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
int ft_strncmp(const char *s1, const char *s2, int n)
|
||||
{
|
||||
int i;
|
||||
int res;
|
||||
|
||||
i = 0;
|
||||
if (n == 0)
|
||||
@@ -21,5 +22,9 @@ int ft_strncmp(const char *s1, const char *s2, int n)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
|
||||
res = (unsigned char)s1[i] - (unsigned char)s2[i];
|
||||
if (res == 0)
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
void secure_write(int fd, char *str, int len)
|
||||
{
|
||||
if (write(fd, str, len) < 0)
|
||||
exit ( EXIT_FAILURE );
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
12
test_one.c
12
test_one.c
@@ -20,16 +20,14 @@
|
||||
int test1(int argc, char **argv)
|
||||
{
|
||||
t_stacks *piles;
|
||||
t_tab *preset;
|
||||
int mod;
|
||||
|
||||
piles = NULL;
|
||||
if (argc > 1)
|
||||
{
|
||||
piles = init_piles(argc, argv, 0);
|
||||
mod = calcul_mod(argc, argv);
|
||||
piles = init_piles(argc, argv, mod);
|
||||
flags(pos_flag(argv, mod), pos_bench(argv, mod), argv, piles);
|
||||
if (piles->bench == 1)
|
||||
print_bench(piles);
|
||||
preset = get_tabs(piles->a, range_bucket(piles->a));
|
||||
bucket_algo(piles, preset, range_bucket(piles->a));
|
||||
}
|
||||
free_all(piles);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user