FIX: parsing cleanup

This commit is contained in:
2026-01-17 16:36:59 +01:00
parent 52e1ef8947
commit e947183aab
6 changed files with 31 additions and 136 deletions

View File

@@ -26,61 +26,14 @@ int calcul_mod(int argc, char **argv)
return (mod);
}
int pos_flag(char **argv, int mod)
void flags(t_stacks *stacks)
{
if (mod == 1 || mod == 4)
{
if (!ft_strncmp(argv[1], "--bench", 20))
return (1);
}
else if (mod == 2 || mod == 5)
{
if (!ft_strncmp(argv[1], "--bench", 20))
return (1);
else
return (2);
}
return (0);
}
int pos_bench(char **argv, int mod)
{
if (mod == 1 || mod == 4)
{
if (ft_strncmp(argv[1], "--bench", 20))
return (1);
}
else if (mod == 2 || mod == 5)
{
if (ft_strncmp(argv[1], "--bench", 20))
return (1);
else
return (2);
}
return (0);
}
void flags(int pos, int pos_b, char **argv, t_stacks *stacks)
{
if (ft_strncmp(argv[pos], "--simple", 30) && pos > 0)
{
stacks->algo = 1;
if (stacks->algo == 1)
simple(stacks);
}
else if (ft_strncmp(argv[pos], "--medium", 30) && pos > 0)
{
stacks->algo = 2;
if (stacks->algo == 1)
medium(stacks);
}
else if (ft_strncmp(argv[pos], "--complex", 30) && pos > 0)
{
stacks->algo = 3;
if (stacks->algo == 1)
complex(stacks);
}
else if (ft_strncmp(argv[pos], "--adaptive", 30) && pos > 0)
adaptive(stacks, argv);
else
adaptive(stacks, argv);
if (pos_b > 0)
stacks->bench = 1;
adaptive(stacks);
}