push_swap/tools_2.c
Etienne Rey-bethbeder 5fe90a0875 Correction leak
2022-12-09 18:02:14 +01:00

51 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools_2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/09 15:54:00 by erey-bet #+# #+# */
/* Updated: 2022/12/09 15:54:03 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int put_error(void)
{
write(2, "Error\n", 6);
return (1);
}
char **set_only_space(char *argv[], int i)
{
int x;
x = 0;
while (argv[i][x])
if (ft_strchr("\a\b\t\n\v\f\r", argv[i][x++]) != NULL)
argv[i][x - 1] = ' ';
return (argv);
}
int if_there_is_double(long *tab, int y)
{
int i;
int x;
i = 0;
while (i < y)
{
x = 0;
while (x < y)
{
if (tab[i] == tab[x] && i != x)
return (1);
x++;
}
i++;
}
return (0);
}