summaryrefslogtreecommitdiffstats
path: root/bin/sh/redir.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/redir.c')
-rw-r--r--bin/sh/redir.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/bin/sh/redir.c b/bin/sh/redir.c
index 47f964f..ae2d335 100644
--- a/bin/sh/redir.c
+++ b/bin/sh/redir.c
@@ -33,13 +33,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: redir.c,v 1.3 1995/05/30 00:07:22 rgrimes Exp $
+ * $Id: redir.c,v 1.4 1995/10/21 00:47:31 joerg Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)redir.c 8.1 (Berkeley) 5/31/93";
+static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95";
#endif /* not lint */
+#include <sys/types.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+
/*
* Code for dealing with input/output redirection.
*/
@@ -52,11 +60,6 @@ static char sccsid[] = "@(#)redir.c 8.1 (Berkeley) 5/31/93";
#include "output.h"
#include "memalloc.h"
#include "error.h"
-#include <sys/types.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
#define EMPTY -2 /* marks an unused slot in redirtab */
@@ -79,14 +82,8 @@ MKINIT struct redirtab *redirlist;
*/
int fd0_redirected = 0;
-#ifdef __STDC__
-STATIC void openredirect(union node *, char *);
-STATIC int openhere(union node *);
-#else
-STATIC void openredirect();
-STATIC int openhere();
-#endif
-
+STATIC void openredirect __P((union node *, char[10 ]));
+STATIC int openhere __P((union node *));
/*
@@ -103,7 +100,7 @@ redirect(redir, flags)
int flags;
{
union node *n;
- struct redirtab *sv;
+ struct redirtab *sv = NULL;
int i;
int fd;
char memory[10]; /* file descriptors to write to memory */
@@ -226,7 +223,7 @@ openhere(redir)
union node *redir;
{
int pip[2];
- int len;
+ int len = 0;
if (pipe(pip) < 0)
error("Pipe call failed");
@@ -338,7 +335,10 @@ clearredir() {
*/
int
-copyfd(from, to) {
+copyfd(from, to)
+ int from;
+ int to;
+{
int newfd;
newfd = fcntl(from, F_DUPFD, to);
OpenPOWER on IntegriCloud