[TUHS] Etymology of bc(1)

Noel Chiappa jnc at mercury.lcs.mit.edu
Fri Sep 12 13:15:55 AEST 2014


    > From: Mark Longridge <cubexyz at gmail.com>

    > I have a version of Unix v6 that has a file called /usr/doc/bc that
    > describes bc at length

Oh, right, I missed that. I'm a source kind of person... :-)

Speaking of using a pipe to an existing command, I originally mis-read the
code to think there was only _one_ process involved, and that it was buffering
its output into the pipe before doing the exec() itself - something like this:

        pipe(p);
	write_stuff(p[1]);
        close(0);
        dup(p[0]);
        close(p[0]);
        close(p[1]);
        execl("/bin/other", "other", arg, 0);
	
Which is kind of a hack, but... it does avoid using a second process, although
the amount of data that can be passed is limited. (IIRC, a pipe will hold at
most 8 blocks, at least on V6.) Did this hack ever get used in anything?

	Noel



More information about the TUHS mailing list