The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Etymology of bc(1)
@ 2014-09-11 21:24 Christian Neukirchen
  2014-09-11 21:41 ` Warner Losh
  0 siblings, 1 reply; 25+ messages in thread
From: Christian Neukirchen @ 2014-09-11 21:24 UTC (permalink / raw)


Hello,

on de.comp.os.unix.shell there is a recent thread about bc(1) which
turned into a discussion about why it is called "bc".  dc(1) is pretty
clearly "desk calculator" as by the man page, but the etymology of bc
seems to be unclear.

I've heard the following plausible theories:

- basic calculator (Wikipedia)
- beauty calculator (some people apparently dislike RPN)
- better calculator
- bench calculator (Wikipedia)
- b is the letter d mirrored (RPN vs algebraic)
- bundle calculator (the word "bundle" appears 97 times in bc.y of V6)

...but nobody had a really conclusive argument.  Perhaps someone here
remembers the real story?

Thanks,
-- 
Christian Neukirchen  <chneukirchen at gmail.com>  http://chneukirchen.org



^ permalink raw reply	[flat|nested] 25+ messages in thread
* [TUHS] Etymology of bc(1)
@ 2014-09-12  1:54 Noel Chiappa
  2014-09-12  2:35 ` Mark Longridge
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Noel Chiappa @ 2014-09-12  1:54 UTC (permalink / raw)


    > From: Dave Horsfall <dave at horsfall.org>

    > On the *nix systems to which I have access, bc(1) is a standalone
    > program on FreeBSD and OSX, but pipes to dc(1) on OpenBSD. I cannot
    > check my Penguin box (Ubuntu)

Dude! Trying to answer questions about the origins of BC by looking at
systems this late is like trying to learn Latin by studying Italian! :-)

I looked at the Version 6 source, and it's a bunch of YACC code, but it pulls
the same technique of using a pipe to an instance of DC, viz:

	pipe(p);
	if (fork()==0) {
		close(1);
		dup(p[1]);
		close(p[0]);
		close(p[1]);
		yyinit(argc, argv);
		yyparse();
		exit();
	}
	close(0);
	dup(p[0]);
	close(p[0]);
	close(p[1]);
	execl("/bin/dc", "dc", "-", 0);

There's likely even older versions than the V6 one, but that's the earliest
source I have online on my PC for easy access.

	Noel



^ permalink raw reply	[flat|nested] 25+ messages in thread
* [TUHS] Etymology of bc(1)
@ 2014-09-12  3:15 Noel Chiappa
  2014-09-12  3:33 ` Larry McVoy
  2014-09-12  6:10 ` Dave Horsfall
  0 siblings, 2 replies; 25+ messages in thread
From: Noel Chiappa @ 2014-09-12  3:15 UTC (permalink / raw)


    > 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



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-09-13  2:52 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 21:24 [TUHS] Etymology of bc(1) Christian Neukirchen
2014-09-11 21:41 ` Warner Losh
2014-09-11 22:04   ` Dave Horsfall
2014-09-11 22:17     ` John Cowan
2014-09-11 23:34       ` scj
2014-09-12  1:03       ` Dave Horsfall
2014-09-12 13:37         ` random832
2014-09-12 14:18           ` Steve Nickolas
2014-09-12 20:02           ` Dave Horsfall
2014-09-12  1:54 Noel Chiappa
2014-09-12  2:35 ` Mark Longridge
2014-09-12  6:00 ` Dave Horsfall
2014-09-12 11:15   ` John Cowan
2014-09-12 11:36     ` Otto Moerbeek
2014-09-12 17:12       ` scj
2014-09-12 17:18         ` Warner Losh
2014-09-12 19:02         ` Clem Cole
2014-09-12 19:36       ` Dave Horsfall
2014-09-12 20:03         ` Warner Losh
2014-09-12 19:32     ` Dave Horsfall
2014-09-12 18:28 ` Tim Bradshaw
2014-09-13  2:52   ` Dave Horsfall
2014-09-12  3:15 Noel Chiappa
2014-09-12  3:33 ` Larry McVoy
2014-09-12  6:10 ` Dave Horsfall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).