Exemplo n.º 1
0
Arquivo: pipes.c Projeto: jalcim/42sh
int		exec_pipes(char *line, t_sh *t)
{
	pid_t	fo;
	int		f;

	pipe(t->pipe_fd);
	fo = 0;
	f = t->pv2;
	if ((fo = fork()) < 0)
	{
		ft_putstr_fd("fork error yeah\n", 2);
		exit(0);
	}
	if (!fo)
		exec_son(line, t);
	else
	{
		if ((f = exec_fath(line, t)) < 0)
		{
			dup2(1, 0);
			return (-1);
		}
	}
	if (!t->save_c)
		wait(0);
	dup2(1, 0);
	return (f);
}
Exemplo n.º 2
0
/* bll and parent bll  */
int pre_exec_new(struct band_list_el *head){

  struct band_list_el *bll = head;

  int id = bll->band_id;

  switch(id){
  case CAPET_NUMB:
    return exec_capet_numb(bll);
  case CAPET_CHR:
    return exec_capet_chr(bll);
  case CAPET_STR:
    return exec_capet_str(bll);
  case CAPET_FLOAT:
    return exec_capet_float(bll);
  case CAPET_IDT:
    return exec_capet_idt(bll);
  case CAPET_CRG1:
    return exec_capet_crg1(bll);
  case CAPET_CRG2:
    return exec_capet_crg2(bll);
  case CAPET_STRMEM:
    return exec_capet_strmem(bll);
  case CAPET_EXPR:
    return exec_capet_expr(bll);
  case INIT_DOVR:
    return exec_init_dovr(bll);
  case CHECK_DOVR:
    return exec_check_dovr(bll);
  case STEP_DOVR:
    return exec_step_dovr(bll);
  case NEQEDERKI2:
    return exec_neqederki_exp(bll);
  case NEQ_TOP:
    return exec_neq_top(bll);
  case SEC1:
    return exec_secim(bll);
  case HAL1:
    return exec_hal1(bll);
  case HAL1S:
    return exec_hal1s(bll);
  case SUS1:
	  return exec_sus1(bll);
  case FREE_SEC_DYN_STK:
	  return exec_free_sec_dyn_stk(bll);
  case EGER_EXP2:
    return exec_eger_exp(bll);
  case YOXSA:
    return exec_yoxsa(bll);
  case ASGN:
    return exec_asgn(bll);
  case NUMB:
    return exec_numb(bll);
  case ARTSIN:
    return exec_artsin(bll);
  case AZALSIN:
    return exec_azalsin(bll);
  case FLOAT:
    return exec_float(bll);
  case SHERT:
    return exec_shert(bll);
  case CHR:
    return exec_chr(bll);
  case EXPR:
    return exec_expr(bll);
  case STR_ADRS:
    return exec_str_adrs(bll);
  case IDT_ADRS:
    return exec_idt_adrs(bll);
  case IDT_VAL:
    return exec_idt_val(bll);
  case IDT_OFST:
    return exec_idt_ofst(bll);
  case CRG1_ADRS:
    return exec_crg1_adrs(bll);
  case CRG1_VAL:
    return exec_crg1_val(bll);
  case CRG1_OFST:
    return exec_crg1_ofst(bll);
  case CRG2_OFST:
    return exec_crg2_ofst(bll);
  case STRMEM_VAL:
    return exec_strmem_val(bll);
  case CRG2_ADRS:
    return exec_crg2_adrs(bll);
  case CRG2_VAL:
    return exec_crg2_val(bll);
  case DAXILET_IDT:
    return exec_daxilet_idt(bll); 
  case DAVAMET1:
    return exec_davamet1(bll);
  case DAYAN1:
    return exec_dayan1(bll);
  case FUNK:
    return exec_func(bll);
  case FCALL1:
    return exec_fcall1(bll, NULL);
  case SNMEM:
    return exec_snmem(bll);
  case PUT_RET_ADDR:
    return exec_put_ret_addr(bll);
  case POP_OBSTK:
    return exec_pop_obstk(bll);
  case FARGS_NUMB:
    return exec_fargs_numb(bll);
  case FPARM_IDT_VAL:
    return exec_fparm_idt_val(bll);
  case QAYTAR1:
    return exec_qaytar1(bll);
  case SON:
    return exec_son(bll);
 }

  return 0;
}