static chunk_t *chunk_search(chunk_t *cur, const check_t check_fct, const nav_t nav, const loc_t dir, const bool cond) { /* Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do /* loop over the chunk list */ { pc = search_function(pc, nav); /* in either direction while */ } while ((pc != NULL) && /* the end of the list was not reached yet */ (check_fct(pc) != cond)); /* and the demanded chunk was not found either */ return(pc); /* the latest chunk is the searched one */ }
static chunk_t *chunk_search(chunk_t *cur, const check_t check_fct, const scope_e scope, const direction_e dir, const bool cond) { /* * Depending on the parameter dir the search function searches * in forward or backward direction */ search_t search_function = select_search_fct(dir); chunk_t *pc = cur; do // loop over the chunk list { pc = search_function(pc, scope); // in either direction while } while ( pc != nullptr // the end of the list was not reached yet && (check_fct(pc) != cond)); // and the demanded chunk was not found either return(pc); // the latest chunk is the searched one }
int father_n_son(char **cmd, char **env, t_duo **env_cpy) { pid_t father; int stat_loc; father = fork(); if (father > 0) { check_signal(3); wait(&stat_loc); } if (father == 0) { check_signal(2); check_fct(cmd, env, env_cpy); ft_putstr("minishell: "); ft_putstr(cmd[0]); ft_putendl(": command not found"); exit(EXIT_FAILURE); } return (0); }