From mboxrd@z Thu Jan 1 00:00:00 1970 From: lm@mcvoy.com (Larry McVoy) Date: Thu, 11 Sep 2014 20:33:17 -0700 Subject: [TUHS] Etymology of bc(1) In-Reply-To: <20140912031555.02B3318C0A3@mercury.lcs.mit.edu> References: <20140912031555.02B3318C0A3@mercury.lcs.mit.edu> Message-ID: <20140912033317.GT633@mcvoy.com> On Thu, Sep 11, 2014 at 11:15:55PM -0400, Noel Chiappa wrote: > > From: Mark Longridge > > > 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