Age | Commit message (Collapse) | Author | Files | Lines | |
---|---|---|---|---|---|
2017-09-14 | all: remove .cvsignore files | Kare Nuorteva | 1 | -3/+0 | |
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 | |||||
2013-03-19 | rc: avoid undefined C | Xi Wang | 1 | -4/+4 | |
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 | |||||
2011-08-02 | rc: silence lion roar | Russ Cox | 1 | -0/+1 | |
R=rsc http://codereview.appspot.com/4835048 | |||||
2011-02-16 | rc: fix $ifs bug introduced with utf-8 code | Russ Cox | 1 | -2/+4 | |
R=rsc http://codereview.appspot.com/4187050 | |||||
2011-01-02 | rc: handle 4-byte utf-8 | Russ Cox | 3 | -0/+20 | |
R=rsc http://codereview.appspot.com/3833043 | |||||
2011-01-02 | rc: handle utf-8 in $ifs | Russ Cox | 1 | -8/+16 | |
R=rsc http://codereview.appspot.com/3798046 | |||||
2009-09-13 | rc: implement and document <>{cmd} notation | Michael Teichgräber | 1 | -17/+47 | |
http://codereview.appspot.com/105061 | |||||
2009-08-23 | rc: make read not ignore interrupts/errors (again) | Michael Teichgräber | 1 | -2/+7 | |
http://codereview.appspot.com/110042 | |||||
2009-08-08 | rc: fix segfault when SIGINT is received | Michael Teichgräber | 1 | -1/+2 | |
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 | |||||
2008-08-14 | rc: fix local variables in functions | Russ Cox | 2 | -4/+4 | |
reported by micah stetson: fn foo { echo $bar } bar=baz foo | |||||
2008-07-20 | rc: add subscript sequences (Erik Quanstrom) | Russ Cox | 1 | -5/+35 | |
2007-03-28 | keep path and PATH in sync | rsc | 1 | -0/+2 | |
2007-03-26 | do not redefine rewind | rsc | 1 | -1/+1 | |
2007-03-26 | more memory errors (valgrind) | rsc | 3 | -1/+3 | |
2007-03-26 | fix wait | rsc | 5 | -251/+97 | |
2007-03-26 | fix phantom rc crashes | rsc | 1 | -0/+1 | |
2007-03-26 | sync with plan 9 | rsc | 23 | -1232/+1967 | |
2007-03-25 | cope with programs that leave fd in non-blocking mode (Tim Wiess) | rsc | 2 | -1/+27 | |
2006-06-27 | experiment - allow = in words late in the command line | rsc | 1 | -0/+3 | |
2006-04-08 | add exitcode | rsc | 1 | -0/+11 | |
2006-04-01 | Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. | rsc | 2 | -3/+3 | |
2006-03-20 | update lucida | rsc | 1 | -1/+1 | |
2006-02-14 | shut up about signals in scripts | rsc | 1 | -1/+1 | |
2005-08-11 | Add rfork builtin. | rsc | 1 | -0/+53 | |
2005-08-11 | make sure errors cause non-zero exit status | rsc | 1 | -0/+2 | |
2005-07-26 | fixes from bengt for sun | rsc | 1 | -2/+2 | |
2005-07-14 | ignore window size change | rsc | 1 | -0/+1 | |
2005-07-13 | stupid sun | rsc | 1 | -0/+3 | |
2005-05-19 | set $PLAN9 if necessary | rsc | 1 | -0/+3 | |
2005-03-18 | try harder to put background jobs in background; do not print in response to ↵ | rsc | 4 | -1/+45 | |
SIGPIPE | |||||
2005-03-18 | correct command-printing bug | rsc | 1 | -1/+3 | |
2005-02-13 | handle /dev/stdin always | rsc | 2 | -3/+3 | |
2005-02-11 | set pid=-1 explicitly | rsc | 1 | -0/+1 | |
2005-01-23 | more searchpath-related changes | rsc | 2 | -1/+2 | |
2005-01-19 | use correct yacc | rsc | 1 | -1/+0 | |
2005-01-13 | Many small edits. | rsc | 1 | -0/+1 | |
2005-01-12 | maintain $path and $PATH simultaneously | rsc | 5 | -4/+74 | |
2005-01-07 | success on the sun | rsc | 1 | -0/+16 | |
2004-12-28 | FreeBSD tweaks | rsc | 1 | -4/+2 | |
2004-10-17 | print out signalled exits | rsc | 1 | -0/+5 | |
2004-10-17 | add ulimit and umask as builtins | rsc | 3 | -0/+202 | |
2004-05-16 | Supress line noise. | wkj | 1 | -0/+3 | |
2004-05-14 | More little bug fixes | rsc | 1 | -1/+0 | |
2004-05-11 | Fix small bugs. | rsc | 1 | -1/+1 | |
2004-04-30 | Little fixes. | rsc | 1 | -0/+1 | |
2004-04-24 | fix | rsc | 1 | -1/+0 | |
2004-04-24 | Add scat. Temporary fix to rc r.e. note groups. | rsc | 1 | -1/+1 | |
2004-04-19 | clean up when finished. | rsc | 1 | -1/+0 | |
don't set PLAN9 don't set PLAN9 | |||||
2004-03-26 | handle interrupts and backgrounded processes a little better. | rsc | 3 | -1/+11 | |
2004-03-26 | SunOS can rot in hell. | rsc | 1 | -4/+3 | |