示例#1
0
文件: main.c 项目: Zained/42-select
int		ft_loop(char **av, t_truc *c)
{
	ft_argv_list(av, c);
	if (!ft_check_size(c))
		ft_print_list(c);
	ft_restruct(c, 0);
	while (1)
	{
		if (!ft_command(c))
			return (0);
	}
	return (0);
}
示例#2
0
文件: fork.c 项目: francoios/Ft_P
static void			fork_child(t_uenv *user)
{
	int							ret;
	char						pwd[4096];
	char						data[1024];

	getcwd(pwd, 4096);
	while (42)
	{
		if ((ret = recv(user->cs, data, 1024, 0)) > 0)
		{
			data[ret - 1] = '\0';
			printf("[%d] \x1B[33mreceived %d bytes: [%s]\x1B[0m\n",
					user->cs, ret, data);
			if (ft_command(data, user, pwd) == 0)
				return ;
			ft_strclr(data);
		}
		else
			break ;
		ret = 0;
	}
	close(user->cs);
}