Initial commit

This commit is contained in:
2026-01-09 15:20:33 +01:00
commit d0a9d550e5
31 changed files with 2248 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/01 15:03:15 by lejulien #+# #+# */
/* Updated: 2021/04/02 13:31:16 by lejulien ### ########.fr */
/* */
/* ************************************************************************** */
#include "../utils/utils.h"
#include <stdlib.h>
int
check_num(int ac, char **av)
{
int i;
int j;
i = 1;
while (i < ac)
{
j = 0;
while (av[i][j] != '\0')
{
if (av[i][j] < '0' || av[i][j] > '9')
{
if (av[i][j] != '-')
return (1);
}
j++;
}
i++;
}
return (0);
}
int
check_max(int ac, char **av)
{
int i;
char *tmp;
int i_tmp;
i = 1;
while (i < ac)
{
if (av[i][0] == '\0')
return (1);
i_tmp = ft_atoi(av[i]);
tmp = ft_itoa(i_tmp);
if (i_tmp != 0 && my_strcmp(av[i], tmp))
{
free(tmp);
return (1);
}
free(tmp);
i++;
}
return (0);
}