Example #1
0
void	check_stdin(t_lemin *l, char *line, char *prev, int i)
{
	if (i == 0)
	{
		if (error_number(line))
		{
			ft_putstr("ERROR");
			exit(0);
		}
		else
			l->number_ant = ft_atoi(line);
	}
	else if (i > 0)
	{
		if (check_rooms(line) && check_tube(line))
		{
			ft_putstr("ERROR\n");
			exit(0);
		}
		else
		{
			if (check_rooms(line) == 0)
				handle_listrooms(l, line, prev);
			if (check_tube(line) == 0)
				handle_listtubes(l, line);
		}
	}
}
Example #2
0
static int		check_str(char *str, t_rooms *room)
{
	static int	flag = 1;
	int			i;

	i = 0;
	if (flag == 1)
	{
		if (check_room(str, 0) == 0)
		{
			flag = 2;
			return (check_str(str, room));
		}
		else
			return (1);
	}
	return (check_tube(str, 0, room));
}
Example #3
0
File: take.c Project: elivet/Lem_in
t_data		information(t_data the)
{
	the = first_take(the);
	if (the.nbr == 0)
		error();
	while (get_next_line(0, &the.line))
	{
		if (the.line[0] == '\0')
			error();
		the.j++;
		the.aff[the.j] = ft_strdup(the.line);
		if (check_tube(the.line) == 1)
		{
			the.tube[the.i] = ft_strdup(the.line);
			the.i++;
		}
		the = take_start(the);
		if (check_room(the) == 1)
			check_it(the);
		the = take_end(the);
	}
	the = finish(the, the.i, the.j);
	return (the);
}