rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: Differences between Duff's rc and Byron's
@ 1993-05-25 23:32 Alan Watson
  0 siblings, 0 replies; 12+ messages in thread
From: Alan Watson @ 1993-05-25 23:32 UTC (permalink / raw)
  To: rc

| - . searching the path
|
|	Plan 9 does this, it might be handy but it might also be very
|	dangerous.

And can be simulated by suitably defining "fn . { ... }".

Actually, reading the Plan9 man pages was somewhat depressing:  two of
the things I regard as unnecessary in Byron's rc ($^foo and newpgrp)
have made it after a fashion in to Duff's implementation.


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

* Re: Differences between Duff's rc and Byron's
  1993-05-26 17:55 ` Chris Siebenmann
@ 1993-05-29 12:34   ` John Mackin
  0 siblings, 0 replies; 12+ messages in thread
From: John Mackin @ 1993-05-29 12:34 UTC (permalink / raw)
  To: The rc Mailing List

Chris wrote:

     Tom Duff's rc has history, done via a file named in $history. It's not
    documented, but it's there.

I assume the basis for this statement is the set of early Duff sources
that Chris has.  I heard a rumour from the Plan 9 crowd over at Basser
that $history had actually been _removed_ from rc since no one on
Plan 9 used it; it seemed they found the 8 1/2 window program provided
all the history they could want.  I just this minute checked this -- I
have no access to earlier Plan 9 sources, just the second (current)
distribution, but I am certain that Chris's statement used to be
correct, i.e. Duff's rc used to have $history.  But as I said, I
just now looked, and the rumour is true -- the one in the current
Plan 9 CD doesn't have $history at all.

To forestall possible misinterpretation, this is NOT a suggestion
that $history should be removed from Byron's rc.  `Just the facts.'

OK,
John.


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

* Re: Differences between Duff's rc and Byron's
@ 1993-05-27  6:48 Paul Haahr
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Haahr @ 1993-05-27  6:48 UTC (permalink / raw)
  To: alan; +Cc: rc

> The user
> need never type $^foo, although obviously rc needs to know what to do
> with $foo^' '^$bar.

why?  all of rc's concatenation can be written in terms of loops.
there's nothing magic about them (unlike ~ which can't be written
as a function, due to the fact that one of its arguments isn't
globbed).  they are purely there for convenience, too.

> The only excuses for $^foo are typing convenience and speed, and I very
> much doubt the later is especially noticeable.

> > newpgrp on the other hand is a hack.  it's there because otherwise rc
> > would be much less usable on some (admittedly broken) systems.

> Educate me: why can't you use the nice, nohup, et al. approach?

i did something like this for a while.  $SHELL was a wrapper which did
the newpgrp, set SHELL to rc, and exec'ed rc.  worked, until i needed
$SHELL in that context not to create a new pgrp for some other purpose.

from my perspective, a processes' pgrp is similar to its signals, limits,
etc.  the shell manages those, so its not unreasonable for it to manage
the pgrp if it manages those other things.

> I
> don't understand enough of why it's there in the first place to decide
> for myself.  Where do you use it -- once per login-shell, or
> continually through a session, or what?

once per window, in my fn prompt.  if not, control-c in one window
sends sigint to all the terminal windows.  the vendor never noticed
this since they assumed that all shells were like csh and did their
own pgrp manipulation.

> And, hey, the test command on Ultrix is broken, and rc would be much
> more useable if it were built-in. :-)

supply your own /usr/local/bin/test, if you really like test's semantics.
or supply something better.

paul


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

* Re: Differences between Duff's rc and Byron's
@ 1993-05-27  5:02 Alan Watson
  0 siblings, 0 replies; 12+ messages in thread
From: Alan Watson @ 1993-05-27  5:02 UTC (permalink / raw)
  To: Paul Haahr; +Cc: rc

> $^ is most definitely necessary.  ok, you can simulate the operation with:
> 
> ...
> 
> but the operation itself is fundamental.  the concatenation semantics just
> about require it.  (eval, for example, does flattening internally.)

Sure, and the ability to malloc is fundamental, but that doesn't mean
the user should be able to do it.  You are confusing an internal
implementation detail with an externally visible feature.  The user
need never type $^foo, although obviously rc needs to know what to do
with $foo^' '^$bar.

The only excuses for $^foo are typing convenience and speed, and I very
much doubt the later is especially noticeable.

> newpgrp on the other hand is a hack.  it's there because otherwise rc
> would be much less usable on some (admittedly broken) systems.

Educate me: why can't you use the nice, nohup, et al. approach?  I
don't understand enough of why it's there in the first place to decide
for myself.  Where do you use it -- once per login-shell, or
continually through a session, or what?

And, hey, the test command on Ultrix is broken, and rc would be much
more useable if it were built-in. :-)


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

* Re: Differences between Duff's rc and Byron's
  1993-05-26 17:58 Paul Haahr
  1993-05-26 20:31 ` Chris Siebenmann
@ 1993-05-26 20:32 ` Chris Siebenmann
  1 sibling, 0 replies; 12+ messages in thread
