From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] rc break
Date: Sun, 6 Aug 2006 00:18:11 -0500 [thread overview]
Message-ID: <c6c9ea6aebbab21da6eaaad7c2ceb6af@quanstro.net> (raw)
In-Reply-To: <65e36c043167477045d47b3d99da4b64@plan9.bell-labs.com>
it looks like there are a number of cases in /rc/bin. try "grep -n while".
most of them are argument parsing. but then again, argument parsing
is a large part of what scripts do.
the lack of a break also limits one from doing anything like this:
(snippit from an ancient byron's rc script for calculating the date
n days in the future.)
# figure out what day we have by subtraction
j = (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
c = ()
for (i in 31 $feb 31 30 31 30 31 31 30 31 30 31) {
c = ($c 1)
if ( expr $i '>' $d >/dev/null) {
break
}
d = `{expr $d - $i}
}
perhaps something like
catch(done){
for(i) switch($i){
case -x
xflag = 1;
case -y
yflag = 1;
case *
raise done
}
would be better to implement.
- erik
On Sat Aug 5 18:43:19 CDT 2006, geoff@plan9.bell-labs.com wrote:
> I think this will work (modified from an rc script of mine):
>
> while (! ~ $#* 0 && ~ $1 -* && ! ~ $1 --) {
> switch ($1) {
> case -a; destsonly=yes
> case -b; copies=($copies $2) ; shift
> case -c; copies=($copies $user)
> case -v; verbose=yes
> case -*
> echo usage: $0 '[-acv] [-b bcc] [file]...' >[1=2]
> exit usage
> }
> shift
> }
> # process $*, which now lacks options ...
>
> I think this is the only situation in which I used to wish for `break'
> in rc, but it no longer seems worthwhile.
next prev parent reply other threads:[~2006-08-06 5:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-05 15:39 erik quanstrom
2006-08-05 20:59 ` "Nils O. Selåsdal"
2006-08-06 4:25 ` erik quanstrom
2006-08-05 23:42 ` geoff
2006-08-06 5:18 ` erik quanstrom [this message]
2006-08-06 0:50 ` geoff
2006-08-06 6:04 ` erik quanstrom
2009-05-12 1:52 erik quanstrom
2009-05-12 5:08 ` Uriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c6c9ea6aebbab21da6eaaad7c2ceb6af@quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).