Пример #1
0
static void		ft_continue_child(t_data *d, t_id *tmp)
{
	ft_printf("[%d]\tcontinued\t%s\n", tmp->nb, tmp->cmd);
	if (tcsetpgrp(d->tty.fd, getpgid(tmp->pid)) < 0)
		ft_puterror("tcsetpgrp in builtin/ft_fg.c line 23: failed\n");
	if (!tmp->run && killpg(tmp->pid, SIGCONT) < 0)
		ft_puterror("kill in builtin/ft_fg.c line 25: failed\n");
	tmp->jobs = 0;
	tmp->run = 0;
	waitpid(-tmp->pid, &tmp->id, WUNTRACED);
	ft_print_process(d, tmp);
	if (tcsetpgrp(d->tty.fd, getpgrp()) < 0)
		ft_puterror("tcsetpgrp in builtin/ft_fg.c line 30: failed\n");
}
Пример #2
0
Файл: dir.c Проект: GustaveD/sl
int			ft_dir_process(t_list *dirlst, char *opt)
{
	DIR		*dir;
	t_list	*dir_content;
	t_list	*tmp;

	tmp = dirlst;
	dir_content = NULL;
	if (IS_OPT)
		ft_print_name(((t_info*)tmp->content),opt);
	dir = opendir(((t_info*)tmp->content)->dirent->d_name);
	if (dir == NULL)
		return (-1);
	ft_get_dir_content(dir, &dir_content, ((t_info*)tmp->content)->dirent->d_name, opt);
	if (dir_content)
	{
		if (IS_OPT)
			ft_print_process(&dir_content, opt);
		ft_dir_recurs(&dir_content, opt);
		ft_lstdel(&dir_content, ft_free_info);
	}
	closedir(dir);
	return (0);
}