From: Chris Siebenmann @ 1993-05-26 20:32 UTC (permalink / raw)
  To: rc

(an addendum: it fails in a somewhat old version of Duff's rc. It may be
 different in current ones; someone with access to a Plan 9 system will
 have to be the one to check.)

	- cks


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

* Re: Differences between Duff's rc and Byron's
  1993-05-26 17:58 Paul Haahr
@ 1993-05-26 20:31 ` Chris Siebenmann
  1993-05-26 20:32 ` Chris Siebenmann
  1 sibling, 0 replies; 12+ messages in thread
From: Chris Siebenmann @ 1993-05-26 20:31 UTC (permalink / raw)
  To: rc

	~ (a b c) a
in Duff's rc fails, while it succeeds in Byron's.

	- cks


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

* Re:  Differences between Duff's rc and Byron's
@ 1993-05-26 17:58 Paul Haahr
  1993-05-26 20:31 ` Chris Siebenmann
  1993-05-26 20:32 ` Chris Siebenmann
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Haahr @ 1993-05-26 17:58 UTC (permalink / raw)
  To: culliton; +Cc: rc

> The Plan 9 man pages say "~ subject pattern ..." where subject is
> singular (Duff's paper says "a string") and under BUGS the Plan 9 man
> page says "There should be a way to match patterns against whole lists
> rather than just single strings."  Byron allows subject to be a list.

oh, i think i misinterpreted this comment.  i had always thought it
to mean that Duff wanted a way to match lists against lists.
(in both rcs,
	~ (a b) (b a)
and
	~ (a b) (a c)
return true;  my interpretation of Duff's comment was that he wanted
something that would return false for both, since the lists are not
identical.)

my understanding was that Byron's and Duff's versions had exactly
the same semantics for ~.  can someone verify this?

paul


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

* Re: Differences between Duff's rc and Byron's
  1993-05-26 16:53 Paul Haahr
@ 1993-05-26 17:55 ` Chris Siebenmann
  1993-05-29 12:34   ` John Mackin
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Siebenmann @ 1993-05-26 17:55 UTC (permalink / raw)
  To: rc

 Tom Duff's rc has history, done via a file named in $history. It's not
documented, but it's there. Ditto '. -i <file>'.
 A number of things in Duff's rc aren't documented in the manpage, just
in the C source and/or rcmain.

	- cks


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

* Re:  Differences between Duff's rc and Byron's
@ 1993-05-26 17:38 Tom Culliton x2278
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Culliton x2278 @ 1993-05-26 17:38 UTC (permalink / raw)
  To: haahr; +Cc: rc

Paul Hahr writes:

> > - $" vs. $^
> > > This seems like an arbitrary difference.
> Byron's $^ preceeded td's $".  if you look at older versions of the
> bell labs rc man page, it's not there.

I seemed to remember something like this and wondered why Duff did it
different.
 
> > - pattern matching, word vs. list
> > > This fixes something noted as a bug in the Plan 9 man page.
> i don't know what you mean by this comment.  i don't think Byron's
> ~ operator is any different from td's.

The Plan 9 man pages say "~ subject pattern ..." where subject is
singular (Duff's paper says "a string") and under BUGS the Plan 9 man
page says "There should be a way to match patterns against whole lists
rather than just single strings."  Byron allows subject to be a list.

I also forgot one we discussed before, functions that look like path
names, i.e. "fn /bin/csh { echo 'you''ve got to be kidding!' }" are
allowed in Duff's rc.  There are probably more minor differences like
this that got missed.

Tom


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

* Re: Differences between Duff's rc and Byron's
@ 1993-05-26 17:06 Paul Haahr
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Haahr @ 1993-05-26 17:06 UTC (permalink / raw)
  To: alan; +Cc: rc

> Actually, reading the Plan9 man pages was somewhat depressing:  two of
> the things I regard as unnecessary in Byron's rc ($^foo and newpgrp)
> have made it after a fashion in to Duff's implementation.

$^ is most definitely necessary.  ok, you can simulate the operation with:

	fn flatten {
		var = $1
		shift
		if (~$#* 0) {
			$var = ''
			return
		}
		$var = $1
		shift
		for (i = $*) {
			$var = $$var ^ ' ' ^ $i
		}
	}

and use

	flatten x $foo

for

	x = $^foo

but the operation itself is fundamental.  the concatenation semantics just
about require it.  (eval, for example, does flattening internally.)

newpgrp on the other hand is a hack.  it's there because otherwise rc
would be much less usable on some (admittedly broken) systems.

paul


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

* Re:  Differences between Duff's rc and Byron's
@ 1993-05-26 16:53 Paul Haahr
  1993-05-26 17:55 ` Chris Siebenmann
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Haahr @ 1993-05-26 16:53 UTC (permalink / raw)
  To: culliton; +Cc: rc

if you look at the unix version (10th edition) of rc rather than
the plan 9 version, some of the differences drop away.  all of the
following are in the bell labs unix version of rc, either exactly
or almost identical to the versions in Byron's shell.

> - Command line switches
> 	-d      -d      no-op vs. debug enable SIGQUIT/SIGTERM
> 	-p      -p      no-op vs. disable function import
> - startup file $home/lib/profile vs. $home/.rcrc
> - environment handling (system dependent)
> - different signal handlers (system dependent)

other comments:

> - $" vs. $^
> 	This seems like an arbitrary difference.
Byron's $^ preceeded td's $".  if you look at older versions of the
bell labs rc man page, it's not there.

> - pattern matching, word vs. list
> 	This fixes something noted as a bug in the Plan 9 man page.
i don't know what you mean by this comment.  i don't think Byron's
~ operator is any different from td's.

> - additional variables: history, ...
> 	Plan 9 may use history and not just not mention it in the man
i think it does.  i know it was a later addition to rc.

> - . -i (???)
> 	Duff's paper mentions this but the man page doesn't.
it's just undocumented, but it's there.

of the rest of the differences noted, the only ones which were
not upward compatible were

> - builtin flag
> - if not vs. else
> - $status

and, of course,
> - rfork vs. newpgrp (System dependent)
which is not really a shell difference.  (and, of course, the v10
version doesn't have rfork.)

Tom-- thanks for doing this list.  it was very informative to see
just what the differences were.  i was actually surprised by how
few differences there really were.

paul


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

* Differences between Duff's rc and Byron's
@ 1993-05-25 22:42 Tom Culliton x2278
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Culliton x2278 @ 1993-05-25 22:42 UTC (permalink / raw)
  To: rc

A while ago it struck me that the man page only covered some of the
differences between Duff's Plan 9 version of rc and Bryon's Unix
version.  So out of curiosity and a desire to understand rc better, I
set out to assemble my own list of differences.  The following is the
best list that I have been able to assemble from Byron's and the Plan 9
man pages, Tom Duff's paper and miscellaneous info from the mailing
list.  If I've made any mistakes feel free to correct me.

Any time there is a comparison below the Plan 9 form occurs first.  If
you want more detail on any of these please see the original sources
listed above.

- Command line switches

	Plan 9	Unix
	------  ----
	-c	-c	same
	-d	-d	no-op vs. debug enable SIGQUIT/SIGTERM
	-e	-e	same
	-i	-i	same
	-I		force NON-interactive
	-l	-l	same
		-n
		-o
	-p	-p	no-op vs. disable function import
	-r		debugging info
	-s	-s	print non-zero status vs. sh/csh compatibility
	-v	-v	same
	-V		???
	-x	-x	same

- builtin break and return

	Plan 9 doesn't have these but they're awfully handy.

- <<< here strings

	This fixes something noted as a bug in the Plan 9 man page.

- builtin flag

	It might be nice to have this Plan 9 feature.

- . searching the path

	Plan 9 does this, it might be handy but it might also be very
	dangerous.

- whatis -s option

	Byron added -s to show all the signal handling.

- rfork vs. newpgrp (System dependent)

	Plan 9 has a more capable fork system call than Unix and rfork
	takes advantage of it.  It might be interesting to try to
	emulate it, but then I've never even needed to use newpgrp.

- if not vs. else

	This seems like an arbitrary difference.  Syntactic sugar.

- $" vs. $^

	This seems like an arbitrary difference.

- `{word} vs. `word

	On very rare occasions this saves me typing two braces, it seems
	like an arbitrary difference.

- $status

	The difference here seems to make Byron's rc better adapted to Unix.

- pattern matching, word vs. list

	This fixes something noted as a bug in the Plan 9 man page.

- fn prompt

	Plan 9 doesn't have this but it's VERY handy.

- builtin echo

	A concession to performance.

- additional variables: history, apids, CDPATH, HOME, PATH

	Plan 9 may use history and not just not mention it in the man
	page, apids is a great idea, the rest are for Unix compatibility.

- exec of builtins

	A bug fix IMHO.

- ``

	This one seems like a gratuitous addition to me.

- default prompt ('% ' ' ') vs. ('; ' '')

	Byron's reasons seem to make sense, and you can change it to
	whatever you want anyway.

- startup file $home/lib/profile vs. $home/.rcrc

	An adaptation to Unix.

- environment handling (system dependent)

- different signal handlers (system dependent)

- . -i (???)

	Duff's paper mentions this but the man page doesn't.


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

end of thread, other threads:[~1993-05-29 12:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-05-25 23:32 Differences between Duff's rc and Byron's Alan Watson
  -- strict thread matches above, loose matches on Subject: below --
1993-05-27  6:48 Paul Haahr
1993-05-27  5:02 Alan Watson
1993-05-26 17:58 Paul Haahr
1993-05-26 20:31 ` Chris Siebenmann
1993-05-26 20:32 ` Chris Siebenmann
1993-05-26 17:38 Tom Culliton x2278
1993-05-26 17:06 Paul Haahr
1993-05-26 16:53 Paul Haahr
1993-05-26 17:55 ` Chris Siebenmann
1993-05-29 12:34   ` John Mackin
1993-05-25 22:42 Tom Culliton x2278

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).