Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!pyramid!prls!mips!dce From: dce@mips.UUCP (David Elliott) Newsgroups: comp.unix.questions Subject: Re: csh on ULTRIX Message-ID: <346@quacky.UUCP> Date: Mon, 27-Apr-87 00:08:09 EDT Article-I.D.: quacky.346 Posted: Mon Apr 27 00:08:09 1987 Date-Received: Tue, 28-Apr-87 01:15:05 EDT References: <7107@brl-adm.ARPA> Reply-To: dce@quacky.UUCP (David Elliott) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 75 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 ). *** 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