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 de03be276d855bd6452306b2902f395547435fed
parent cff04de7acb8a578068c7478770a75664b73111e
Author: Alexander Burger <abu@software-lab.de>
Date:   Thu, 22 Nov 2012 08:53:05 +0100

Terminate if STDERR is not writable (e.g. SIGHUP)
Diffstat:
Mlib/map | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/io.c | 7+++++--
Msrc64/io.l | 9+++++++--
Msrc64/tags | 238++++++++++++++++++++++++++++++++++++++++----------------------------------------
4 files changed, 172 insertions(+), 164 deletions(-)

diff --git a/lib/map b/lib/map @@ -29,7 +29,7 @@ adr (587 . "@src64/main.l") alarm (473 . "@src64/main.l") all (788 . "@src64/sym.l") and (1624 . "@src64/flow.l") -any (3974 . "@src64/io.l") +any (3979 . "@src64/io.l") append (1338 . "@src64/subr.l") apply (713 . "@src64/apply.l") arg (2466 . "@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 (3456 . "@src64/io.l") +char (3461 . "@src64/io.l") chop (1219 . "@src64/sym.l") circ (816 . "@src64/subr.l") circ? (2402 . "@src64/subr.l") clip (1799 . "@src64/subr.l") -close (4387 . "@src64/io.l") +close (4392 . "@src64/io.l") cmd (3071 . "@src64/main.l") cnt (1413 . "@src64/apply.l") co (2548 . "@src64/flow.l") @@ -98,7 +98,7 @@ cond (1919 . "@src64/flow.l") connect (224 . "@src64/net.l") cons (747 . "@src64/subr.l") copy (1225 . "@src64/subr.l") -ctl (4260 . "@src64/io.l") +ctl (4265 . "@src64/io.l") ctty (2866 . "@src64/main.l") cut (1922 . "@src64/sym.l") date (2580 . "@src64/main.l") @@ -115,14 +115,14 @@ dir (3001 . "@src64/main.l") dm (545 . "@src64/flow.l") do (2141 . "@src64/flow.l") e (2928 . "@src64/flow.l") -echo (4418 . "@src64/io.l") +echo (4423 . "@src64/io.l") env (599 . "@src64/main.l") -eof (3533 . "@src64/io.l") -eol (3524 . "@src64/io.l") -err (4240 . "@src64/io.l") +eof (3538 . "@src64/io.l") +eol (3529 . "@src64/io.l") +err (4245 . "@src64/io.l") errno (1468 . "@src64/main.l") eval (175 . "@src64/flow.l") -ext (5152 . "@src64/io.l") +ext (5157 . "@src64/io.l") ext? (1157 . "@src64/sym.l") extern (1023 . "@src64/sym.l") extra (1269 . "@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 (5127 . "@src64/io.l") +flush (5132 . "@src64/io.l") fold (3512 . "@src64/sym.l") for (2230 . "@src64/flow.l") fork (3270 . "@src64/flow.l") format (2089 . "@src64/big.l") free (2055 . "@src64/db.l") -from (3552 . "@src64/io.l") +from (3557 . "@src64/io.l") full (1075 . "@src64/subr.l") fun? (750 . "@src64/sym.l") gc (435 . "@src64/gc.l") @@ -156,14 +156,14 @@ gt0 (2718 . "@src64/big.l") hash (2976 . "@src64/big.l") head (1820 . "@src64/subr.l") heap (519 . "@src64/main.l") -hear (3237 . "@src64/io.l") +hear (3242 . "@src64/io.l") host (190 . "@src64/net.l") id (1028 . "@src64/db.l") idx (2162 . "@src64/sym.l") if (1805 . "@src64/flow.l") if2 (1824 . "@src64/flow.l") ifn (1865 . "@src64/flow.l") -in (4200 . "@src64/io.l") +in (4205 . "@src64/io.l") inc (2256 . "@src64/big.l") index (2637 . "@src64/subr.l") info (2903 . "@src64/main.l") @@ -172,7 +172,7 @@ ipid (3215 . "@src64/flow.l") isa (967 . "@src64/flow.l") job (1429 . "@src64/flow.l") journal (971 . "@src64/db.l") -key (3385 . "@src64/io.l") +key (3390 . "@src64/io.l") kill (3247 . "@src64/flow.l") last (2044 . "@src64/subr.l") le0 (2693 . "@src64/big.l") @@ -180,14 +180,14 @@ length (2741 . "@src64/subr.l") let (1479 . "@src64/flow.l") let? (1540 . "@src64/flow.l") lieu (1157 . "@src64/db.l") -line (3708 . "@src64/io.l") -lines (3861 . "@src64/io.l") +line (3713 . "@src64/io.l") +lines (3866 . "@src64/io.l") link (1172 . "@src64/subr.l") lisp (2137 . "@src64/main.l") list (887 . "@src64/subr.l") listen (157 . "@src64/net.l") lit (150 . "@src64/flow.l") -load (4177 . "@src64/io.l") +load (4182 . "@src64/io.l") lock (1185 . "@src64/db.l") loop (2173 . "@src64/flow.l") low? (3378 . "@src64/sym.l") @@ -237,30 +237,30 @@ offset (2677 . "@src64/subr.l") on (1708 . "@src64/sym.l") onOff (1738 . "@src64/sym.l") one (1771 . "@src64/sym.l") -open (4344 . "@src64/io.l") +open (4349 . "@src64/io.l") opid (3231 . "@src64/flow.l") opt (3192 . "@src64/main.l") or (1640 . "@src64/flow.l") -out (4220 . "@src64/io.l") +out (4225 . "@src64/io.l") pack (1270 . "@src64/sym.l") pair (2394 . "@src64/subr.l") pass (754 . "@src64/apply.l") pat? (736 . "@src64/sym.l") -path (1246 . "@src64/io.l") -peek (3440 . "@src64/io.l") +path (1251 . "@src64/io.l") +peek (3445 . "@src64/io.l") pick (1369 . "@src64/apply.l") -pipe (4281 . "@src64/io.l") -poll (3329 . "@src64/io.l") +pipe (4286 . "@src64/io.l") +poll (3334 . "@src64/io.l") pool (651 . "@src64/db.l") pop (1898 . "@src64/sym.l") port (5 . "@src64/net.l") -pr (5235 . "@src64/io.l") +pr (5240 . "@src64/io.l") pre? (1536 . "@src64/sym.l") -prin (5051 . "@src64/io.l") -prinl (5065 . "@src64/io.l") -print (5091 . "@src64/io.l") -println (5122 . "@src64/io.l") -printsp (5107 . "@src64/io.l") +prin (5056 . "@src64/io.l") +prinl (5070 . "@src64/io.l") +print (5096 . "@src64/io.l") +println (5127 . "@src64/io.l") +printsp (5112 . "@src64/io.l") prior (2713 . "@src64/subr.l") prog (1760 . "@src64/flow.l") prog1 (1768 . "@src64/flow.l") @@ -280,12 +280,12 @@ rand (3003 . "@src64/big.l") range (997 . "@src64/subr.l") rank (3036 . "@src64/subr.l") raw (451 . "@src64/main.l") -rd (5169 . "@src64/io.l") -read (2665 . "@src64/io.l") +rd (5174 . "@src64/io.l") +read (2670 . "@src64/io.l") replace (1499 . "@src64/subr.l") rest (2495 . "@src64/main.l") reverse (1678 . "@src64/subr.l") -rewind (5135 . "@src64/io.l") +rewind (5140 . "@src64/io.l") rollback (1898 . "@src64/db.l") rot (848 . "@src64/subr.l") run (306 . "@src64/flow.l") @@ -298,33 +298,33 @@ set (1607 . "@src64/sym.l") setq (1640 . "@src64/sym.l") sigio (489 . "@src64/main.l") size (2809 . "@src64/subr.l") -skip (3510 . "@src64/io.l") +skip (3515 . "@src64/io.l") sort (3965 . "@src64/subr.l") sp? (727 . "@src64/sym.l") -space (5069 . "@src64/io.l") +space (5074 . "@src64/io.l") split (1592 . "@src64/subr.l") stack (548 . "@src64/main.l") state (2009 . "@src64/flow.l") stem (1989 . "@src64/subr.l") -str (4028 . "@src64/io.l") +str (4033 . "@src64/io.l") str? (1136 . "@src64/sym.l") strip (1576 . "@src64/subr.l") struct (1928 . "@src64/main.l") sub? (1569 . "@src64/sym.l") sum (1460 . "@src64/apply.l") super (1225 . "@src64/flow.l") -sym (4014 . "@src64/io.l") +sym (4019 . "@src64/io.l") sym? (2434 . "@src64/subr.l") symbols (942 . "@src64/sym.l") -sync (3197 . "@src64/io.l") +sync (3202 . "@src64/io.l") sys (3067 . "@src64/flow.l") t (1751 . "@src64/flow.l") tail (1911 . "@src64/subr.l") -tell (3269 . "@src64/io.l") +tell (3274 . "@src64/io.l") text (1398 . "@src64/sym.l") throw (2493 . "@src64/flow.l") tick (3183 . "@src64/flow.l") -till (3619 . "@src64/io.l") +till (3624 . "@src64/io.l") time (2713 . "@src64/main.l") touch (1172 . "@src64/sym.l") trail (695 . "@src64/main.l") @@ -342,12 +342,12 @@ use (1573 . "@src64/flow.l") usec (2818 . "@src64/main.l") val (1588 . "@src64/sym.l") version (3206 . "@src64/main.l") -wait (3159 . "@src64/io.l") +wait (3164 . "@src64/io.l") when (1884 . "@src64/flow.l") while (2061 . "@src64/flow.l") wipe (3253 . "@src64/sym.l") with (1332 . "@src64/flow.l") -wr (5252 . "@src64/io.l") +wr (5257 . "@src64/io.l") xchg (1663 . "@src64/sym.l") xor (1701 . "@src64/flow.l") x| (2887 . "@src64/big.l") diff --git a/src/io.c b/src/io.c @@ -1,4 +1,4 @@ -/* 13nov12abu +/* 22nov12abu * (c) Software Lab. Alexander Burger */ @@ -183,8 +183,11 @@ bool wrBytes(int fd, byte *p, int cnt) { else { if (errno == EBADF || errno == EPIPE || errno == ECONNRESET) return NO; - if (errno != EINTR) + if (errno != EINTR) { + if (fd == STDERR_FILENO) + bye(2); writeErr("bytes"); + } if (*Signal) sighandler(NULL); } diff --git a/src64/io.l b/src64/io.l @@ -1,4 +1,4 @@ -# 09nov12abu +# 22nov12abu # (c) Software Lab. Alexander Burger # Close file descriptor @@ -331,7 +331,12 @@ cmp A ECONNRESET # Connection reset by peer? jeq retnz # Return 'nz' cmp A EINTR # Interrupted? - jne wrBytesErr # No + if ne # No + cmp C 2 # stderr? + jne wrBytesErr # No + ld E 2 # Exit error code + jmp byeE + end null (Signal) # Signal? if nz # Yes call sighandler0 diff --git a/src64/tags b/src64/tags @@ -582,7 +582,7 @@ sys/x86-64.linux.defs.l,1959 doHash2976,70791 doRand3003,71394 -./io.l,2919 +./io.l,2921 closeAX5,75 unLockFileAC15,253 wrLockFileC23,487 @@ -601,124 +601,124 @@ sys/x86-64.linux.defs.l,1959 rdBytesCEX_F247,5696 rdBytesNbCEX_F268,6160 wrBytesCEX_F317,7454 -clsChildY342,8127 -wrChildCXY353,8379 -flushA_F392,9484 -flushAll412,9894 -stdinByte_A426,10205 -getBinaryZ_FB448,10561 -byteNumBCX_CX464,10931 -binReadZ_FE520,12460 -prByteCEXY681,16715 -prCntCE704,17241 -prTellEZ723,17608 -prE729,17763 -binPrintEZ731,17832 -putTellBZ997,25588 -tellBegZ_Z1005,25778 -tellEndAZ1012,25930 -unsync1059,27037 -rdHear_FE1076,27458 -symByteCX_FACX1089,27804 -symCharCX_FACX1110,28243 -bufStringE_SZ1143,29195 -pathStringE_SZ1173,29849 -doPath1246,31802 -charSymACX_CX1258,32072 -byteSymBCX_CX1293,32996 -currFdX_C1335,34112 -currFd_C1339,34224 -rdOpenEXY1356,34597 -wrOpenEXY1497,39003 -erOpenEXY1630,43178 -ctOpenEXY1672,44197 -getStdin_A1726,45611 -getParse_A1797,47451 -pushInFilesY1820,47921 -pushOutFilesY1844,48461 -pushErrFilesY1855,48756 -pushCtlFilesY1860,48860 -popInFiles1865,48964 -popOutFiles1916,50185 -popErrFiles1956,51210 -popCtlFiles1963,51413 -getChar_A1977,51804 -skipC_A2009,52675 -testEscA_F2052,53596 -anonymousX_FE2086,54349 -rdAtomBY_E2119,55212 -rdList_E2171,56639 -readA_E2309,60171 -readC_E2493,64488 -tokenCE_E2523,65079 -doRead2665,68540 -inReadyC_F2703,69380 -fdSetCL_X2715,69661 -fdRdSetCZL2727,69895 -fdWrSetCZL2734,70037 -rdSetCL_F2741,70186 -wrSetCL_F2746,70302 -rdSetRdyCL_F2751,70425 -waitFdCEX_A2773,70886 -doWait3159,83710 -doSync3197,84433 -doHear3237,85373 -doTell3269,86067 -fdSetC_Y3318,87155 -doPoll3329,87389 -doKey3385,88760 -doPeek3440,90199 -doChar3456,90477 -doSkip3510,91422 -doEol3524,91769 -doEof3533,91935 -doFrom3552,92292 -doTill3619,93961 -eolA_F3693,95910 -doLine3708,96214 -doLines3861,100254 -parseBCE_E3902,101155 -doAny3974,102810 -doSym4014,103748 -doStr4028,104007 -loadBEX_E4081,105133 -doLoad4177,107483 -doIn4200,107895 -doOut4220,108225 -doErr4240,108559 -doCtl4260,108894 -doPipe4281,109249 -doOpen4344,110795 -doClose4387,111775 -doEcho4418,112366 -putStdoutB4631,117890 -newline4674,118872 -space4678,118914 -outNumE4683,118978 -outWordA4690,119106 -prExtNmX4702,119344 -outOctA4710,119538 -outAoA4723,119806 -outStringS4735,120054 -outStringC4737,120124 -outNameE4747,120263 -prNameX4755,120380 -printE_E4765,120535 -printE4774,120671 -prinE_E4987,126287 -prinE4996,126423 -doPrin5051,127685 -doPrinl5065,127955 -doSpace5069,128023 -doPrint5091,128422 -doPrintsp5107,128717 -doPrintln5122,129006 -doFlush5127,129094 -doRewind5135,129231 -doExt5152,129621 -doRd5169,129960 -doPr5235,131740 -doWr5252,132072 +clsChildY347,8254 +wrChildCXY358,8506 +flushA_F397,9611 +flushAll417,10021 +stdinByte_A431,10332 +getBinaryZ_FB453,10688 +byteNumBCX_CX469,11058 +binReadZ_FE525,12587 +prByteCEXY686,16842 +prCntCE709,17368 +prTellEZ728,17735 +prE734,17890 +binPrintEZ736,17959 +putTellBZ1002,25715 +tellBegZ_Z1010,25905 +tellEndAZ1017,26057 +unsync1064,27164 +rdHear_FE1081,27585 +symByteCX_FACX1094,27931 +symCharCX_FACX1115,28370 +bufStringE_SZ1148,29322 +pathStringE_SZ1178,29976 +doPath1251,31929 +charSymACX_CX1263,32199 +byteSymBCX_CX1298,33123 +currFdX_C1340,34239 +currFd_C1344,34351 +rdOpenEXY1361,34724 +wrOpenEXY1502,39130 +erOpenEXY1635,43305 +ctOpenEXY1677,44324 +getStdin_A1731,45738 +getParse_A1802,47578 +pushInFilesY1825,48048 +pushOutFilesY1849,48588 +pushErrFilesY1860,48883 +pushCtlFilesY1865,48987 +popInFiles1870,49091 +popOutFiles1921,50312 +popErrFiles1961,51337 +popCtlFiles1968,51540 +getChar_A1982,51931 +skipC_A2014,52802 +testEscA_F2057,53723 +anonymousX_FE2091,54476 +rdAtomBY_E2124,55339 +rdList_E2176,56766 +readA_E2314,60298 +readC_E2498,64615 +tokenCE_E2528,65206 +doRead2670,68667 +inReadyC_F2708,69507 +fdSetCL_X2720,69788 +fdRdSetCZL2732,70022 +fdWrSetCZL2739,70164 +rdSetCL_F2746,70313 +wrSetCL_F2751,70429 +rdSetRdyCL_F2756,70552 +waitFdCEX_A2778,71013 +doWait3164,83837 +doSync3202,84560 +doHear3242,85500 +doTell3274,86194 +fdSetC_Y3323,87282 +doPoll3334,87516 +doKey3390,88887 +doPeek3445,90326 +doChar3461,90604 +doSkip3515,91549 +doEol3529,91896 +doEof3538,92062 +doFrom3557,92419 +doTill3624,94088 +eolA_F3698,96037 +doLine3713,96341 +doLines3866,100381 +parseBCE_E3907,101282 +doAny3979,102937 +doSym4019,103875 +doStr4033,104134 +loadBEX_E4086,105260 +doLoad4182,107610 +doIn4205,108022 +doOut4225,108352 +doErr4245,108686 +doCtl4265,109021 +doPipe4286,109376 +doOpen4349,110922 +doClose4392,111902 +doEcho4423,112493 +putStdoutB4636,118017 +newline4679,118999 +space4683,119041 +outNumE4688,119105 +outWordA4695,119233 +prExtNmX4707,119471 +outOctA4715,119665 +outAoA4728,119933 +outStringS4740,120181 +outStringC4742,120251 +outNameE4752,120390 +prNameX4760,120507 +printE_E4770,120662 +printE4779,120798 +prinE_E4992,126414 +prinE5001,126550 +doPrin5056,127812 +doPrinl5070,128082 +doSpace5074,128150 +doPrint5096,128549 +doPrintsp5112,128844 +doPrintln5127,129133 +doFlush5132,129221 +doRewind5140,129358 +doExt5157,129748 +doRd5174,130087 +doPr5240,131867 +doWr5257,132199 ./apply.l,445 applyXYZ_E4,51