[comp.unix.questions] Why does this shell program ...

dce@mips.UUCP (David Elliott) (06/11/87)

The subject of shell internals is pretty interesting.

I once attended a class taught by Steve Bourne where he defended
the Algol-like coding. Basically, he said that the people
maintaining the shell found it easier to work in the more
familiar setting.

If you don't like it, you have a number of choices:

	1. Use Brad Needham's scpp to pre-process out the Algol stuff
	   and run indent on it to make it look reasonable (in fact,
	   run *all* of your stuff through indent so that the people
	   who have to maintain it don't have to put up with your
	   horrible indentation style ;-).

	2. Get a copy of System V.2 sh (from AT&T or BRL). It's already
	   been preprocessed.

	3. Leave it alone. It seems to work fine if you don't mess with
	   it.

I was talking to John Mashey one day, and he said that the "segmentation
fault" memory was his fault. He had given Bourne a hard time about the
slowness of the memory allocation, and Bourne changed it (I don't remember
if Mash said that the implementation was his idea or not). If you set the
"Way-Back Machine" for 1974 or so, you may be able to stop him.

In any event, you can get rid of most of the segmentation fault memory
allocation by adding a few calls to the allocation handler at key places.
I don't know all of the places, but I had to do this last year when
we had a bug in kernel with respect to signal handling, and I only added
2 calls. I seem to remember the names Guy Harris and Doug Gwyn used in
reference to these changes (probably just someone cursing them).

-- 
David Elliott		{decvax,ucbvax,ihnp4}!decwrl!mips!dce
"With an a) like that, you've got a lot of nerve asking for a b)!"-P. Schaeffer