rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 14106ccc3b2cb03c8b9a1df1a1b3e3953aaee2f8
parent 3e9e4d3f8f518f8f467066593ae6f270d97f6d60
Author: Toby Goodwin <tjg@star.le.ac.uk>
Date:   Fri, 10 Dec 1999 11:55:04 +0000

beta: rc-1.6b2

Diffstat:
MChangeLog | 13+++++++++++++
MREADME | 2+-
Mconfigure.ac | 2+-
Mglob.c | 7+++++--
Mrc.1 | 23+++++++++++++++++------
Msignal.c | 18+++++++++---------
Mtrip.rc | 4++++
7 files changed, 50 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -652,3 +652,16 @@ Changes since rc-1.5b2 `-L' options, not LIBS. Release: rc-1.6b1. + +1999-12-10 + + Bug: absolute globs do still need a special case. `/*' works again now, but + we still avoid creating names like `//tmp/foo'. + + Bug: avoid a putative race condition in signal.c. + + Documentation: extra parentheses around `~' and `!' expressions are + forbidden. Tom Duff's paper is not distributed with rc, but is + available on the web. + + Release: rc-1.6b2. diff --git a/README b/README @@ -1,4 +1,4 @@ -This is beta release rc-1.6b1. +This is beta release rc-1.6b2. See COPYING for copying information. All files are diff --git a/configure.ac b/configure.ac @@ -8,7 +8,7 @@ dnl Automake stuff. dnl Use this one for snapshots... dnl AM_INIT_AUTOMAKE(rc, 1.6s`echo $RELDATE |sed 's/-//g'`) dnl ...and this one for releases -AM_INIT_AUTOMAKE(rc, 1.6b1) +AM_INIT_AUTOMAKE(rc, 1.6b2) AM_CONFIG_HEADER(config.h) diff --git a/glob.c b/glob.c @@ -127,6 +127,7 @@ static List *dmatch(char *d, char *p, char *m) { } top = r = NULL; + if (*d == '\0') d = "/"; if ((dirp = opendir(d)) == NULL) return NULL; /* opendir succeeds on regular files on some systems, so the stat() call is necessary (sigh) */ @@ -216,8 +217,10 @@ static List *doglob(char *w, char *m) { p = pattern; md = metadir; mp = metapattern; - while (*s != '/' && *s != '\0') - *d++ = *s++, *md++ = *m++; /* get first directory component */ + while (*s != '/' && *s != '\0') { + *d++ = *s++; /* get first directory component */ + *md++ = *m++; + } *d = '\0'; /* Special case: no slashes in the pattern, i.e., open the current directory. diff --git a/rc.1 b/rc.1 @@ -161,7 +161,7 @@ .if !"\\$4"" .Xf \\$2 \\$1 "\\$3\\f\\$1\\$4\\*(Xi" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" .if "\\$4"" \\$3\fR\s10 .. -.TH RC 1 "1999-11-11" +.TH RC 1 "1999-12-10" .SH NAME rc \- shell .SH SYNOPSIS @@ -1971,6 +1971,17 @@ The command should search .Cr $path . .PP +Extra parentheses around a +.Cr ~ +expression or a +.Cr ! +expression are a syntax error. Thus, this +code is illegal. +.Ds +.Cr "while ((~ $1 -*) && (! ~ $1 --)) { ..." +.De +The redundant inner parentheses must be omitted. +.PP Bug reports should be mailed to .Cr "<tjg@star.le.ac.uk>" . .SH INCOMPATIBILITIES @@ -2049,10 +2060,10 @@ being sourced. .SH "SEE ALSO" ``rc \(em A Shell for Plan 9 and UNIX Systems'', Unix Research System, -10th Edition, -vol. 2. (Saunders College Publishing) -(This paper is also distributed with this -.I rc -in PostScript form.) +Tenth Edition, +Volume 2. (Saunders College Publishing) +.PP +.Cr http://www.star.le.ac.uk/~tjg/rc/misc/td.html , +an updated version of the above paper. .PP .IR history (1) diff --git a/signal.c b/signal.c @@ -85,19 +85,19 @@ extern void initsignal() { void (*h)(int); int i; - for (i = 1; i < NUMOFSIGNALS; i++) { - h = sys_signal(i, SIG_DFL); - if (h != SIG_DFL && h != SIG_ERR) - sys_signal(i, h); - sighandlers[i] = h; - } - #if HAVE_SYSV_SIGCLD /* Ensure that SIGCLD is not SIG_IGN. Solaris's rshd does this. :-( */ - h = sys_signal(SIGCLD, SIG_DFL); + h = sys_signal(SIGCLD, SIG_IGN); if (h != SIG_IGN && h != SIG_ERR) sys_signal(SIGCLD, h); else - sighandlers[SIGCLD] = SIG_DFL; + sys_signal(SIGCLD, SIG_DFL); #endif + + for (i = 1; i < NUMOFSIGNALS; i++) { + h = sys_signal(i, SIG_IGN); + if (h != SIG_IGN && h != SIG_ERR) + sys_signal(i, h); + sighandlers[i] = h; + } } diff --git a/trip.rc b/trip.rc @@ -565,3 +565,7 @@ expect foo bar qux $rc -s foo bar qux <<'eof' echo $* eof + +# Believe it or not, I broke root directory globbing in rc-1.6b1. +x=/* +~ '/*' $^x && fail root directory globbing