entered into RCS
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Jul 1992 02:18:03 +0000 (02:18 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Jul 1992 02:18:03 +0000 (02:18 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@1697 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/collect2.c

index 5915cf0..532f182 100644 (file)
@@ -206,6 +206,25 @@ generic *xmalloc ();
 extern char *index ();
 extern char *rindex ();
 \f
+#ifdef NO_DUP2
+dup2 (oldfd, newfd)
+     int oldfd;
+     int newfd;
+{
+  int fdtmp[256];
+  int fdx = 0;
+  int fd;
+  if (oldfd == newfd)
+    return 0;
+  close (newfd);
+  while ((fd = dup (oldfd)) != newfd) /* good enough for low fd's */
+    fdtmp[fdx++] = fd;
+  while (fdx > 0)
+    close (fdtmp[--fdx]);
+}
+#endif
+
 char *
 my_strerror (e)
      int e;