From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.core.genedata.com ([157.161.173.16]) by hawkwind.utcs.utoronto.ca with SMTP id <24930>; Tue, 15 Jun 1999 17:57:39 -0400 Received: from relay.ch.genedata.com (pinatubo-e0.ch.genedata.com [157.161.173.48]) by mail.core.genedata.com (8.9.3/8.9.3) with ESMTP id PAA10846; Mon, 14 Jun 1999 15:23:54 +0200 Received: (from enh@localhost) by relay.ch.genedata.com (8.9.3/8.9.3) id PAA1469399; Mon, 14 Jun 1999 15:23:54 +0200 (CEST) Date: Mon, 14 Jun 1999 09:23:54 -0400 From: Elliott Hughes Message-Id: <199906141323.PAA1469399@relay.ch.genedata.com> To: Elliott Hughes , Tim Goodwin Subject: Re: backgrounded jobs Cc: rc@hawkwind.utcs.toronto.edu > 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.