Age | Commit message (Collapse) | Author | Files | Lines |
|
For AIX.
|
|
|
|
dd fans rejoice!
Also helps with commands like go test -run=x.
|
|
This fixes at least one shell script (printfont) that expected
'x'`{y}'z'
to mean
'x'^`{y}^'z'
as it now does. Before it meant:
'x'^`{y} 'z'
One surprise is that adjacent lists get a free carat:
(x y z)(1 2 3)
is
(x1 y2 z3)
This doesn't affect any rc script in Plan 9 or plan9port.
|
|
|
|
The old yacc-based parser is available with the -Y flag,
which will probably be removed at some point.
The new -D flag dumps a parse tree of the input,
without executing it. This allows comparing the output
of rc -D and rc -DY on different scripts to see that the
two parsers behave the same.
The rc paper ends by saying:
It is remarkable that in the four most recent editions of the UNIX
system programmer’s manual the Bourne shell grammar described in the
manual page does not admit the command who|wc. This is surely an
oversight, but it suggests something darker: nobody really knows what
the Bourne shell’s grammar is. Even examination of the source code is
little help. The parser is implemented by recursive descent, but the
routines corresponding to the syntactic categories all have a flag
argument that subtly changes their operation depending on the context.
Rc’s parser is implemented using yacc, so I can say precisely what the
grammar is.
The new recursive descent parser here has no such flags.
It is a straightforward translation of the yacc.
The new parser will make it easier to handle free carats
in more generality as well as potentially allow the use of
unquoted = as a word character.
Going through this exercise has highlighted a few
dark corners here as well. For example, I was surprised to
find that
x >f | y
>f x | y
are different commands (the latter redirects y's output).
It is similarly surprising that
a=b x | y
sets a during the execution of y.
It is also a bit counter-intuitive
x | y | z
x | if(c) y | z
are not both 3-phase pipelines.
These are certainly not things we should change, but they
are not entirely obvious from the man page description,
undercutting the quoted claim a bit.
On the other hand, who | wc is clearly accepted by the grammar
in the manual page, and the new parser still handles that test case.
|
|
Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.
Signed-off-by: Dan Cross <cross@gajendra.net>
|
|
Change-Id: If8fe1afecb9fe55f85e8e5af37521b83e787d718
|
|
rc on amd64 stores ulimit values as 32-bit int, but the limits on
OpenBSD amd64 can exceed 2^31, so "ulimit -a" shows some values as
negative. This is a problem when I want to increase my ulimit but
the hard ulimit values are printed as negative.
|
|
Rename following .cvsignore files to .gitkeep since they are
required by the build (directories must exist before build):
- bin/fossil/.gitkeep
- bin/fs/.gitkeep
- bin/venti/.gitkeep
Change-Id: I9c2865058480cffb3a4613f25e2eca1f7e5578c0
|
|
There are two bugs in pdec() on INT_MIN:
* wrong output.
`n = 1-n' should be `n = -1-n' when n is INT_MIN.
* infinite loop.
gcc optimizes `if(n>=0)' into `if(true)' because `-INT_MIN' (signed integer overflow) is undefined behavior in C, and gcc assumes the negation of a negative number must be positive. The resulting binary keeps printing '-' forever given INT_MIN.
Try the simplified pdec.c below.
$ gcc pdec.c
$ ./a.out -2147483648
--214748364*
$ gcc pdec.c -O2
$ ./a.out -2147483648
<infinite loop>
$ gcc pdec.c -O2 -D__PATCH__
$ ./a.out -2147483648
-2147483648
=== pdec.c ===
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define io void
void pchr(io *f, int c)
{
putchar(c);
}
void pdec(io *f, int n)
{
if(n<0){
#ifndef __PATCH__
n=-n;
if(n>=0){
pchr(f, '-');
pdec(f, n);
return;
}
/* n is two's complement minimum integer */
n = 1-n;
#else
if(n!=INT_MIN){
pchr(f, '-');
pdec(f, -n);
return;
}
/* n is two's complement minimum integer */
n = -(INT_MIN+1);
#endif
pchr(f, '-');
pdec(f, n/10);
pchr(f, n%10+'1');
return;
}
if(n>9)
pdec(f, n/10);
pchr(f, n%10+'0');
}
int main(int argc, char **argv)
{
int n = atoi(argv[1]);
pdec(NULL, n);
putchar('\n');
}
R=rsc
CC=plan9port.codebot
https://codereview.appspot.com/7241055
|
|
R=rsc
http://codereview.appspot.com/4835048
|
|
R=rsc
http://codereview.appspot.com/4187050
|
|
R=rsc
http://codereview.appspot.com/3833043
|
|
R=rsc
http://codereview.appspot.com/3798046
|
|
http://codereview.appspot.com/105061
|
|
http://codereview.appspot.com/110042
|
|
Save the value of `runq' at the start of the function, so that the `pc'
update
at the end does work on that original value, and not on a probably
modified
value of `runq'.
fixes #14 http://code.swtch.com/plan9port/issue/14/
http://codereview.appspot.com/104066
|
|
reported by micah stetson:
fn foo { echo $bar }
bar=baz foo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SIGPIPE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|