Beispiel #1
0
int		main(int ac, char **av)
{
	t_all			all;
	int				ret;

	all.elem = NULL;
	all.win.nb_elem = 0;
	all.show = 1;
	if (ac > 1 && av[1] != NULL)
	{
		ft_signal();
		if (init_term(&all))
			return (-1);
		if ((ret = init_lst(&(all.elem), av, &all)) == TRUE)
		{
			memoire(&all, 0);
			ret = ft_select(&all);
		}
		if (reset_term(&all) == -1)
			return (-1);
		if (ret == -2)
			print_select(&all);
		if (all.win.nb_elem > 0)
			freelst(&all);
	}
	return (0);
}
Beispiel #2
0
static int		algo(const char *s, char c, char **ss, int x)
{
	int a;
	int index;

	a = 0;
	while (s[a])
	{
		if (s[a] != c)
		{
			index = memoire(a, c, s);
			ss[x] = (char*)malloc(sizeof(char) * index + 1);
			index = 0;
			while (a < contage(a, c, s))
			{
				ss[x][index] = s[a];
				index++;
				a++;
			}
			ss[x][index] = '\0';
			x++;
			a--;
		}
		a++;
	}
	return (x);
}