rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* backgrounded jobs
@ 1999-06-10  9:48 Elliott Hughes
  1999-06-11 13:17 ` Gerry.Tomlinson
  1999-06-14 11:53 ` Tim Goodwin
  0 siblings, 2 replies; 5+ messages in thread
From: Elliott Hughes @ 1999-06-10  9:48 UTC (permalink / raw)
  To: rc


something i had in my own hacked-about copy of
Byron's rc is a line that output not just the pid of
a backgrounded job, rather the string "kill %i\n", on
the basis that this was the number one use of the
pid. it's particularly handy in 9term, but probably
just as useful in xterm.

how would people feel about making this part of
the distribution? i admit that it looks odd at first
because traditional shells don't work like that; you
probably have to know why its saying that not to
be disconcerted by it, but i think its usefulness
outweighs this, not least because rc users aren't
likely to be neophyte shell users who want
everything to be just like it is in sh (or bash these
days, i suppose).

Plan 9 rc doesn't do this, but that's probably
because "kill %i |rc\n" would just look _too_
weird. that, or they didn't think of it.

i also have a replacement for the shift built-in
that does the things whose absence is listed as
a bug on the man page, if anyone's interested.
i used it in a big nasty rc script once, before
i repented and stopped writing complicated
things as shell scripts. it's only a couple of
lines longer than the current builtin, and it
would mean we could remove a "bug",
though.

[i assume i'm on this list: i subscribed but
haven't seen anything. but i haven't seen
anything on wilyfans in the same period,
so maybe things are just quiet.]

	- Elliott

-- 
"Act Swiss. Be Global." -- ABB Werbung, 1999.


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: backgrounded jobs
@ 1999-06-10 22:00 steve.kilbane
  0 siblings, 0 replies; 5+ messages in thread
From: steve.kilbane @ 1999-06-10 22:00 UTC (permalink / raw)
  To: Elliott Hughes; +Cc: rc



On 10/06/99 10:48:06 Elliott Hughes  wrote:

> something i had in my own hacked-about copy of
> Byron's rc is a line that output not just the pid of
> a backgrounded job, rather the string "kill %i\n", on
> the basis that this was the number one use of the
> pid. it's particularly handy in 9term, but probably
> just as useful in xterm.
>
> how would people feel about making this part of
> the distribution?

Mutter, grumble. Doesn't sound right to me - not in rc. It sounds more es-ish to
me. :-)

Mind you, I'm the one who made Wily's no-arg Kill print a list of the likely
Kill commands, so who am I to complain?

And I don't even use rc, so my opinion doesn't even count.

steve




^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: backgrounded jobs
@ 1999-06-14 13:23 Elliott Hughes
  0 siblings, 0 replies; 5+ messages in thread
From: Elliott Hughes @ 1999-06-14 13:23 UTC (permalink / raw)
  To: Elliott Hughes, Tim Goodwin; +Cc: rc

> Does this suffice?
> fn prompt {if(!~ $apid $lastapid){echo kill $apid;lastapid=$apid}}

i suppose so. it's a bit uglier, because rc automatically outputs the
pid, but i can live with it.

> I didn't really give much thought to this; just left the "bug" in the
> man page.  But doesn't this function come close? ...

that's nasty, though, when the builtin requires so little alteration.
here's a snippet from my local rc:

/* drop first n (default 1) items of variable xs (default $*) */

static void b_shift(char **av)
{
	int n = (av[1] == 0 ? 1 : a2u(av[1]));
	List *xs, *dollarzero;

	if (av[1] != 0 && av[2] != 0 && av[3] != 0) {
		arg_count("shift");
		return;
	}
	if (n < 0) {
		badnum(av[1]);
		return;
	}
	if (av[1] == 0 || av[2] == 0) {
		xs = varlookup("*")->n;
		dollarzero = varlookup("0");
	} else {
		xs = varlookup(av[2]);
	}
	
	while (xs != 0 && n != 0) {
		xs = xs->n;
		--n;
	}
	
	if (av[1] == 0 || av[2] == 0) {
		varassign("*", append(dollarzero, xs), FALSE);
	} else {
		varassign(av[2], xs, FALSE);
	}
	set(TRUE);
}

note that i don't consider dropping items from an empty list to
be an error, in contrast to Byron's rc. i don't know why he chose
to make it behave like that (Duff's doesn't, and neither do any
functional programming languages I can think of).

	-e

-- 
"Act Swiss. Be Global." -- ABB Werbung, 1999.


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

end of thread, other threads:[~1999-06-15 21:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-10  9:48 backgrounded jobs Elliott Hughes
1999-06-11 13:17 ` Gerry.Tomlinson
1999-06-14 11:53 ` Tim Goodwin
1999-06-10 22:00 steve.kilbane
1999-06-14 13:23 Elliott Hughes

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