コード例 #1
0
/** \brief Return the octal representation of the file_perm_t
 * 
 * - it is typically what open()/umask() syscall() uses
 */
int	file_perm_t::to_octal()		const throw()
{
	int	value	= 0;
	// convert the file_perm_t into octal
	if( is_usr_read() )	value	|= S_IRUSR;
	if( is_usr_write() )	value	|= S_IWUSR;
	if( is_usr_exec() )	value	|= S_IXUSR;
#ifndef	_WIN32
	if( is_grp_read() )	value	|= S_IRGRP;
	if( is_grp_write() )	value	|= S_IWGRP;
	if( is_grp_exec() )	value	|= S_IXGRP;
	if( is_oth_read() )	value	|= S_IROTH;
	if( is_oth_write() )	value	|= S_IWOTH;
	if( is_oth_exec() )	value	|= S_IXOTH;
#endif
	// return the just built value
	return value;
}
コード例 #2
0
ファイル: process_group.c プロジェクト: EPITECH-Bordeaux/42sh
int	exec_process_group(t_sh *shell, t_grp *grp)
{
  int	tmp;

  if (grp == NULL)
    return (-1);
  if ((tmp = (is_grp_exec(shell, grp) - 1)) != -1)
    tmp = open_redirection(grp, shell);
  if (MEXIT)
    return (0);
  if (tmp != -1)
    if ((exec_a_pipe(shell, grp) == -1) || (MEXIT))
      return (-1);
  shell->process_group = (t_grp**)add_ptr_t_tab((void**)shell->process_group,
                         (void*)grp);
  if (GETFLAG(grp->flags, FLAGPOS(FGRP_FORGROUND)) && (grp->pid.pgid != -1))
    set_forground_process_g(shell, grp);
  else
    UNSETFLAG(grp->flags, FLAGPOS(FGRP_FORGROUND));
  return (0);
}