Ejemplo n.º 1
0
int		add_room(char *line, t_map *map, int comm)
{
	t_node	*n;
	char	**s;
	t_node	*tmp;

	if (!(s = ft_strsplit(line, ' ')))
		return (FALSE);
	if (!(s[0]))
	{
		free(s);
		return (FALSE);
	}
	tmp = map->begin_list;
	n = lemin_createnode(s[0], ft_atoi(s[1]), ft_atoi(s[2]), tmp);
	if (n && n->changed == 0)
	{
		tmp = map->begin_list;
		while (map->begin_list->next)
			map->begin_list = map->begin_list->next;
		map->begin_list->next = n;
		map->begin_list = tmp;
		map->nb_nde += 1;
	}
	n ? add_start_end(map, n, comm) : NULL;
	ft_tabstrdel(&s, 3);
	return (n ? 1 : FALSE);
}
Ejemplo n.º 2
0
static int  pathisdir_next(char **files, char *dos, char *tmp, char *path)
{
	int		count;
	int		ret;

    count = -1;
	ret = 0;
	while (files[++count])
		if (ft_strcmp(dos, files[count]) == 0)
			ret = 1;
	ft_tabstrdel(&files);
	ft_strdel(&dos);
	ft_strdel(&tmp);
    if (ret == 1)
    {
        files = ft_getdirtab(path, NULL);
        if (!files)
            ret = 0;
        else
	        ft_tabstrdel(&files);
    }
    return (ret);
}
Ejemplo n.º 3
0
void        date_convert_time(char *str, t_date *date)
{
    char    **tmp;

    if (str)
    {
        tmp = ft_strsplit(str, ':');
        if (tmp != NULL && tmp[1] != NULL && tmp[2] != NULL)
        {
            date->hour = ft_atoi(tmp[0]);
            date->minute = ft_atoi(tmp[1]);
            date->seconde = ft_atoi(tmp[2]);
        }
        if (tmp != NULL)
            ft_tabstrdel(tmp);
    }
}
Ejemplo n.º 4
0
void        date_convert_date(char *str, t_date *date)
{
    char    **tmp;

    if (str)
    {
        tmp = ft_strsplit(str, '/');
        if (tmp != NULL && tmp[1] != NULL && tmp[2] != NULL)
        {
            date->day = ft_atoi(tmp[0]);
            date->month = ft_atoi(tmp[1]);
            date->year = ft_atoi(tmp[2]);
        }
        if (tmp != NULL)
            ft_tabstrdel(tmp);
    }
}
Ejemplo n.º 5
0
Archivo: main.c Proyecto: ntrancha/Wifi
int         main(void)
{
    char    *file;
    char    **line;
    int     num;

    system("./script.sh 2> /dev/null");
    file = ft_get_file(".result");
    if (file && ft_strlen(file) > 100)
    {
        num = -1;
        line = ft_strsplit(file, '\n');
        while (line[++num])
            if ((line[num])[0] != '#'  && (line[num])[0] != ' ')
                if ((line[num])[0] != '\t' && ft_strlen(line[num]) > 10)
                    decoupe(line[num]);
        ft_tabstrdel(&line);
    }
    ft_strdel(&file);
    return (0);
}
Ejemplo n.º 6
0
t_date      *ft_date_convert(char *str)
{
    char    **ret;
    t_date  *date;

    ret = ft_strsplit(str, ' ');
    if (count_char(str, ' ') != 1)
        return (NULL);
    if (count_char(str, '/') != 2)
        return (NULL);
    if (count_char(str, ':') != 2)
        return (NULL);
    if (ret != NULL && ret[1] != NULL && !ret[2])
    {
        if (!(date = date_create()))
            return (NULL);
        date_convert_time(ret[0], date);
        date_convert_date(ret[1], date);
        ft_tabstrdel(ret);
        return (date);
    }
    return (NULL);
}