rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* rc initialisation
@ 1992-06-28 20:00 John Mackin
  1992-06-29 22:22 ` Chris Siebenmann
  0 siblings, 1 reply; 2+ messages in thread
From: John Mackin @ 1992-06-28 20:00 UTC (permalink / raw)
  To: The rc Mailing List

A file of rc tricks would be a good idea, especially since everyone
seems to have forgotten one of my favourites.

Chris's suggestion for getting initialisation to happen on every
new interactive rc is:

	fn prompt { if (! ~ $cpid $pid) {cpid=$pid; ... } }

This code is correct, but I think that most of the time this is not
what you want.  The original poster was looking for a way to get
an stty to happen when they fired off a new xterm.  If you use this
method, then the stty will happen not only at the very beginning of
the xterm, but every time a new interactive rc is spawned in the
xterm.  My counter-proposal is:

	fn prompt { do the initialisation; fn prompt }

This differs from Chris's in that the initialisation is definitely
only executed -once-, and in that the prompt function doesn't
hang around to clutter the environment and slow your shells down.
I think that in the huge majority of cases, these differences
will be advantages.

For a concrete example, here's the file in $home/bin that spawns
my window manager:

    #!/home/john/bin/rc

    fn prompt {
    	stty new
    	fn prompt
    }

    pathos $0 $*

On other matters mentioned recently, very briefly:

(1) Chris is 100% correct in his statement that no changes need be made
to rc to deal with any initialisation at all, with the possible
exception of rsh; and also 100% correct that we shouldn't try to change
rc to `work around' rsh.  (If we're sufficiently clever we can get rsh
to work right most of the time, I think.).

(2) Don't even THINK about making all rc's source .rcrc.  If we want
that kind of braindeath, we can use zsh.  The whole point of the way
rc works is that subshells -are- completely initialised from the
environment.

OK,
John.


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

* Re: rc initialisation
  1992-06-28 20:00 rc initialisation John Mackin
@ 1992-06-29 22:22 ` Chris Siebenmann
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Siebenmann @ 1992-06-29 22:22 UTC (permalink / raw)
  To: The rc Mailing List

| 	fn prompt { do the initialisation; fn prompt }

 The problem with this for me is that I can start up windows from within
other windows, so my prompt function has to stick around. I do something
similar to $cpid for xterm windows, where I can check $WINDOW; I've taught
everything else to get the stty settings right without help (:)).

	- cks


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

end of thread, other threads:[~1992-06-29 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-06-28 20:00 rc initialisation John Mackin
1992-06-29 22:22 ` Chris Siebenmann

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