[TUHS] Etymology of bc(1)

Larry McVoy lm at mcvoy.com
Fri Sep 12 13:33:17 AEST 2014


On Thu, Sep 11, 2014 at 11:15:55PM -0400, Noel Chiappa wrote:
>     > 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?

Rob (different rob) and I made a command line expr like thing, can't
remember why that did the same trick of shoving stuff (in our case it
was argv) into a pipe and then running yyparse().

It's at www.mcvoy.com/lm/af.shar

Still builds though it is from 1988.
-- 
---
Larry McVoy            	     lm at mcvoy.com             http://www.mcvoy.com/lm 



More information about the TUHS mailing list