rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: aha
@ 1992-11-06 13:29 Paul Haahr
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Haahr @ 1992-11-06 13:29 UTC (permalink / raw)
  To: malte; +Cc: rc

[ Byron's suggestion to save the status before and restore it after
doing signal processing, which i agree with 100%.]

> This make it impossible (I think) to program something as "do this as long
> as it works but not longer than 10 seconds".

not at all.  instead of writing
        fn false { return 1 }
        fn sigint { false }
        while( ~ $status(0) 0 ) { ... }
just do
	interrupted = false
	fn sigint { interrupted = true }
	while (!~ $interrupted true) { ... }


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

* Re: aha
       [not found] <haahr@mv.us.adobe.com>
@ 1992-11-06 13:36 ` malte
  0 siblings, 0 replies; 6+ messages in thread
From: malte @ 1992-11-06 13:36 UTC (permalink / raw)
  To: rc


		interrupted = false
		fn sigint { interrupted = true }
		while (!~ $interrupted true) { ... }

To be precise:

		while (!~ $interrupted true) {{ ... } || break }

Malte



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

* Re: aha
@ 1992-11-06 12:14 malte
  0 siblings, 0 replies; 6+ messages in thread
From: malte @ 1992-11-06 12:14 UTC (permalink / raw)
  To: rc

	
	Wait! $status already gets set asynchronously with signal handlers
	every time they run a command.

Works great! Instead of

	fn sigint { return 1 }
	while( ~ $status(0) 0 ) { ... }

I use

	fn false { return 1 }
	fn sigint { false }
	while( ~ $status(0) 0 ) { ... }

									So perhaps the signal handler code
	should stash away the old $status and restore it after the signal
	handler is done running.

This make it impossible (I think) to program something as "do this as long
as it works but not longer than 10 seconds".

Malte



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

* Re: aha
@ 1992-11-06  2:25 Byron Rakitzis
  0 siblings, 0 replies; 6+ messages in thread
From: Byron Rakitzis @ 1992-11-06  2:25 UTC (permalink / raw)
  To: netcom!uunet.uu.net!srg!culliton, rc

Wait! $status already gets set asynchronously with signal handlers
every time they run a command. So perhaps the signal handler code
should stash away the old $status and restore it after the signal
handler is done running.

(I didn't mean to open a can of worms, I think setting $status
asynchronously is a really stupid idea, and I am merely suggesting that
this aspect of rc be cleaned up for 1.5.)


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

* Re: aha
@ 1992-11-06  1:22 Tom Culliton x2278
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Culliton x2278 @ 1992-11-06  1:22 UTC (permalink / raw)
  To: byron, rc

br>	I am inclined to make the two the same, if only because
br>	it simplifies the interface. It also means that you
br>	will be able to set $status from within a signal handler
br>	by using "return", for whatever that's worth.

EEK! Asynchronously? Like between "if ( ! command )" and "echo command
failed with status $status"?  Sounds iffy to me.

OBNiggle - The man page says the following about wait:  "If no pid is
specified, rc waits for >>ANY<< child process to exit."  Which would be
OK because you can always say "while (! ~ $#apids 0) wait", but it is
not the way things really work.  The man page should say: "If no pid is
specified, rc waits for all child processes to exit."


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

* aha
@ 1992-11-06  0:28 Byron Rakitzis
  0 siblings, 0 replies; 6+ messages in thread
From: Byron Rakitzis @ 1992-11-06  0:28 UTC (permalink / raw)
  To: rc

I understand now the complaint about "signal handlers
not being functions"

The problem is that the rc signal handler does not invoke
signal-functions the same way that functions are normally
invoked. So far the only difference I noticed is that
"return" is not handled.

I am inclined to make the two the same, if only because
it simplifies the interface. It also means that you
will be able to set $status from within a signal handler
by using "return", for whatever that's worth.


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

end of thread, other threads:[~1992-11-06 13:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-11-06 13:29 aha Paul Haahr
     [not found] <haahr@mv.us.adobe.com>
1992-11-06 13:36 ` aha malte
  -- strict thread matches above, loose matches on Subject: below --
1992-11-06 12:14 aha malte
1992-11-06  2:25 aha Byron Rakitzis
1992-11-06  1:22 aha Tom Culliton x2278
1992-11-06  0:28 aha Byron Rakitzis

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