rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* RCRC
@ 1993-09-04 22:10 Alan Watson
  1993-09-04 22:20 ` RCRC Chris Siebenmann
  1993-09-05 12:00 ` RCRC John Mackin
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Watson @ 1993-09-04 22:10 UTC (permalink / raw)
  To: rc

Although we have all worked out our own favorite work-arounds for the
rsh problem, I think I've come up with an rc specific solution which is
quite elegant:

	During start-up, rc examines the environment variable RCRC.  If
	the variable is set, rc attempts to source the file to which it
	refers; otherwise it sources .rcrc.  Before sourcing the file,
	rc sets RCRC to be the null string.  If the attempt to source
	the file fails, rc does not report an error.

So what happens in some common situations?

	login: RCRC is unset, so rc sets it to "" and sources .rcrc.

	rsh: ditto.

	exec of rc from beneath a login/rsh shell: RCRC is set to "",
	so the open() fails and nothing gets sourced.

All this seems to cost us in performance terms is a getenv() and open()
after each exec, and I very much doubt anyone will notice that.  We
gain a useful improvement in rc's interaction with the rest of UNIX,
and open up an interesting means to customize environments (by setting
RCRC in .rcrc).

Some things will break (like running rc in a clean environment from
env), but I can't think of anything too important.  

If you don't like the silence on error, then have rc set RCRC to
/dev/null before sourcing the file it points to.

Any comments?


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: RCRC
@ 1993-09-04 23:05 Alan Watson
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Watson @ 1993-09-04 23:05 UTC (permalink / raw)
  To: rc

I don't propose to treat them the same within .rcrc.  The rc that I
eventually exec from rsh sources my .rcrc at the moment, so I have the
following in my .rcrc:

   [set path, define fns, etc.]
   if ( test -t 0 ) {
      [set tty, check mail, etc.]
   }

There are many variations on this.  Yes, you will have to rewrite your
.rcrc, but I was assuming that most people were already using wrappers
around rsh or rc to source .rcrc.  Perhaps I was wrong.


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-09-04 22:10 RCRC Alan Watson
1993-09-04 22:20 ` RCRC Chris Siebenmann
1993-09-05 12:00 ` RCRC John Mackin
1993-09-04 23:05 RCRC Alan Watson

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