Lines Matching refs:redir

4342 	struct redir_struct *redir;  in parse_redirect()  local
4376 while ((redir = *redirp) != NULL) { in parse_redirect()
4377 redirp = &(redir->next); in parse_redirect()
4379 *redirp = redir = xzalloc(sizeof(*redir)); in parse_redirect()
4382 redir->rd_type = style; in parse_redirect()
4383 redir->rd_fd = (fd == -1) ? redir_table[style].default_fd : fd; in parse_redirect()
4385 debug_printf_parse("redirect type %d %s\n", redir->rd_fd, in parse_redirect()
4388 redir->rd_dup = dup_num; in parse_redirect()
4394 redir->rd_fd, redir->rd_dup); in parse_redirect()
4404 ctx->pending_redirect = redir; in parse_redirect()
4548 struct redir_struct *redir = cmd->redirects; in fetch_heredocs() local
4552 while (redir) { in fetch_heredocs()
4553 if (redir->rd_type == REDIRECT_HEREDOC) { in fetch_heredocs()
4556 redir->rd_type = REDIRECT_HEREDOC2; in fetch_heredocs()
4559 redir->rd_filename, redir->rd_dup); in fetch_heredocs()
4564 free(redir->rd_filename); in fetch_heredocs()
4565 redir->rd_filename = p; in fetch_heredocs()
4568 redir = redir->next; in fetch_heredocs()
7717 static void setup_heredoc(struct redir_struct *redir) in setup_heredoc() argument
7723 const char *heredoc = redir->rd_filename; in setup_heredoc()
7730 if (!(redir->rd_dup & HEREDOC_QUOTED)) { in setup_heredoc()
7737 close(redir->rd_fd); /* often saves dup2+close in xmove_fd */ in setup_heredoc()
7739 xmove_fd(pair.rd, redir->rd_fd); in setup_heredoc()
7774 close(redir->rd_fd); /* read side of the pipe */ in setup_heredoc()
8011 struct redir_struct *redir; in setup_redirects() local
8013 for (redir = prog->redirects; redir; redir = redir->next) { in setup_redirects()
8017 if (redir->rd_type == REDIRECT_HEREDOC2) { in setup_redirects()
8019 save_fd_on_redirect(redir->rd_fd, /*avoid:*/ 0, sqp); in setup_redirects()
8023 redir->rd_filename); in setup_redirects()
8024 setup_heredoc(redir); in setup_redirects()
8028 if (redir->rd_dup == REDIRFD_TO_FILE) { in setup_redirects()
8033 if (redir->rd_filename == NULL) { in setup_redirects()
8041 mode = redir_table[redir->rd_type].mode; in setup_redirects()
8042 p = expand_string_to_string(redir->rd_filename, in setup_redirects()
8054 if (newfd == redir->rd_fd && sqp) { in setup_redirects()
8065 newfd = redir->rd_dup; in setup_redirects()
8068 if (newfd == redir->rd_fd) in setup_redirects()
8075 closed = save_fd_on_redirect(redir->rd_fd, /*avoid:*/ newfd, sqp); in setup_redirects()
8081 close(redir->rd_fd); in setup_redirects()
8095 xdup2(newfd, redir->rd_fd); in setup_redirects()
8096 if (redir->rd_dup == REDIRFD_TO_FILE) in setup_redirects()