OSDN Git Service

yash: r684 に戻す: merge -r687:684
[yash/yash.git] / redir.h
1 /* Yash: yet another shell */
2 /* redir.h: manages file descriptors and provides functions for redirections */
3 /* (C) 2007-2008 magicant */
4
5 /* This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18
19 #ifndef REDIR_H
20 #define REDIR_H
21
22 #include <stdbool.h>
23 #include <stdio.h>
24
25 extern int xclose(int fd);
26 extern int xdup2(int oldfd, int newfd);
27
28 extern void init_shellfds(void);
29 extern void clear_shellfds(bool leavefds);
30 extern int copy_as_shellfd(int fd);
31 extern FILE *reopen_with_shellfd(FILE *f, const char *mode);
32 extern void open_ttyfd(void);
33 extern int get_ttyfd(void) __attribute__((pure));
34
35 typedef struct savefd_T savefd_T;
36 struct redir_T;
37
38 extern bool open_redirections(const struct redir_T *r, struct savefd_T **save);
39 extern void undo_redirections(savefd_T *save);
40 extern void clear_savefd(savefd_T *save);
41 extern void maybe_redirect_stdin_to_devnull(void);
42
43
44 #endif /* REDIR_H */
45
46
47 /* vim: set ts=8 sts=4 sw=4 noet: */