commit 879921041eb0d12a6789f954db311cc3ef8b892d
parent fdad690897bab5783236bfbd2217ce7e01f59569
Author: tjg <tjg>
Date: Fri, 12 Oct 2001 10:25:58 +0000
Release: rc-1.6b3.
Diffstat:
M | ChangeLog | | | 19 | ++++++++++++++++++- |
M | NEWS | | | 41 | ++++++++++++++++++----------------------- |
M | rc.1 | | | 183 | ++++++++++++++++++++++++++++++++++++++++++++----------------------------------- |
3 files changed, 137 insertions(+), 106 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -699,10 +699,27 @@ Changes since rc-1.5b2
Documentation: we don't consider that `.' failing to search path is
a bug.
- Bug: the ^A bug is fixed.
+ Feature: ^A in lists is now handled transparently.
2001-10-01
Bug: it's no longer possible to use parentheses to sneak a word that
needs quoting past the "quoting detector", so `fn x { echo $(x.y) }'
now works both in the current rc and its descendants.
+
+ Documentation: mention the catastrophic effects of a semantic error
+ in fn prompt.
+
+2001-10-03
+
+ Feature: exported lists no longer use redundant parentheses.
+
+2001-10-04
+
+ Bug: semantic errors in `fn prompt' no longer throw rc into a tailspin.
+
+ Feature: don't export $cdpath or $home (the lower-case versions).
+
+2001-10-12
+
+ Release: rc-1.6b3.
diff --git a/NEWS b/NEWS
@@ -1,29 +1,24 @@
-Highlights of changes since rc-1.4. See ChangeLog for further details.
+Highlights of changes since rc-1.6. See ChangeLog for further details.
-Portability. The major change since the last full release is that rc
-now uses GNU autoconf and automake. Other parts of the build process
-have been tidied up too, so that building rc should now be painless. It
-has been tested on a wide variety of Unix-like systems.
+Portability. Many minor tweaks, including fixes for BeOS, CygWin, and
+gcc-3.
-Bug fixes. The following bugs have been fixed: the interaction with
-readline was not always correct; SIGCLD set to SIG_IGN could cause a
-hang; some obscure pipeline incantations could cause a hang; the `wait'
-builtin could become uninterruptible; an application could crash rc
-by making stdin nonblocking; the `-i' flag didn't work with readline;
-$history didn't work properly over NFS; a few memory leaks; and an off
-by one bug in reporting line numbers of errors.
+Bug fixes. A number of bugs have been fixed. The serious ones were:
+a core dump, triggered by `~ () '*''; premature exit, triggered by
+sourcing a file which could be open()ed but not read() (such as a
+directory on many systems); uninterruptible looping, triggered by
+semantic errors in `fn prompt'.
-New features. The following features are new: the `-s' flag, which
-causes rc to read from stdin even if arguments are present; the `-V'
-flag, which prints a version string; $bqstatus which holds the exit
-status of the last backquote command; additional options to the `whatis'
-builtin; and support for vrl, another lightweight readline-style
-library.
+New features. The following features are new: the `$version' variable
+replaces the `-V' flag; the `-I' flag (definitively not interactive)
+was added for compatibility with the Plan 9 rc; ASCII SOH (^A) is now
+handled transparently.
-What happened to rc-1.5? A number of beta releases were made with names
-like rc-1.5b2, which might suggest improvements over rc-1.5. To avoid
-any possibility of confusion, I decided to name this release rc-1.6
-instead.
+Documentation. Distributions of this rc used to include a PostScript
+paper given by Tom Duff to the UKUUG, describing the Plan 9 rc. This
+paper is no longer distributed with rc, but instead is available on
+the web, both in its original PostScript version, and an updated HTML
+version.
Tim Goodwin
-1999-05-26
+2001-10-05
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 "2001-06-18"
+.TH RC 1 "2001-10-12"
.SH NAME
rc \- shell
.SH SYNOPSIS
@@ -242,13 +242,22 @@ will be in
mode.
That is, a prompt (from
.Cr $prompt(1)\^ )
-will be printed before an
-input line is taken, and
+will be printed before an input line is taken, and
.I rc
-will ignore the signals
-.Cr SIGINT
-and
-.Cr SIGQUIT .
+will ignore
+.Cr SIGINT .
+.TP
+.Cr \-I
+If the
+.Cr \-I
+flag is present, or if the input to
+.I rc
+is not from a terminal, then
+.I rc
+will not be in interactive mode. No prompts will be printed, and
+SIGINT will cause
+.I rc
+to exit.
.TP
.Cr \-l
If the
@@ -899,18 +908,15 @@ Note that the null string,
.Cr "''" ,
and the null list,
.Cr "()" ,
-are two very
-different things.
-Assigning the null string to variable is a valid
-operation, but it does not remove its definition.
-For example,
-if
-.Cr $a
-is set to
-.Cr "''" ,
-then
-.Cr "$#a" ,
-returns a 1.
+are two very different things. Assigning the null string to a
+variable is a valid operation, but it does not remove its definition.
+.Ds
+.Cr "null = '' empty = () echo $#null $#empty"
+.Te
+produces the output
+.Ts
+.Cr "1 0"
+.De
.SS "List Concatenation"
Two lists may be joined by the concatenation operator
.Rc ( ^ ).
@@ -1067,13 +1073,9 @@ where
is a list of integers (origin 1).
The list of subscripts need
not be in order or even unique.
-Thus, if
+Thus,
.Ds
.Cr "a=(one two three)"
-.De
-.PP
-then
-.Ds
.Cr "echo $a(3 3 3)"
.De
.PP
@@ -1245,7 +1247,9 @@ Note also that an assignment to
.Cr $cdpath
causes an automatic assignment to
.Cr $CDPATH ,
-and vice-versa.
+and vice-versa. Only
+.Cr $CDPATH
+is exported into the environment.
.TP
.Cr history
.Cr $history
@@ -1299,11 +1303,11 @@ and
and
.Cr $PATH
are aliased to each other.
-If
-.Cr $path
-or
+If neither
.Cr $PATH
-is not set at startup time,
+nor
+.Cr $path
+is set at startup time,
.Cr $path
assumes a default value suitable for your system.
This is typically
@@ -1355,19 +1359,15 @@ is about to print
.Cr "$prompt(1)" .
.TP
.Cr status " (read only)"
-The exit status of the last command.
-If the command exited with a numeric value,
-that number is the status.
-If the died with a signal,
-the status is the name of that signal; if a core file
-was created, the string
+The exit status of the last command. If the command exited with a
+numeric value, that number is the status. If the command died with a
+signal, the status is the name of that signal; if a core file was
+created, the string
.Rc `` +core ''
-is appended.
-The value of
+is appended. The value of
.Cr $status
-for a pipeline is a list, with one entry,
-as above, for each process in the pipeline.
-For example, the command
+for a pipeline is a list, with one entry, as above, for each process
+in the pipeline. For example, the command
.Ds
.Cr "ls | wc"
.De
@@ -1629,9 +1629,10 @@ The resources which can be shown or altered are
.BR filesize ,
.BR datasize ,
.BR stacksize ,
-.B coredumpsize
-and
-.BR memoryuse .
+.BR coredumpsize ,
+.BR memoryuse ,
+and, where supported,
+.BR descriptors .
For
example:
.Ds
@@ -1766,22 +1767,62 @@ For example,
.Ds
.Cr "whatis \-\|\- \-p"
.De
+.SH EXAMPLES
+The
+.B shift
+builtin only shifts
+.Cr "$*" .
+This function can shift any variable (except
+.Cr "$lshift" ).
+.Ds
+.Cr "fn lshift { lshift=$*; *=$$1; shift $lshift(2); $lshift(1)=$* }"
+.De
+With this definition in place,
+.Ds
+.Cr "walrus = (shoes ships sealing-wax cabbages kings)"
+.Cr "lshift walrus 3"
+.Cr "whatis walrus"
+.De
+prints
+.Ds
+.Cr "walrus=(cabbages kings)"
+.De
+.PP
+The
+.Cr $^var
+operator flattens a list by separating each element with a space.
+This function allows the separator to be an arbitrary string.
+.Ds
+.Cr "fn lflat {"
+.Cr " lflat=$*; *=$$1"
+.Cr " while () {"
+.Cr " echo -n $1; shift"
+.Cr " ~ $#* 0 && break"
+.Cr " echo -n $lflat(2)"
+.Cr "}"
+.De
+With this definition in place,
+.Ds
+.Cr "hops=(uunet mcvax ukc tlg)"
+.Cr lflat hops !
+.De
+prints (with no final newline)
+.Ds
+.Cr uunet!mcvax!ukc!tlg
+.De
.SH "EXIT STATUS"
The exit status of
.I rc
-is normally the same as that of the
-last command executed. If the last
-command was a pipeline,
+is normally the same as that of the last command executed. If the
+last command was a pipeline,
.I rc
exits
.Cr 0
-if every command in the pipeline did;
-otherwise it exits
+if every command in the pipeline did; otherwise it exits
.Cr 1 .
.PP
.I rc
-can be made to exit with a particular
-status using the
+can be made to exit with a particular status using the
.B exit
builtin.
.SH GRAMMAR
@@ -1907,52 +1948,30 @@ On modern systems that support
or
.Cr /proc/self/fd ,
.Cr <{foo}
-style redirection is implemented that way.
-However, on other systems it is implemented with named pipes,
-and it is sometimes
+style redirection is implemented that way. However, on older systems
+it is implemented with named pipes. Allegedly, it is sometimes
possible to foil
.I rc
into removing the FIFO it places in
.Cr /tmp
prematurely, or it is even possible to cause
.I rc
-to hang.
-.PP
-The functionality of
-.B shift
-should be available for variables other than
-.Cr "$*" .
+to hang. (The current maintainer has never seen this, but then he
+doesn't use systems which lack
+.Cr /dev/fd
+any more. If anybody can reproduce this problem, please let the
+maintainer know.)
.PP
.B echo
is built in only for performance reasons, which is a bad idea.
.PP
There should be a way to avoid exporting a variable.
.PP
-The
-.Cr $^var
-notation for flattening should allow for using an arbitrary
-separating character, not just space.
-.PP
-If both
-.Cr $PATH
-and
-.Cr $path
-are set,
-.I rc
-believes the former. Arguably this is a bug:
-.I rc
-can quite happily deal with path elements that contain
-.Cr : ,
-but such elements will be split at the colon in descendant
-.I rc
-processes.
-.PP
Extra parentheses around a
.Cr ~
expression or a
.Cr !
-expression are a syntax error. Thus, this
-code is illegal.
+expression are a syntax error. Thus, this code is illegal.
.Ds
.Cr "while ((~ $1 -*) && (! ~ $1 --)) { ..."
.De
@@ -2002,7 +2021,7 @@ does not, since it is not considered useful.
The list flattening operator,
.Cr $^foo ,
is spelt
-.Cr $"foo
+.Cr "$\"foo"
in those versions of the Bell Labs
.IR rc
which have it.
@@ -2040,7 +2059,7 @@ Unix Research System,
Tenth Edition,
Volume 2. (Saunders College Publishing)
.PP
-.Cr http://www.star.le.ac.uk/~tjg/rc/misc/td.html ,
+.Cr http://www.star.le.ac.uk/~tjg/rc/misc/td ,
an updated version of the above paper.
.PP
.IR history (1)