BSD 4_4 release
[unix-history] / usr / src / old / sh / main.c
index e66bc56..a9607cc 100644 (file)
@@ -1,4 +1,6 @@
-/*     main.c  4.1     82/05/07        */
+#ifndef lint
+static char sccsid[] = "@(#)main.c     4.4 5/8/89";
+#endif
 
 #
 /*
 
 #
 /*
  *
  */
 
  *
  */
 
-#include       "defs.h"
-#include       "dup.h"
-#include       "sym.h"
-#include       "timeout.h"
 #include       <sys/types.h>
 #include       <sys/stat.h>
 #include       <sgtty.h>
 #include       <sys/types.h>
 #include       <sys/stat.h>
 #include       <sgtty.h>
+#include       <signal.h>
+#include       "defs.h"
+#include       "sym.h"
+#include       "timeout.h"
+#include       "pathnames.h"
 
 UFD            output = 2;
 LOCAL BOOL     beenhere = FALSE;
 
 UFD            output = 2;
 LOCAL BOOL     beenhere = FALSE;
-CHAR           tmpout[20] = "/tmp/sh-";
+CHAR           tmpout[20] = _PATH_TMPOUT;
 FILEBLK                stdfile;
 FILE           standin = &stdfile;
 #ifdef stupid
 FILEBLK                stdfile;
 FILE           standin = &stdfile;
 #ifdef stupid
@@ -43,7 +46,7 @@ main(c, v)
        addblok((POS)0);
 
        /* set names from userenv */
        addblok((POS)0);
 
        /* set names from userenv */
-       getenv();
+       setupenv();
 
        /* look for restricted */
 /*     IF c>0 ANDF any('r', *v) THEN rflag=0 FI */
 
        /* look for restricted */
 /*     IF c>0 ANDF any('r', *v) THEN rflag=0 FI */
@@ -181,7 +184,7 @@ settmp()
 Ldup(fa, fb)
        REG INT         fa, fb;
 {
 Ldup(fa, fb)
        REG INT         fa, fb;
 {
-       dup(fa|DUPFLG, fb);
+       dup2(fa, fb);
        close(fa);
        ioctl(fb, FIOCLEX, 0);
 }
        close(fa);
        ioctl(fb, FIOCLEX, 0);
 }