OSDN Git Service

Don't export IFS outside testcase function
[yash/yash.git] / redir.h
diff --git a/redir.h b/redir.h
index 6179112..07d514e 100644 (file)
--- a/redir.h
+++ b/redir.h
@@ -1,6 +1,6 @@
 /* Yash: yet another shell */
 /* redir.h: manages file descriptors and provides functions for redirections */
-/* (C) 2007-2008 magicant */
+/* (C) 2007-2023 magicant */
 
 /* This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-#ifndef REDIR_H
-#define REDIR_H
+#ifndef YASH_REDIR_H
+#define YASH_REDIR_H
+
+#include <stddef.h>
 
-#include <stdbool.h>
-#include <stdio.h>
 
 extern int xclose(int fd);
 extern int xdup2(int oldfd, int newfd);
+extern _Bool write_all(int fd, const void *data, size_t size)
+    __attribute__((nonnull));
 
 extern int ttyfd;
 
 extern void init_shellfds(void);
 extern void add_shellfd(int fd);
 extern void remove_shellfd(int fd);
-extern bool is_shellfd(int fd)
+extern _Bool is_shellfd(int fd)
     __attribute__((pure));
-extern void clear_shellfds(bool leavefds);
+extern void clear_shellfds(_Bool leavefds);
 extern int copy_as_shellfd(int fd);
-extern FILE *reopen_with_shellfd(FILE *f, const char *mode);
+extern int move_to_shellfd(int fd);
 extern void open_ttyfd(void);
-extern int get_ttyfd(void) __attribute__((pure));
 
 typedef struct savefd_T savefd_T;
 struct redir_T;
 
-extern bool open_redirections(const struct redir_T *r, struct savefd_T **save);
+extern _Bool open_redirections(const struct redir_T *r, savefd_T **save)
+    __attribute__((nonnull(2)));
 extern void undo_redirections(savefd_T *save);
 extern void clear_savefd(savefd_T *save);
 extern void maybe_redirect_stdin_to_devnull(void);
 
+#define PIPE_IN  0   /* index of the reading end of a pipe */
+#define PIPE_OUT 1   /* index of the writing end of a pipe */
+
 
-#endif /* REDIR_H */
+#endif /* YASH_REDIR_H */
 
 
-/* vim: set ts=8 sts=4 sw=4 noet: */
+/* vim: set ts=8 sts=4 sw=4 et tw=80: */