4.1bsd csh startup enhancement

ado at elsie.UUCP ado at elsie.UUCP
Sat Jun 30 04:41:23 AEST 1984


Here's some code from 4.1bsd's "csh/sh.c":

		srccat(value("home"), "/.cshrc");
		if (!fast && !arginp && !onelflg)
			dohash();
		if (loginsh) {
			int ldisc;
			srccat(value("home"), "/.login");
		}

The first "srccat" call is what's responsible for reading your ".cshrc" file;
the second is what reads your ".login" file when appropriate.
The "dohash" call between them is designed to get "search path hashing"
done.

Now if your ".cshrc" file contains a "set path" command,
then "search path hashing" is done when that command is executed,
making the "dohash" above redundant.  Of course, if your ".cshrc" file is
"set path"-free, you DO want to do the above "dohash".

There's a variable in "sh.exec.c" with the name "havhash" which
tells whether hashing has been done.  So, if you change the above lines to:

		srccat(value("home"), "/.cshrc");
		if (!fast && !arginp && !onelflg)
#ifdef OLDVERSION
			dohash();
#else
			{
				extern int	havhash;

				if (!havhash)
					dohash();
			}
#endif
		if (loginsh) {
			int ldisc;
			srccat(value("home"), "/.login");
		}

you can avoid redundant hash table building.

If your a purist, then while you're in the neighborhood you might want to
make this change also:

		if (loginsh) {
#ifdef OLDVERSION
			int ldisc;
#else
			/* Is "lint" no joy?  Is joy no linter? */
#endif
			srccat(value("home"), "/.login");
		}

--
	...decvax!allegra!umcp-cs!elsie!ado	(301) 496-5688
	(the DEC and VAX in decvax are Digital Equipment Corporation trademarks)



More information about the Comp.unix.wizards mailing list