int line_processor (struct line_read_state * state, char * line, int len, int counter, int err_code){ if(err_code != _GETLINE_NONE && err_code != _GETLINE_EOF) return -1; if(len > 0){ state->line_counter++; if(state->line_counter == 1){ return init_complex_pipe(&state->pipe, create_exec_args(line)); }else{ struct str_splited_pair pointers [3]; int cnt = _split(line, " ", pointers, 2); if(cnt < 2){ _print(STDERR_FILENO, "Wrong format!\n"); return 0; } *pointers[0].end = '\0'; *pointers[1].end = '\0'; if(strcmp(pointers[0].start, "->") == 0){ return bind_left(&state->pipe, create_exec_args(pointers[1].start)); }else if(strcmp(pointers[0].start, "<-") == 0){ return bind_right(&state->pipe, create_exec_args(pointers[1].start)); }else{ _print(STDERR_FILENO, "Wrong format!\n"); return 0; } } }else{ return 1; } return 0; }
INLINE S&& operator<<(S&& s, T&& t) { return fwd <S>(s) << "(", loop[", "](bind_left(fwd <S>(s)), fwd <T>(t)), fwd <S>(s) << ")"; }