picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit f743b0468cf6115a2bd2061de40074afdfeed82e
parent f9c7633d9f952b6d7463ecb8cc2fb55a817e9901
Author: Alexander Burger <abu@software-lab.de>
Date:   Thu, 18 Aug 2011 16:32:24 +0200

EOF bug in pipes to stdin
Diffstat:
MCHANGES | 1+
Mersatz/picolisp.jar | 0
Mlib/tags | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/io.c | 10++++++----
Msrc/vers.h | 2+-
Msrc64/io.l | 9++++++++-
Msrc64/version.l | 4++--
7 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,4 +1,5 @@ * XXsep11 picoLisp-3.0.8 + EOF bug in pipes to stdin 'clause' function 'prop' and '::' cons default cell "lib/test.l" position independent diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar Binary files differ. diff --git a/lib/tags b/lib/tags @@ -29,7 +29,7 @@ adr (595 . "@src64/main.l") alarm (472 . "@src64/main.l") all (780 . "@src64/sym.l") and (1616 . "@src64/flow.l") -any (3933 . "@src64/io.l") +any (3940 . "@src64/io.l") append (1338 . "@src64/subr.l") apply (713 . "@src64/apply.l") arg (2311 . "@src64/main.l") @@ -82,12 +82,12 @@ cdddr (245 . "@src64/subr.l") cddr (79 . "@src64/subr.l") cdr (17 . "@src64/subr.l") chain (1141 . "@src64/subr.l") -char (3415 . "@src64/io.l") +char (3422 . "@src64/io.l") chop (1101 . "@src64/sym.l") circ (816 . "@src64/subr.l") circ? (2402 . "@src64/subr.l") clip (1799 . "@src64/subr.l") -close (4338 . "@src64/io.l") +close (4345 . "@src64/io.l") cmd (2913 . "@src64/main.l") cnt (1413 . "@src64/apply.l") co (2540 . "@src64/flow.l") @@ -98,7 +98,7 @@ cond (1911 . "@src64/flow.l") connect (201 . "@src64/net.l") cons (747 . "@src64/subr.l") copy (1225 . "@src64/subr.l") -ctl (4216 . "@src64/io.l") +ctl (4223 . "@src64/io.l") ctty (2711 . "@src64/main.l") cut (1805 . "@src64/sym.l") date (2425 . "@src64/main.l") @@ -115,14 +115,14 @@ dir (2844 . "@src64/main.l") dm (541 . "@src64/flow.l") do (2133 . "@src64/flow.l") e (2914 . "@src64/flow.l") -echo (4369 . "@src64/io.l") +echo (4376 . "@src64/io.l") env (607 . "@src64/main.l") -eof (3492 . "@src64/io.l") -eol (3483 . "@src64/io.l") -err (4196 . "@src64/io.l") +eof (3499 . "@src64/io.l") +eol (3490 . "@src64/io.l") +err (4203 . "@src64/io.l") errno (1375 . "@src64/main.l") eval (180 . "@src64/flow.l") -ext (5097 . "@src64/io.l") +ext (5104 . "@src64/io.l") ext? (1042 . "@src64/sym.l") extern (908 . "@src64/sym.l") extra (1259 . "@src64/flow.l") @@ -137,13 +137,13 @@ find (1322 . "@src64/apply.l") fish (1613 . "@src64/apply.l") flg? (2445 . "@src64/subr.l") flip (1699 . "@src64/subr.l") -flush (5072 . "@src64/io.l") +flush (5079 . "@src64/io.l") fold (3381 . "@src64/sym.l") for (2222 . "@src64/flow.l") fork (3256 . "@src64/flow.l") format (2089 . "@src64/big.l") free (2046 . "@src64/db.l") -from (3511 . "@src64/io.l") +from (3518 . "@src64/io.l") full (1075 . "@src64/subr.l") fun? (742 . "@src64/sym.l") gc (432 . "@src64/gc.l") @@ -156,14 +156,14 @@ gt0 (2716 . "@src64/big.l") hash (2974 . "@src64/big.l") head (1820 . "@src64/subr.l") heap (527 . "@src64/main.l") -hear (3196 . "@src64/io.l") +hear (3203 . "@src64/io.l") host (184 . "@src64/net.l") id (1025 . "@src64/db.l") idx (2045 . "@src64/sym.l") if (1797 . "@src64/flow.l") if2 (1816 . "@src64/flow.l") ifn (1857 . "@src64/flow.l") -in (4156 . "@src64/io.l") +in (4163 . "@src64/io.l") inc (2256 . "@src64/big.l") index (2637 . "@src64/subr.l") info (2748 . "@src64/main.l") @@ -172,7 +172,7 @@ ipid (3201 . "@src64/flow.l") isa (956 . "@src64/flow.l") job (1421 . "@src64/flow.l") journal (968 . "@src64/db.l") -key (3344 . "@src64/io.l") +key (3351 . "@src64/io.l") kill (3233 . "@src64/flow.l") last (2044 . "@src64/subr.l") le0 (2691 . "@src64/big.l") @@ -180,14 +180,14 @@ length (2741 . "@src64/subr.l") let (1471 . "@src64/flow.l") let? (1532 . "@src64/flow.l") lieu (1154 . "@src64/db.l") -line (3667 . "@src64/io.l") -lines (3820 . "@src64/io.l") +line (3674 . "@src64/io.l") +lines (3827 . "@src64/io.l") link (1172 . "@src64/subr.l") lisp (1983 . "@src64/main.l") list (887 . "@src64/subr.l") listen (151 . "@src64/net.l") lit (155 . "@src64/flow.l") -load (4133 . "@src64/io.l") +load (4140 . "@src64/io.l") lock (1182 . "@src64/db.l") loop (2165 . "@src64/flow.l") low? (3253 . "@src64/sym.l") @@ -237,30 +237,30 @@ offset (2677 . "@src64/subr.l") on (1591 . "@src64/sym.l") onOff (1621 . "@src64/sym.l") one (1654 . "@src64/sym.l") -open (4300 . "@src64/io.l") +open (4307 . "@src64/io.l") opid (3217 . "@src64/flow.l") opt (3034 . "@src64/main.l") or (1632 . "@src64/flow.l") -out (4176 . "@src64/io.l") +out (4183 . "@src64/io.l") pack (1152 . "@src64/sym.l") pair (2394 . "@src64/subr.l") pass (754 . "@src64/apply.l") pat? (728 . "@src64/sym.l") -path (1237 . "@src64/io.l") -peek (3399 . "@src64/io.l") +path (1244 . "@src64/io.l") +peek (3406 . "@src64/io.l") pick (1369 . "@src64/apply.l") -pipe (4237 . "@src64/io.l") -poll (3288 . "@src64/io.l") +pipe (4244 . "@src64/io.l") +poll (3295 . "@src64/io.l") pool (648 . "@src64/db.l") pop (1781 . "@src64/sym.l") port (5 . "@src64/net.l") -pr (5180 . "@src64/io.l") +pr (5187 . "@src64/io.l") pre? (1419 . "@src64/sym.l") -prin (4996 . "@src64/io.l") -prinl (5010 . "@src64/io.l") -print (5036 . "@src64/io.l") -println (5067 . "@src64/io.l") -printsp (5052 . "@src64/io.l") +prin (5003 . "@src64/io.l") +prinl (5017 . "@src64/io.l") +print (5043 . "@src64/io.l") +println (5074 . "@src64/io.l") +printsp (5059 . "@src64/io.l") prior (2713 . "@src64/subr.l") prog (1752 . "@src64/flow.l") prog1 (1760 . "@src64/flow.l") @@ -280,12 +280,12 @@ rand (3001 . "@src64/big.l") range (997 . "@src64/subr.l") rank (3033 . "@src64/subr.l") raw (450 . "@src64/main.l") -rd (5114 . "@src64/io.l") -read (2624 . "@src64/io.l") +rd (5121 . "@src64/io.l") +read (2631 . "@src64/io.l") replace (1499 . "@src64/subr.l") rest (2340 . "@src64/main.l") reverse (1678 . "@src64/subr.l") -rewind (5080 . "@src64/io.l") +rewind (5087 . "@src64/io.l") rollback (1889 . "@src64/db.l") rot (848 . "@src64/subr.l") run (311 . "@src64/flow.l") @@ -298,31 +298,31 @@ set (1490 . "@src64/sym.l") setq (1523 . "@src64/sym.l") sigio (488 . "@src64/main.l") size (2806 . "@src64/subr.l") -skip (3469 . "@src64/io.l") +skip (3476 . "@src64/io.l") sort (3962 . "@src64/subr.l") sp? (719 . "@src64/sym.l") -space (5014 . "@src64/io.l") +space (5021 . "@src64/io.l") split (1592 . "@src64/subr.l") stack (556 . "@src64/main.l") state (2001 . "@src64/flow.l") stem (1989 . "@src64/subr.l") -str (3987 . "@src64/io.l") +str (3994 . "@src64/io.l") str? (1021 . "@src64/sym.l") strip (1576 . "@src64/subr.l") sub? (1452 . "@src64/sym.l") sum (1460 . "@src64/apply.l") super (1215 . "@src64/flow.l") -sym (3973 . "@src64/io.l") +sym (3980 . "@src64/io.l") sym? (2434 . "@src64/subr.l") -sync (3156 . "@src64/io.l") +sync (3163 . "@src64/io.l") sys (3053 . "@src64/flow.l") t (1743 . "@src64/flow.l") tail (1911 . "@src64/subr.l") -tell (3228 . "@src64/io.l") +tell (3235 . "@src64/io.l") text (1280 . "@src64/sym.l") throw (2485 . "@src64/flow.l") tick (3169 . "@src64/flow.l") -till (3578 . "@src64/io.l") +till (3585 . "@src64/io.l") time (2558 . "@src64/main.l") touch (1057 . "@src64/sym.l") trim (1759 . "@src64/subr.l") @@ -339,12 +339,12 @@ use (1565 . "@src64/flow.l") usec (2663 . "@src64/main.l") val (1471 . "@src64/sym.l") version (3048 . "@src64/main.l") -wait (3118 . "@src64/io.l") +wait (3125 . "@src64/io.l") when (1876 . "@src64/flow.l") while (2053 . "@src64/flow.l") wipe (3128 . "@src64/sym.l") with (1322 . "@src64/flow.l") -wr (5197 . "@src64/io.l") +wr (5204 . "@src64/io.l") xchg (1546 . "@src64/sym.l") xor (1693 . "@src64/flow.l") x| (2885 . "@src64/big.l") diff --git a/src/io.c b/src/io.c @@ -1,4 +1,4 @@ -/* 27jul11abu +/* 18aug11abu * (c) Software Lab. Alexander Burger */ @@ -247,9 +247,11 @@ void flushAll(void) { static int stdinByte(void) { inFile *p; - if (!(p = InFiles[STDIN_FILENO]) || p->ix == p->cnt && (p->ix < 0 || !slow(p,NO))) - bye(0); - return p->buf[p->ix++]; + if ((p = InFiles[STDIN_FILENO]) && (p->ix != p->cnt || (p->ix >= 0 && slow(p,NO)))) + return p->buf[p->ix++]; + if (!isatty(STDIN_FILENO)) + return -1; + bye(0); } static int getBinary(void) { diff --git a/src/vers.h b/src/vers.h @@ -1 +1 @@ -static byte Version[4] = {3,0,7,5}; +static byte Version[4] = {3,0,7,6}; diff --git a/src64/io.l b/src64/io.l @@ -1,4 +1,4 @@ -# 27jul11abu +# 18aug11abu # (c) Software Lab. Alexander Burger # Close file descriptor @@ -434,6 +434,13 @@ ret end end + cc isatty(0) # STDIN + nul4 # on a tty? + if z # No + ld A -1 # Return EOF + pop Z + ret + end ld E 0 # Exit OK jmp byeE diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 27jul11abu +# 18aug11abu # (c) Software Lab. Alexander Burger -(de *Version 3 0 7 5) +(de *Version 3 0 7 6) # vi:et:ts=3:sw=3