Example #1
0
int			main(int ac, char **av)
{
	char	*buffer;
	int		cnt_tetri;
	int		***tetri;
	int		**map;

	ft_check_ac(ac);
	buffer = ft_get_file(av[1]);
	ft_check_file(buffer);
	cnt_tetri = ft_count_tetri(buffer);
	tetri = ft_split_tetri(buffer);
	map = ft_resol(tetri, cnt_tetri);
	ft_print_map(map);
	ft_free_map(map);
	map = NULL;
	ft_free_tetri(tetri, cnt_tetri);
	tetri = NULL;
	return (0);
}
Example #2
0
File: main.c Project: 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);
}
Example #3
0
int			get_client(int sock, char *cmd)
{
	char	**tab;
	int		ret;
	char	buf[BUFF_LEN + 1];

	tab = ft_strsplit(cmd, ' ');
	if (!tab[1])
		return (client_error(-4));
	send(sock, cmd, ft_strlen(cmd), 0);
	ret = recv(sock, buf, BUFF_LEN, 0);
	buf[ret] = '\0';
	if (!ft_strcmp(GET_FAIL, buf))
	{
		printf("ERROR: You failed to receive the file: %s\n", tab[1]);
		return (0);
	}
	else if (!ft_strcmp(GET_OK, buf))
		ft_get_file(tab[1], sock);
	ft_tabfree(&tab);
	return (0);
}