[comp.unix.questions] csh on ULTRIX

Isidore Bendrihem@BRL.ARPA (04/26/87)

Has anybody succesfully ported the 4.3bsd C shell to Ultrix 1.2 (on an 8600)?
I was able to compile csh without any problems.  Although it seems to
be able to parse commands, it fails to execute them, returning instead the
normal user prompt.

Isidore Bendrihem
eleng@cs.columbia.edu
-------

dce@mips.UUCP (David Elliott) (04/27/87)

In article <7107@brl-adm.ARPA> Isidore Bendrihem@BRL.ARPA writes:
>Has anybody succesfully ported the 4.3bsd C shell to Ultrix 1.2 (on an 8600)?
>I was able to compile csh without any problems.  Although it seems to
>be able to parse commands, it fails to execute them, returning instead the
>normal user prompt.

I did, last summer. The problem is that in 4.3BSD, you are guaranteed
to have stdin, stdout, and stderr opened for you upon exec (I think
this is what I learned). Anyway, code was added to set all of the
standard descriptors to be "close-on-exec", and that doesn't work in
4.2BSD or Ultrix 1.2.

Apply the following patch (note that BSD4_3 is automatically defined
if you are using 4.3BSD, since the csh source includes <sys/param.h>).

*** sh.c.old
--- sh.c
***************
*** 203,209 ****
--- 204,212 ----
  		}
  		file = v[0];
  		SHIN = dmove(nofile, FSHIN);	/* Replace FSHIN */
+ #ifdef BSD4_3
  		(void) ioctl(SHIN, FIOCLEX, (char *)0);
+ #endif
  		prompt = 0;
  		c--, v++;
  	}
***************
*** 427,433 ****
--- 430,438 ----
  	register char *ep = strspl(cp, dp);
  	register int unit = dmove(open(ep, 0), -1);
  
+ #ifdef BSD4_3
  	(void) ioctl(unit, FIOCLEX, (char *)0);
+ #endif
  	xfree(ep);
  #ifdef INGRES
  	srcunit(unit, 0, 0);
***************
*** 828,834 ****
--- 833,841 ----
  	xfree(f);
  	if (u < 0 && !hflg)
  		Perror(f);
+ #ifdef BSD4_3
  	(void) ioctl(u, FIOCLEX, (char *)0);
+ #endif
  	srcunit(u, 0, hflg);
  }
  
***************
*** 903,912 ****
--- 910,926 ----
  {
  
  	didfds = 0;			/* 0, 1, 2 aren't set up */
+ #ifdef BSD4_3
  	(void) ioctl(SHIN = dcopy(0, FSHIN), FIOCLEX, (char *)0);
  	(void) ioctl(SHOUT = dcopy(1, FSHOUT), FIOCLEX, (char *)0);
  	(void) ioctl(SHDIAG = dcopy(2, FSHDIAG), FIOCLEX, (char *)0);
  	(void) ioctl(OLDSTD = dcopy(SHIN, FOLDSTD), FIOCLEX, (char *)0);
+ #else
+ 	SHIN = dcopy(0, FSHIN);
+ 	SHOUT = dcopy(1, FSHOUT);
+ 	SHDIAG = dcopy(2, FSHDIAG);
+ 	OLDSTD = dcopy(SHIN, FOLDSTD);
+ #endif
  	closem();
  }
  
-- 
David Elliott		{decvax,ucbvax,ihnp4}!decwrl!mips!dce

abc@mcnc.UUCP (Alan B. Clegg) (04/27/87)

In article <7107@brl-adm.ARPA> Isidore Bendrihem@BRL.ARPA writes:
>
>Has anybody succesfully ported the 4.3bsd C shell to Ultrix 1.2 (on an 8600)?
>I was able to compile csh without any problems.  Although it seems to
>be able to parse commands, it fails to execute them, returning instead the
>normal user prompt.

Um.. I use both Ultrix (1.2) abd 4.3 machines.  I have not noticed many 
(if any) differences between csh on either machine.  Am I missing something?

-abc