summaryrefslogtreecommitdiffstats
path: root/bin/sh/redir.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
committerpeter <peter@FreeBSD.org>1996-09-01 10:22:36 +0000
commit5195be912eb257c05a0c97e561e72f01af2583ff (patch)
treee47ab3981b495c675a987dd1e943d1f4c823f314 /bin/sh/redir.c
parent2fc7d7d1fa299368ccdddede67b31695266698bd (diff)
downloadFreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.zip
FreeBSD-src-5195be912eb257c05a0c97e561e72f01af2583ff.tar.gz
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
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