BSD 3 development
[unix-history] / usr / src / cmd / sh / service.c
index 1c59989..5486014 100644 (file)
@@ -145,6 +145,17 @@ LOCAL STRING       execs(ap,t)
                close(output); output=2;
                input=chkopen(p);
 
                close(output); output=2;
                input=chkopen(p);
 
+               /* band aid to get csh... 2/26/79 */
+               {
+                       char c;
+                       if (!isatty(input)) {
+                               read(input, &c, 1);
+                               if (c == '#')
+                                       gocsh(t, xecenv);
+                               lseek(input, (long) 0, 0);
+                       }
+               }
+
                /* set up new args */
                setargs(t);
                longjmp(subshell,1);
                /* set up new args */
                setargs(t);
                longjmp(subshell,1);
@@ -165,6 +176,20 @@ LOCAL STRING       execs(ap,t)
        ENDSW
 }
 
        ENDSW
 }
 
+gocsh(t, xecenv)
+       register char **t, **xecenv;
+{
+       char **newt[1000];
+       register char **p;
+       register int i;
+
+       for (i = 0; t[i]; i++)
+               newt[i+1] = t[i];
+       newt[i+1] = 0;
+       newt[0] = "/bin/csh";
+       execve("/bin/csh", newt, xecenv);
+}
+
 /* for processes to be waited for */
 #define MAXP 20
 LOCAL INT      pwlist[MAXP];
 /* for processes to be waited for */
 #define MAXP 20
 LOCAL INT      pwlist[MAXP];