char *my_backquote(char *str) { int fd_pid[2]; char *dest; char **bq; if ((bq = init_bq(str)) == 0) return (0); if ((fd_pid[1] = fork()) == -1) { free_quote(bq); return (0); } if (fd_pid[1] != 0) { if (redir_droite(bq) == 0) { free_quote(bq); return (0); } } else if ((dest = father_backquote(fd_pid, bq)) == 0) return (0); free_quote(bq); return (dest); }
int gere_redir(char **path, char **cmd) { int red; red = check_redir(cmd); if (red == 1) return (redir_droite(path, cmd)); if (red == 2) return (redir_droite_double(path, cmd)); if (red == 3) return (redir_gauche(path, cmd)); if (red == 4) return (redir_gauche_double(path, cmd)); return (0); }
int simple(char **tabeulo) { int status; if (tabeulo[1][0] == '>') { if (redir_droite(tabeulo) == 0) return (0); } else if (tabeulo[1][0] == '<') { if (redir_gauche(tabeulo) == 0) return (0); } else if (tabeulo[1][0] == '|') { if (fork()) wait(&status); else if (my_pipe(0, tabeulo) == 0) return (0); } return (1); }