diff options
-rw-r--r-- | ChangeLog | 308 | ||||
-rw-r--r-- | Doc/Zsh/mod_zle.yo | 28 | ||||
-rw-r--r-- | Src/Modules/zftp.c | 20 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 4 | ||||
-rw-r--r-- | Src/Zle/zle_main.c | 19 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 16 | ||||
-rw-r--r-- | Src/builtin.c | 12 | ||||
-rw-r--r-- | Src/exec.c | 22 | ||||
-rw-r--r-- | Src/init.c | 3 | ||||
-rw-r--r-- | Src/input.c | 4 | ||||
-rw-r--r-- | Src/jobs.c | 14 | ||||
-rw-r--r-- | Src/signals.c | 72 | ||||
-rw-r--r-- | Src/signals.h | 35 | ||||
-rw-r--r-- | Src/utils.c | 30 | ||||
-rw-r--r-- | Src/zsh.h | 2 |
15 files changed, 387 insertions, 202 deletions
diff --git a/ChangeLog b/ChangeLog index e88efb90f..4494e7f64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-11-11 Peter Stephenson <pws@pwstephenson.fsnet.co.uk> + + * 13109, 13111: Doc/Zsh/mod_zle.yo, Src/Zle/zle_main.c, + Src/Zle/zle_thingy.c, Src/signals.c: `zle -I' allows trap code + to clear up display when output occurs in a trap. + + * Sven: 13108: Src/Modules/zftp.c, Src/Modules/zpty.c, + Src/Zle/zle_main.c, Src/builtin.c, Src/exec.c, Src/init.c, + Src/input.c, Src/jobs.c, Src/signals.c, Src/signals.h, + Src/utils.c, Src/zsh.h: Execute user traps synchronously if it is + unsafe to execute it directly from the signal handler. + 2000-11-09 Clint Adams <schizo@debian.org> * 13125: Completion/User/_mailboxes: evaluate the mailboxes @@ -7,14 +19,14 @@ * unposted: Src/Modules/zpty.c: use possible read character from read_poll() in loop in ptyread() - + * 13128: Completion/Builtins/_zstyle, Completion/Core/_match, Completion/Core/_path_files, Doc/Zsh/compsys.yo: aloow value `pattern' for insert-unambiguous style to preserve patterns in the original string; add list-suffixes style to make file completion list path suffixes if possible; slightly improved completion of pathnames with multiple pattern-components - + 2000-11-06 Bart Schaefer <schaefer@zsh.org> * 13127: Completion/User/_rcs: Test of $compstate[nmatches] was a @@ -24,7 +36,7 @@ * 13124: Functions/Misc/nslookup: Use "command nslookup" as it's now possible to call the nslookup function recursively from zpty. - + * unposted: Src/Modules/zpty.c: Cloned shell is non-interactive for purposes of calling zexit(), so it doesn't print job status, save history, etc. @@ -54,41 +66,41 @@ * users/3503: Doc/Zsh/mod_parameter.yo, Src/jobs.c, Src/Modules/parameter.c: show current/previous job in $jobstates - + 2000-11-01 Sven Wischnowsky <wischnow@zsh.org> * 13107: Functions/Misc/zed: don't reset just-edited trap function to old value - + 2000-10-30 Sven Wischnowsky <wischnow@zsh.org> * 13095: Src/Modules/parameter.c: make assignament to $nameddirs behave like hash -d - + 2000-10-25 Sven Wischnowsky <wischnow@zsh.org> * users/3472: Completion/User/_rcs: use return value of _files, don't use ${PRE,SUF}FIX for globbing, complete all files as a default for "co" - + * 13084: Src/Zle/complist.c: re-display list for cleanup only if we were in menu selection - + * 13082: Src/Zle/complist.c, Src/Zle/compresult.c: add a counter for invalidatelist() to allow finding out if there is a new list - + 2000-10-24 Sven Wischnowsky <wischnow@zsh.org> * 13071: Src/Zle/complist.c, Src/Zle/compresult.c: avoid printing file type characters in completion lists for matches ending in a slash - + 2000-10-23 Sven Wischnowsky <wischnow@zsh.org> * 13037: Completion/Core/_path_files, Doc/Zsh/compsys.yo: change some tags used in filename completion: no tag for file-sort, fake-files and ignore-parents, paths for accept-exact - + 2000-10-21 Bart Schaefer <schaefer@zsh.org> * 13057: Src/Zle/zle_main.c: `vared -h' should not imply `vared -e'; @@ -111,11 +123,11 @@ Completion/Commands/_next_tags, Completion/Core/_main_complete, Completion/Core/compinit: simplify setting standard completion system options using $_comp_options - + * 13035: Doc/Zsh/mod_zpty.yo, Functions/Misc/nslookup, Src/utils.c, Src/Modules/zpty.c, Test/comptest: make non-blocking IO on ptys work again; add -t option to test if command is still alive - + 2000-10-19 Wayne Davison <wayned@users.sourceforge.net> * 13034: Src/hist.c: Don't call histreduceblanks() if the line @@ -129,7 +141,7 @@ * 13005: Src/Zle/computil.c: make _arguments ignore unspecified non-option arguments to the right of the cursor - + 2000-10-17 Peter Stephenson <pws@csr.com> * Config/version.mk, Functions/Zle/.distfiles, @@ -137,11 +149,11 @@ * Functions/Misc/zmv: in verbose mode, report if something was skipped because it didn't change. - + 2000-10-16 Sven Wischnowsky <wischnow@zsh.org> * 13003: Test/54compmatch.ztst: add tests for the stuff in 12995 - + 2000-10-13 Bart Schaefer <schaefer@zsh.org> * 13000: Doc/Zsh/jobs.yo: Document tty restoration when a stopped @@ -153,7 +165,7 @@ * 12995: Src/Zle/compmatch.c: two completion matching fixes; wrong (path) prefix matching (removed path components) and reverse order of sub-strings in match-strings - + 2000-10-12 Sven Wischnowsky <wischnow@zsh.org> * 12974: Completion/Core/_tags, Completion/Core/_sort_tags, @@ -163,7 +175,7 @@ * 12954, 12973: Completion/Builtins/_zstyle, Completion/Core/_path_files, Doc/Zsh/compsys.yo: rename fake style to fake-files - + 2000-10-11 Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru> * 12958: Cosmo <cosmo@informix.com>: aczsh.m4: fix for NCR compiler @@ -177,39 +189,39 @@ Src/Zle/compresult.c:add _all_matcher completer and supporting C-code for adding a special match representing all other matches; remove completions style from _expand(|_word) - + * 12959: Src/Zle/compcore.c, Src/Zle/complist.c: make user defined completion widgets leave menu selection without accepting the currently selected match - + 2000-10-10 Sven Wischnowsky <wischnow@zsh.org> * 12948: Completion/Core/_expand: follow-up to 12942, only a missing redirection - + * 12946: Completion/Base/_math, Completion/Base/_subscript, Completion/Builtins/_vars, Completion/Builtins/_zstyle, Completion/Core/_parameters, Doc/Zsh/compsys.yo: add fake-parameters style to allow completing parameters which are not yet set - + * 12942,12945: Completion/Core/_expand: temporarily remove global aliases to avoid error message inside the evals - + * 12941: Src/Zle/compmatch.c: follow-up to 12930, make it first try exact character matches, but enable it to go back to try match specs if it fails after accepting such character matches - + 2000-10-09 Sven Wischnowsky <wischnow@zsh.org> * 12930: Src/Zle/compmatch.c: prefer exact character matches over match specs (so that `nom' can match `nomatch' in _options) - + 2000-10-06 Sven Wischnowsky <wischnow@zsh.org> * 12919: Completion/User/_tiff, Completion/X/_xv: search for *.tif files, too - + * 12917: Completion/Bsd/_bsd_pkg, Completion/Bsd/_kld, Completion/Builtins/_autoload, Completion/Builtins/_cd, Completion/Builtins/_compdef, Completion/Builtins/_popd, @@ -219,7 +231,7 @@ Completion/User/_perl_modules, Completion/User/_printers, Completion/User/_zdump: more option setting cleanup; remove some unnecessary setopts, remove N qualifiers - + 2000-10-05 Bart Schaefer <schaefer@zsh.org> * 12912: Completion/Commands/_bash_completions, @@ -234,24 +246,24 @@ 2000-10-05 Sven Wischnowsky <wischnow@zsh.org> * 12901: Doc/Zsh/compwid.yo, Doc/Zsh/manual.yo: cleanup for 12896 - + * 12899: Completion/Core/_main_complete: unset cshnullglob - + * 12898: Src/parse.c: don't return invalid Eprog after parse error - + * 12897: Src/Zle/computil.c: comparguments: don't use rest-argument-specification if it was inactivated - + * 12896: Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo, Doc/Zsh/compsys.yo, Doc/Zsh/compwid.yo, Doc/Zsh/expn.yo, Doc/Zsh/func.yo, Doc/Zsh/mod_complist.yo: cleanup - + * 12892: Completion/Core/_files, Completion/Core/_path_files, Doc/Zsh/compsys.yo, Doc/Zsh/expn.yo: complete after automounted directories (a rather ugly hack); remove old code in _files (comma separated patterns); improve docs for fake style and for comma separated qualifier lists - + 2000-10-04 Tanaka Akira <akr@zsh.org> * 12886: Completion/User/_cvs: make _cvs_vendor_branches to handle @@ -261,10 +273,10 @@ * 12885: Src/Zle/zle_tricky.c: don't stop parsing too early when completing inside a command substitution - + * 12884: Src/Zle/compcore.c: don't forget a displayed list when starting menu completion - + 2000-10-04 Tanaka Akira <akr@zsh.org> * 12872: Completion/User/_cvs: Fix modules completion when a cvsroot @@ -418,12 +430,12 @@ 2000-09-07 Sven Wischnowsky <wischnow@zsh.org> * 12769: Completion/Builtins/_cd: more sensible value - + * 12768: as suggested by Andrej (12767): Completion/Bsd/_bsd_pkg, Completion/Bsd/_kld, Completion/User/_gcc, Completion/User/_gdb, Completion/User/_mailboxes, Completion/User/_zdump: stick some `N's into glob patterns - + 2000-09-06 Bart Schaefer <schaefer@zsh.org> * 12765,12766: Doc/Zsh/builtins.yo, Doc/Zsh/contrib.yo: Eliminate @@ -453,7 +465,7 @@ * 12744: Doc/Zsh/contrib.yo, Doc/Zsh/mod_complist.yo, Functions/Zle/incremental-complete-word: change context for i-c-w styles, update docs - + 2000-09-04 Bart Schaefer <schaefer@zsh.org> * 12742: Doc/.distfiles, Doc/Makefile.in, Doc/Zsh/.distfiles, @@ -534,7 +546,7 @@ * 12717: Src/Zle/zle_tricky.c: fix for unbalanced calls to {push,pop}heap in docomplete()/get_comp_string() - + 2000-08-28 Bart Schaefer <schaefer@zsh.org> * 12716: Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo, @@ -546,7 +558,7 @@ 2000-08-28 Sven Wischnowsky <wischnow@zsh.org> * 12710: Src/exec.c: fix for `function' without names - + 2000-08-27 Oliver Kiddle <opk@zsh.org> * 12708: Completion/AIX/_logical_volumes: new AIX completion function @@ -556,11 +568,11 @@ * 12692: Alexandre: 12691; 12692: Completion/User/_gv, Completion/User/_pdf, Completion/User/_ps, Completion/User/_pspdf: complete compressed files for gv; improve results from _pspdf - + 2000-08-21 Sven Wischnowsky <wischnow@zsh.org> * 12682: Completion/Builtins/_zmodload: use return value - + 2000-08-18 Oliver Kiddle <opk@zsh.org> * 12677: Completion/Builtins/_zmodload: use _arguments in _zmodload @@ -579,7 +591,7 @@ * 12654: Doc/Zsh/mod_parameter.yo, Src/Modules/parameter.c: make $modules report aliases correctly - + * unposted: Completion/Builtins/_pids: remove unnecessary local parameter 2000-08-15 Peter Stephenson <pws@csr.com> @@ -597,15 +609,15 @@ * 12640: Completion/Builtins/_pids, Completion/Builtins/_zstyle, Doc/Zsh/compsys.yo: call ps only once and be more intelligent when finding the PIDs - + * 12635: Completion/Builtins/_pids: small improvement to allow lists where the pid is not in the first column - + 2000-08-14 Bart Schaefer <schaefer@zsh.org> * Andrej: 12623: configure.in, Src/mkmakemod.sh, Src/zsh.h: Fix dynamic linking on cygwin, again. - + * 12621: Src/Zle/zle_main.c: Use ztrdup() on a string that will later be freed; this appears to have been a bug ever since 9839. @@ -624,10 +636,10 @@ 2000-08-14 Sven Wischnowsky <wischnow@zsh.org> * Andrej: 12613: Src/lex.c: missing mod_export - + * 12610: Src/Zle/computil.c: make all builtins in computil test if they were called from a completion function - + 2000-08-13 Bart Schaefer <schaefer@zsh.org> * 12604: Src/compat.c, Src/system.h, Src/Modules/files.c, @@ -653,7 +665,7 @@ * 12592: Completion/Core/_parameters, Src/Zle/compcore.c, Src/Zle/zle_tricky.c: fixes for completion in math contexts: don't quote spaces and do normal parameter expansion completion after `$' - + 2000-08-11 Peter Stephenson <pws@csr.com> * Config/version.mk: 3.1.9-dev-5. @@ -695,11 +707,11 @@ * 12567: Completion/Linux/_rpm, Src/Zle/computil.c: handle the right option in strings with multiple single-letter options (and correctly handle its argument) - + * 12565: Completion/Core/_expand, Completion/Core/_path_files, Doc/Zsh/mod_computil.yo, Src/Zle/computil.c: more fixes for completion of special characters (quoting) - + 2000-08-08 Peter Stephenson <pws@csr.com> * unposted: Src/xmods.conf, Src/Aliases/*: Remove Src/Aliases @@ -740,7 +752,7 @@ * 12525: Src/module.c: remove (wrong) test for linked-in modules in require_module() - + 2000-08-04 Bart Schaefer <schaefer@zsh.org> * 12516: Src/compat.c, Src/system.h, Src/Modules/files.c, @@ -765,16 +777,16 @@ Completion/Core/compdump, Src/glob.c, Src/Modules/parameter.c: try to get quoting of special character (`>' and `\') right; fix for pathmax in parameter.c - + * 12497: Doc/Zsh/builtins.yo: small fix for `read -r' doc - + * 12496: Completion/Core/_path_files: one more problem with quoting of glob characters in filename completion - + * 12494: Doc/Zsh/options.yo, Src/Zle/zle_main.c: make binding of ^D be used in first column if ignoreeof is set and ^D is bound to a shell function widget - + 2000-08-02 Peter Stephenson <pws@csr.com> * Andrej: 12487: configure.in, Etc/MACHINES, Src/Makefile.in, @@ -803,29 +815,29 @@ * 12483: Completion/Base/_arguments, Completion/Core/_complete, Doc/Zsh/compsys.yo: if compcontext is an assoc, the keys are the completions and the values are their descriptions - + * 12475: Completion/Base/_arguments: prefer user-defined specs over ones derived from --help output - + 2000-08-01 Sven Wischnowsky <wischnow@zsh.org> * Jan Fedak: 12463: Completion/User/_slrn: new completion function for slrn - + * 12462: Completion/Base/_arguments: fix for automatically recognised options, don't expect an argument after each of them - + * 12453: Completion/Bsd/_bsd_pkg, Completion/Bsd/_kld, Completion/Commands/_next_tags, Completion/User/_cvs, Completion/User/_mailboxes, Completion/X/_xset, Completion/X/_xwit, Src/exec.c: remove tests for kshautoload (use zcompile -z); fix for setting scriptname for functions that redefine themselves - + * 12449: Completion/Base/_arguments, Completion/Base/_values, Completion/Core/_complete, Doc/Zsh/compsys.yo: make $compcontext more powerful and easier to use for simple cases - + 2000-07-31 Peter Stephenson <pws@csr.com> * Config/version.mk: 3.1.9-dev-4. @@ -836,11 +848,11 @@ * 12439: Src/hist.c: isalpha() -> ialpha(); avoid a compiler warning - + * 12438: Doc/Zsh/compsys.yo: clarify manual for menu style; select= and yes= may be given both a number and one of the long* values at the same time - + 2000-07-30 Andrew Main <zefram@zsh.org> * 12436: Doc/Zsh/invoke.yo, Src/init.c: Make -b behave like @@ -889,11 +901,11 @@ * 12408: Test/55arguments.ztst: fix completion test (55*) because of 12394 - + * 12405: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: fix a bug that started menu selection too often; fix bug for `yes=long' and documentit - + 2000-07-27 Bart Schaefer <schaefer@zsh.org> * 12396: Functions/Misc/zed: The value of `$(functions $1)' for @@ -903,11 +915,11 @@ * 12400: Src/Zle/computil.c: compdescribe shouldn't use the sets after failed initialisation - + * 12394: Completion/Core/_main_complete: don't hide possible completions if there is only one and at the same time messages are shown - + 2000-07-26 Adam Spiers <adam@spiers.net> * unposted: Completion/User/_perl: -e, -I, -m and -M parameters @@ -928,21 +940,21 @@ * 12370: Functions/Misc/zed: Add a context for controlling completion within zed, and a style to enable tab insertion at the beginnings of lines in zed by default. - + * 12162: Completion/Core/_expand, Completion/Core/_path_files, Src/utils.c: Use `eval' instead of `$(print ...)' to suppress some syntax error failures; this requires that zwarn() does not trashzle() when the output is not going to the terminal. - + 2000-07-26 Sven Wischnowsky <wischnow@zsh.org> * 12378: Completion/Base/_arguments: make `_arguments --' use specs after the `--' even for options not described in the help output to get arguments - + * users/3337: Completion/Base/_value: allow _value:<assoc> functions to override completion for all keys of an assoc - + 2000-07-24 Oliver Kiddle <opk@zsh.org> * 12356: Completion/User/_mh: use mhpath and mhparam instead of @@ -952,7 +964,7 @@ * 12354: Completion/Core/_multi_parts: optimisations for _multi_parts - + 2000-07-22 Clint Adams <schizo@debian.org> * 12347: Completion/User/_mutt: options -a, -b, and -c are @@ -961,7 +973,7 @@ 2000-07-21 Sven Wischnowsky <wischnow@zsh.org> * 12337: Src/parse.c: fix parsing of `time' without a command - + 2000-07-20 Wayne Davison <wayned@users.sourceforge.net> * unposted: tweaked a function name in hist.c for Sven. @@ -997,7 +1009,7 @@ 2000-07-19 Sven Wischnowsky <wischnow@zsh.org> * 12314: Src/Zle/compmatch.c: a bit of security for a VARARR() - + 2000-07-19 Peter Stephenson <pws@cambridgesiliconradio.com> * 12313: Doc/Zsh/metafaq.yo: bad phrasing corrected. @@ -1011,7 +1023,7 @@ * 12297: Src/Zle/compcore.c: don't let duplicate matches keep us from recognising exact matches if they produce the same string on the line - + 2000-07-18 Wayne Davison <wayned@users.sourceforge.net> * 12295: Src/builtin.c, Src/hist.c, Src/input.c, Src/lex.c: Fixed @@ -1032,7 +1044,7 @@ * 12266: Src/Zle/computil.c: don't treat non-option arguments as options - + 2000-07-17 Wayne Davison <wayned@users.sourceforge.net> * 12265: Src/hist.c: Fixed gethistent(). Fixed a race condition @@ -1053,7 +1065,7 @@ escapes count from the other end of the appropriate string. 2000-07-13 Sven Wischnowsky <wischnow@zsh.org> - + * 12243: Src/hist.c: try to get (z) parameter flag parsing for conditions right @@ -1062,13 +1074,13 @@ option-strings with multiple options; in _main_complete stop trying completers when one called _message, don't display warnings in such cases - + * 12238: Src/Zle/zle_thingy.c: fix zle widget -n num with num>9 - + * 12237: Src/hist.c, Src/lex.c: slightly improved (z) flag for parsing conditions; recognising glob flags in conditions still doesn't work - + 2000-07-12 Peter Stephenson <pws@cambridgesiliconradio.com> * 12231: Completion/Core/compinstall: fix setting of list-prompt. @@ -1076,10 +1088,10 @@ 2000-07-12 Sven Wischnowsky <wischnow@zsh.org> * 12229: Doc/Zsh/compsys.yo: fix for list-prompt docs - + * 12228: Src/hist.c, Src/lex.c: fix for (z) flag, don't take # as comment - + 2000-07-12 Peter Stephenson <pws@cambridgesiliconradio.com> * 12227: Completion/Core/compinstall: add select-prompt handling @@ -1089,9 +1101,9 @@ * 12226: Completion/Core/_main_complete: don't start menu selection with only select=long - + * 12225: Completion/Linux/_rpm: check if options were completed - + 2000-07-11 Peter Stephenson <pws@cambridgesiliconradio.com> * 12222: Src/exec.c: ignore EINTR in helper processe for @@ -1112,7 +1124,7 @@ * 12208: Completion/Core/_path_files: avoid insertion of `+' before ~1/<TAB>; don't use undeclared local $tmp - + 2000-07-08 Tanaka Akira <akr@zsh.org> * 12201: Completion/User/_java: fix completion for jar. complete @@ -1139,7 +1151,7 @@ 2000-07-05 Sven Wischnowsky <wischnow@zsh.org> * 12171: Completion/User/_arp: get return status right - + 2000-07-05 Bart Schaefer <schaefer@zsh.org> * 12167: Test/Makefile.in: Ignore failure exit from "for" loop @@ -1172,7 +1184,7 @@ * 12149: acconfig.h, configure.in, Src/Modules/zftp.c: h_errno wasn't found on HPUX 10.20. Maybe in some library. - + 2000-07-03 Adam Spiers <adam@spiers.net> * 12152: Completion/User/_perl: tweak completion of Perl script @@ -1200,7 +1212,7 @@ * Config/version.mk: 3.1.9-dev-2. * 12138: Src/params.c, Test/06arith.ztst: setting of array - elements in math context didn't work (ever). + elements in math context didn't work (ever). * 12121: Src/utils.c, Doc/Zsh/options.yo: save and restore stopmsg for precmd, fix #ifdef's for variable declaration in read_poll(). @@ -1212,7 +1224,7 @@ Src/Zle/complist.c: change format style with warnings tag, don't add descriptions as matches; make a-a-i-n-h in menu selection work even without matches - + 2000-07-02 Bart Schaefer <schaefer@zsh.org> * 12133: Completion/Core/_expand, Completion/Core/_path_files: @@ -1224,27 +1236,27 @@ * 12125: Src/parse.c, Test/09funcdef.ztst: fix for `foo () print bar' (function definitions without braces) - + * 12122: Completion/Core/_main_complete: reverse meaning of yes=num again * 12119: Completion/Core/_complete, Completion/Core/_normal: try to return the right value - + * 12118: Completion/Core/_expand: don't expand partially typed parameter expansions - + * 12115: Completion/Core/_expand, Doc/Zsh/compsys.yo: change suffix style to still do expansion if the suffix contains something to expand - + * 12114: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: even more fun with the menu style (no=num, yes=long-list, reverse meaning of yes=num) - + * 12113: Completion/Core/_expand, Src/Zle/zle_tricky.c: quote brace-strings - + 2000-06-28 Bart Schaefer <schaefer@zsh.org> * 12112: Src/params.c: Don't make namedirs out of hash elements. @@ -1253,13 +1265,13 @@ * 12109: Completion/Core/_complete: make _complete return the right value - + * 12107: Completion/Core/_setup, Src/Zle/complist.c: fix for list-colors handling - + * 12105: Completion/Core/_main_complete: reset _comp_mesg (saying whether there were messages) appropriately - + * Jan Fedak: 12097: Completion/User/_ssh: use _ports when completing remote ports @@ -1267,11 +1279,11 @@ * 12099: Completion/Core/_oldlist: make _oldlist not use the dummy match added for the warning - + * 12093: Src/Zle/compcore.c, Src/Zle/complist.c, Src/Zle/compresult.c: make a-a-i-n-h in menu selection work with one match; better undo behaviour for menu selection - + 2000-06-27 Bart Schaefer <schaefer@zsh.org> * 12086: Doc/Zsh/compsys.yo: Move _use_lo doc into alphabetical @@ -1282,11 +1294,11 @@ * users/3219: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: menu style accepts yes=x to start menu completion if there are at least x matches - + * Andrej: 12084: Src/Modules/zpty.c: don't close slave if not yet open * 12082: Doc/Zsh/compsys.yo: document _use_lo - + 2000-06-27 Peter Stephenson <pws@cambridgesiliconradio.com> * Andrej: 12081: Src/Modules/zpty.c: compiles under Cygwin, but @@ -1318,19 +1330,19 @@ * users/3208: Completion/User/_use_lo: default completion even if there are options - + * 12070: Completion/Core/_ignored: fix for completer lookup in _ignored - + * 12068: Doc/Zsh/mod_computil.yo, Src/Zle/computil.c: remove compfmt; a bit of explanation for compfiles and compgroups - + * 12067: Completion/Core/_history, Src/Zle/zle_tricky.c: typo in _history; missing free()s in zle_tricky.c - + * 12066: Src/Zle/computil.c: missing allocation of list for option arguments - + 2000-06-25 Bart Schaefer <schaefer@zsh.org> * 12063: Doc/Zsh/builtins.yo, Doc/Zsh/compwid.yo, @@ -1347,7 +1359,7 @@ * 12041,12043 : Completion/Core/compinit: even more compinit stuff, change prompt, search for insecure parent dirs - + 2000-06-22 Peter Stephenson <pws@pwstephenson.fsnet.co.uk> * 12040: Src/builtin.c: typeset -r on existing parameter set @@ -1364,7 +1376,7 @@ * 12033: Completion/Core/compinit: followup to compinit-security patch - + * 12029: Completion/Builtins/_arrays, Completion/Builtins/_zstyle, Completion/Commands/_bash_completions, Completion/Commands/_history_complete_word, @@ -1376,7 +1388,7 @@ Src/Zle/complist.c, Src/Zle/computil.c: allow subscripts for compadd -[ak]; new style for history completion; better list-colors handling - + 2000-06-22 Clint Adams <schizo@debian.org> * 12027: Completion/User/_mailboxes: fix splitting problem in @@ -1396,7 +1408,7 @@ * 12011: Completion/Commands/_history_complete_word, Completion/Core/_expand, Completion/Core/_history: make history completion use I{PREF,SUF}FIX - + 2000-06-20 Oliver Kiddle <opk@zsh.org> * unposted: Src/exec.c: AIX dependency fix @@ -1412,33 +1424,33 @@ Completion/Core/compinit, Doc/Zsh/compsys.yo: a bit of security for compinit (avoid using things writable by others); avoid handling files with the same name twice; remove compconf - + 2000-06-19 Sven Wischnowsky <wischnow@zsh.org> * 11992: Src/Zle/complist.c: make undo break out of menu selection if nothing to undo inside it - + * 11985: Completion/Debian/_dpkg, Doc/Zsh/compsys.yo, Src/Zle/computil.c: _arguments: small fix for -s and new `!...' for things not to complete (but to understand) - + * 11982: Test/comptest: update comptest to not set ZLS_COLORS directly - + * 11981: Src/Zle/computil.c: more careful when optimising patterns in compfiles - + * 11977: Completion/Core/_options, Completion/Core/_set_options, Completion/Core/_unset_options, Doc/Zsh/compwid.yo, Src/Zle/comp.h, Src/Zle/complete.c, Src/Zle/compmatch.c, Test/54compmatch.ztst: new match spec characters bBeE, match only word/line not both - + * 11973: Completion/Builtins/_zstyle, Completion/Core/_description, Completion/Core/_expand, Doc/Zsh/compsys.yo, Src/Zle/zle_tricky.c: allow _expand to expand braces; better detection of braces to complete instead of passing to shell code - + 2000-06-19 Peter Stephenson <pws@cambridgesiliconradio.com> * unpost: additions to Completion/Commands/.distfiles and @@ -1452,11 +1464,11 @@ * 11971: Completion/Core/_path_files, Doc/Zsh/compsys.yo, Src/Zle/compcore.c, Src/Zle/computil.c: improve filename completion; use accept-exact for in-path completion; new fake style - + * users/3188: Completion/Core/_description, Completion/Core/_setup, Doc/Zsh/compsys.yo: restore ZLS_COLORS when possible; better group-name handling in ZLS_COLORS - + 2000-06-17 Clint Adams <schizo@debian.org> * 11966: Completion/Core/_main_complete: use double brackets @@ -1491,15 +1503,15 @@ Src/Zle/zle_tricky.c: allow completion after `a{{b,c},'; fix for closing brace re-insertion when completing from both ends (CLF_MID) - + * 11938: Completion/Core/_description, Doc/Zsh/compsys.yo: enhance ignore-line to ignore all/current/other word(s) - + * 11937: Completion/Core/_expand, Completion/Core/_list, Doc/Zsh/compsys.yo, Doc/Zsh/mod_zutil.yo, Src/Modules/zutil.c: zstyle -e option; change math-styles to boolean ones; change defaults for _expand styles - + 2000-06-15 Peter Stephenson <pws@cambridgesiliconradio.com> * Felix: 11908: Test/54compmatch.ztst: tests for problematic @@ -1512,13 +1524,13 @@ 2000-06-15 Sven Wischnowsky <wischnow@zsh.org> * 11924: Src/Zle/compmatch.c: more security in completion matching - + * 11915: Completion/Core/_files, Doc/Zsh/compsys.yo: make _files try each pattern only once (and stop after `*') - + * 11910: Src/Zle/computil.c: fix for _arguments, it took non-option strings as options - + 2000-06-14 Peter Stephenson <pws@pwstephenson.fsnet.co.uk> * 11906: Src/signals.c: yet another two bugs with saving traps: @@ -1543,10 +1555,10 @@ 2000-06-14 Sven Wischnowsky <wischnow@zsh.org> * 11885: Src/parse.c: nix kaboom with `time time' - - * 11890: Src/Zle/complist.c: better fix for menu selection on dumb + + * 11890: Src/Zle/complist.c: better fix for menu selection on dumb terminal - + 2000-06-13 Clint Adams <schizo@debian.org> * 11882: Completion/Debian/_dpkg: more intelligence in @@ -1558,18 +1570,18 @@ pattern as argument to match non-arguments; allow single-letter option strings to have multiple arguments; fix to allow option completion with multiple sets - + * 11872 Completion/Commands/_generic, Doc/Zsh/compsys.yo: new _generic widget to call completion with $WIDGET in function field of context - - * 11873: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: allow + + * 11873: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: allow insert-tab style to contain `pending[=num]' to handle the case when there is pending input * 11874: Completion/Core/_expand, Doc/Zsh/compsys.yo: new style `suffix', use accept-exact style in _expand - + * 11875: Src/Zle/complist.c: fix for longer capability strings; very bad @@ -1626,11 +1638,11 @@ * 11836: Src/Zle/compcore.c, Src/Zle/complist.c: fix for menu-completion when another completion came right after it - + * 11833: Completion/Core/_path_files, Src/Zle/computil.c: improve _path_files, move some code into C, try to optimise glob patterns and immediately accept exact directory matches - + 2000-06-08 Oliver Kiddle <opk@zsh.org> * 11823: Doc/Makefile.in, Completion/User/_urls: avoid bug in @@ -1644,13 +1656,13 @@ 2000-06-08 Sven Wischnowsky <wischnow@zsh.org> * 11817: Src/Zle/compmatch.c: more anchor matching fixes - + * 11815: Completion/Core/_expand, Doc/Zsh/compsys.yo: trying to improve _expand; new keep-prefix style, add-space gives more control - + * 11814: Src/Zle/zle_tricky.c: make C-code expansion add a space only when more than one word was generated - + 2000-06-08 Tanaka Akira <akr@zsh.org> * users/3130: Completion/Debian/_apt: fix actions for _alternative. @@ -1659,7 +1671,7 @@ * 11796: Src/Zle/compmatch.c: try to get the tests for `strings long enough' right in anchor matching code - + 2000-06-07 Peter Stephenson <pws@cambridgesiliconradio.com> * 11711: Andrej Borsenkow: Test/ztst.zsh: Ignore diff output @@ -1670,33 +1682,33 @@ * user/3124: Completion/Core/_normal, Src/Zle/compctl.c: optimise command lookup in old and new completion - + * 11794: Src/Zle/compcore.c, Src/Zle/complist.c, Src/Zle/zle_tricky.c: hopefully more consistent beeping with menu-selection - + * 11792: Doc/Zsh/mod_zutil.yo, Src/Modules/zutil.c: -K option for zparseopts to keep previous array values - + * 11789: Completion/Commands/_correct_word, Completion/Commands/_expand_word, Completion/Commands/_next_tags: setup options in bindable commands - + 2000-06-06 Oliver Kiddle <opk@zsh.org> * 11772: Completion/User/_urls: improvements to 11756 suggested by - Bart in 11763 + Bart in 11763 2000-06-06 Sven Wischnowsky <wischnow@zsh.org> * 11777: Completion/Core/_expand: make _expand ignore empty expansions - + * 11776: Completion/Core/_path_files: fix for _path_files and globcomplete, better test if word contains wildcards - + * 11768: Doc/Zsh/expn.yo, Src/lex.c, Src/subst.c: make (e) flag be silent unless (X) is given, too - + 2000-06-05 Oliver Kiddle <opk@zsh.org> * 11756: Completion/User/_urls, Completion/Linux/_rpm: accept -g diff --git a/Doc/Zsh/mod_zle.yo b/Doc/Zsh/mod_zle.yo index dd658a858..cc6080b3d 100644 --- a/Doc/Zsh/mod_zle.yo +++ b/Doc/Zsh/mod_zle.yo @@ -198,6 +198,7 @@ xitem(tt(zle) tt(-C) var(widget) var(completion-widget) var(function)) xitem(tt(zle) tt(-R) [ tt(-c) ] [ var(display-string) ] [ var(string) ... ]) xitem(tt(zle) tt(-M) var(string)) xitem(tt(zle) tt(-U) var(string)) +xitem(tt(zle) tt(-I)) xitem(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...) item(tt(zle))( The tt(zle) builtin performs a number of different actions concerning @@ -263,6 +264,11 @@ cleared. Note that this option is only useful for widgets that do not exit immediately after using it because the strings displayed will be erased immediately after return from the widget. + +This command can safely be called outside user defined widgets; if zle is +active, the display will be refreshed, while if zle is not active, the +command has no effect. In this case there will usually be no other +arguments. The status is zero if zle was active, else one. ) item(tt(-M) var(string))( As with the tt(-R) option, the var(string) will be displayed below the @@ -281,6 +287,28 @@ the last string pushed onto the stack will be processed first. However, the characters in each var(string) will be processed in the order in which they appear in the string. ) +item(tt(-I))( +Unusually, this option is only useful em(outside) ordinary widget functions. +It invalidates the current zle display in preparation for output; usually +this will be from a trap function. It has no effect if zle is not +active. When a trap exits, the shell checks to see if the display needs +restoring, hence the following will print output in such a way as not to +disturb the line being edited: + +example(TRAPUSR1() { + # Invalidate zle display + zle -I + # Show output + print Hello +}) + +Note that there are better ways of manipulating the display from within zle +widgets. In general, the trap function may need to test whether zle is +loaded before using this method; if it is not, there is no point in loading +it specially since the line editor will not be active. + +The status is zero if zle was active, else one. +) item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)( Invoke the specified widget. This can only be done when ZLE is active; normally this will be within a user-defined widget. diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c index e39994733..ef37dbdc7 100644 --- a/Src/Modules/zftp.c +++ b/Src/Modules/zftp.c @@ -801,7 +801,7 @@ zfgetline(char *ln, int lnsize, int tmout) cmdbuf[0] = (char)IAC; cmdbuf[1] = (char)DONT; cmdbuf[2] = ch; - write(zfsess->cfd, cmdbuf, 3); + ztrapwrite(zfsess->cfd, cmdbuf, 3); continue; case DO: @@ -811,7 +811,7 @@ zfgetline(char *ln, int lnsize, int tmout) cmdbuf[0] = (char)IAC; cmdbuf[1] = (char)WONT; cmdbuf[2] = ch; - write(zfsess->cfd, cmdbuf, 3); + ztrapwrite(zfsess->cfd, cmdbuf, 3); continue; case EOF: @@ -996,7 +996,7 @@ zfsendcmd(char *cmd) return 6; } zfalarm(tmout); - ret = write(zfsess->cfd, cmd, strlen(cmd)); + ret = ztrapwrite(zfsess->cfd, cmd, strlen(cmd)); alarm(0); if (ret <= 0) { @@ -1470,7 +1470,7 @@ zfread(int fd, char *bf, off_t sz, int tmout) int ret; if (!tmout) - return read(fd, bf, sz); + return ztrapread(fd, bf, sz); if (setjmp(zfalrmbuf)) { alarm(0); @@ -1479,7 +1479,7 @@ zfread(int fd, char *bf, off_t sz, int tmout) } zfalarm(tmout); - ret = read(fd, bf, sz); + ret = ztrapread(fd, bf, sz); /* we don't bother turning off the whole alarm mechanism here */ alarm(0); @@ -1495,7 +1495,7 @@ zfwrite(int fd, char *bf, off_t sz, int tmout) int ret; if (!tmout) - return write(fd, bf, sz); + return ztrapwrite(fd, bf, sz); if (setjmp(zfalrmbuf)) { alarm(0); @@ -1504,7 +1504,7 @@ zfwrite(int fd, char *bf, off_t sz, int tmout) } zfalarm(tmout); - ret = write(fd, bf, sz); + ret = ztrapwrite(fd, bf, sz); /* we don't bother turning off the whole alarm mechanism here */ alarm(0); @@ -2846,7 +2846,7 @@ zfclose(int leaveparams) if (!zfnopen) { /* Write the final status in case this is a subshell */ lseek(zfstatfd, zfsessno*sizeof(int), 0); - write(zfstatfd, zfstatusp+zfsessno, sizeof(int)); + ztrapwrite(zfstatfd, zfstatusp+zfsessno, sizeof(int)); close(zfstatfd); zfstatfd = -1; @@ -3123,7 +3123,7 @@ bin_zftp(char *name, char **args, char *ops, int func) /* Get the status in case it was set by a forked process */ int oldstatus = zfstatusp[zfsessno]; lseek(zfstatfd, 0, 0); - read(zfstatfd, zfstatusp, sizeof(int)*zfsesscnt); + ztrapread(zfstatfd, zfstatusp, sizeof(int)*zfsesscnt); if (zfsess->cfd != -1 && (zfstatusp[zfsessno] & ZFST_CLOS)) { /* got closed in subshell without us knowing */ zcfinish = 2; @@ -3212,7 +3212,7 @@ bin_zftp(char *name, char **args, char *ops, int func) * but only for the active session. */ lseek(zfstatfd, zfsessno*sizeof(int), 0); - write(zfstatfd, zfstatusp+zfsessno, sizeof(int)); + ztrapwrite(zfstatfd, zfstatusp+zfsessno, sizeof(int)); } return ret; } diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index d25c3a865..e76411a8b 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -536,7 +536,7 @@ ptywritestr(Ptycmd cmd, char *s, int len) for (; !errflag && !breaks && !retflag && !contflag && len; len -= written, s += written) { - if ((written = write(cmd->fd, s, len)) < 0 && cmd->nblock && + if ((written = ztrapwrite(cmd->fd, s, len)) < 0 && cmd->nblock && #ifdef EWOULDBLOCK errno == EWOULDBLOCK #else @@ -578,7 +578,7 @@ ptywrite(Ptycmd cmd, char **args, int nonl) int n; char buf[BUFSIZ]; - while ((n = read(0, buf, BUFSIZ)) > 0) + while ((n = ztrapread(0, buf, BUFSIZ)) > 0) if (ptywritestr(cmd, buf, n)) return 1; } diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index b2d075f91..b2a662072 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -313,11 +313,17 @@ static int breakread(int fd, char *buf, int n) { fd_set f; + int ret; FD_ZERO(&f); FD_SET(fd, &f); - return (select(fd + 1, (SELECT_ARG_2_T) & f, NULL, NULL, NULL) == -1 ? - EOF : read(fd, buf, n)); + + ALLOWTRAPS { + ret = (select(fd + 1, (SELECT_ARG_2_T) & f, NULL, NULL, NULL) == -1 ? + EOF : read(fd, buf, n)); + } DISALLOWTRAPS; + + return ret; } # define read breakread @@ -388,7 +394,7 @@ getkey(int keytmout) # else ioctl(SHTTY, TCSETA, &ti.tio); # endif - r = read(SHTTY, &cc, 1); + r = ztrapread(SHTTY, &cc, 1); # ifdef HAVE_TERMIOS_H tcsetattr(SHTTY, TCSANOW, &shttyinfo.tio); # else @@ -398,7 +404,10 @@ getkey(int keytmout) # endif #endif } - while ((r = read(SHTTY, &cc, 1)) != 1) { + for (;;) { + r = ztrapread(SHTTY, &cc, 1); + if (r == 1) + break; if (r == 0) { /* The test for IGNOREEOF was added to make zsh ignore ^Ds that were typed while commands are running. Unfortuantely @@ -1083,7 +1092,7 @@ zleaftertrap(Hookdef dummy, void *dat) static struct builtin bintab[] = { BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaMldDANmrsLR", NULL), BUILTIN("vared", 0, bin_vared, 1, 7, 0, NULL, NULL), - BUILTIN("zle", 0, bin_zle, 0, -1, 0, "lDANCLmMgGcRaU", NULL), + BUILTIN("zle", 0, bin_zle, 0, -1, 0, "lDANCLmMgGcRaUI", NULL), }; /* The order of the entries in this table has to match the *HOOK diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 7e81e2f88..f5acb73b4 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -339,6 +339,7 @@ bin_zle(char *name, char **args, char *ops, int func) { 'R', bin_zle_refresh, 0, -1 }, { 'M', bin_zle_mesg, 1, 1 }, { 'U', bin_zle_unget, 1, 1 }, + { 'I', bin_zle_invalidate, 0, 0 }, { 0, bin_zle_call, 0, -1 }, }; struct opn const *op, *opp; @@ -396,10 +397,8 @@ bin_zle_refresh(char *name, char **args, char *ops, char func) char *s = statusline; int sl = statusll, ocl = clearlist; - if (!zleactive) { - zwarnnam(name, "can only be called from widget function", NULL, 0); + if (!zleactive) return 1; - } statusline = NULL; statusll = 0; if (*args) { @@ -656,6 +655,17 @@ bin_zle_call(char *name, char **args, char *ops, char func) return ret; } +/**/ +static int +bin_zle_invalidate(char *name, char **args, char *ops, char func) +{ + if (zleactive) { + trashzle(); + return 0; + } else + return 1; +} + /*******************/ /* initialiasation */ /*******************/ diff --git a/Src/builtin.c b/Src/builtin.c index afd140d3c..d1cea8393 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3218,7 +3218,7 @@ zexit(int val, int from_signal) checkjobs(); /* check if any jobs are running/stopped */ if (stopmsg) { stopmsg = 2; - LASTALLOC_RETURN; + return; } } if (in_exit++ && from_signal) @@ -3240,7 +3240,7 @@ zexit(int val, int from_signal) } } if (sigtrapped[SIGEXIT]) - dotrap(SIGEXIT); + dotrap(SIGEXIT, 1); runhookdef(EXITHOOK, NULL); if (mypid != getpid()) _exit(val); @@ -3486,7 +3486,7 @@ bin_read(char *name, char **args, char *ops, int func) *bptr = readchar; val = 1; readchar = -1; - } else if ((val = read(readfd, bptr, nchars)) <= 0) + } else if ((val = ztrapread(readfd, bptr, nchars)) <= 0) break; /* decrement number of characters read from number required */ @@ -3500,7 +3500,7 @@ bin_read(char *name, char **args, char *ops, int func) if (!izle && !ops['u'] && !ops['p']) { /* dispose of result appropriately, etc. */ if (isem) - while (val > 0 && read(SHTTY, &d, 1) == 1 && d != '\n'); + while (val > 0 && ztrapread(SHTTY, &d, 1) == 1 && d != '\n'); else settyinfo(&shttyinfo); if (haso) { @@ -3733,6 +3733,7 @@ static int zread(int izle, int *readchar) { char cc, retry = 0; + int ret; if (izle) { int c = getkeyptr(0); @@ -3756,7 +3757,8 @@ zread(int izle, int *readchar) } for (;;) { /* read a character from readfd */ - switch (read(readfd, &cc, 1)) { + ret = ztrapread(readfd, &cc, 1); + switch (ret) { case 1: /* return the character read */ return STOUC(cc); diff --git a/Src/exec.c b/Src/exec.c index d0787f222..267625807 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -738,6 +738,7 @@ static int execsimple(Estate state) { wordcode code = *state->pc++; + int lv; if (errflag) return (lastval = 1); @@ -754,9 +755,13 @@ execsimple(Estate state) fputc('\n', xtrerr); fflush(xtrerr); } - return (lastval = (errflag ? errflag : cmdoutval)); + lv = (errflag ? errflag : cmdoutval); } else - return (lastval = (execfuncs[code - WC_CURSH])(state, 0)); + lv = (execfuncs[code - WC_CURSH])(state, 0); + + RUNTRAPS(); + + return lastval = lv; } /* Main routine for executing a list. * @@ -887,19 +892,19 @@ sublist_done: noerrexit = oldnoerrexit; if (sigtrapped[SIGDEBUG]) - dotrap(SIGDEBUG); + dotrap(SIGDEBUG, 1); /* Check whether we are suppressing traps/errexit * * (typically in init scripts) and if we haven't * * already performed them for this sublist. */ if (!noerrexit && !donetrap) { if (sigtrapped[SIGZERR] && lastval) { - dotrap(SIGZERR); + dotrap(SIGZERR, 1); donetrap = 1; } if (lastval && isset(ERREXIT)) { if (sigtrapped[SIGEXIT]) - dotrap(SIGEXIT); + dotrap(SIGEXIT, 1); if (mypid != getpid()) _exit(lastval); else @@ -1181,9 +1186,10 @@ execpline2(Estate state, wordcode pcode, else list_pipe_text[0] = '\0'; } - if (WC_PIPE_TYPE(pcode) == WC_PIPE_END) + if (WC_PIPE_TYPE(pcode) == WC_PIPE_END) { execcmd(state, input, output, how, last1 ? 1 : 2); - else { + RUNTRAPS(); + } else { int old_list_pipe = list_pipe; Wordcode next = state->pc + (*state->pc); wordcode code; @@ -1218,12 +1224,14 @@ execpline2(Estate state, wordcode pcode, entersubsh(how, 2, 0); close(synch[1]); execcmd(state, input, pipes[1], how, 0); + RUNTRAPS(); _exit(lastval); } } else { /* otherwise just do the pipeline normally. */ subsh_close = pipes[0]; execcmd(state, input, pipes[1], how, 0); + RUNTRAPS(); } zclose(pipes[1]); state->pc = next; diff --git a/Src/init.c b/Src/init.c index 341173889..290384c1a 100644 --- a/Src/init.c +++ b/Src/init.c @@ -170,7 +170,7 @@ loop(int toplevel, int justonce) } if (isset(SINGLECOMMAND) && toplevel) { if (sigtrapped[SIGEXIT]) - dotrap(SIGEXIT); + dotrap(SIGEXIT, 1); exit(lastval); } if (justonce) @@ -1107,6 +1107,7 @@ fallback_zleread(char *lp, char *rp, int ha) pptbuf = unmetafy(promptexpand(lp, 0, NULL, NULL), &pptlen); write(2, (WRITE_ARG_2_T)pptbuf, pptlen); free(pptbuf); + return (unsigned char *)shingetline(); } diff --git a/Src/input.c b/Src/input.c index 8f33e3631..e82d25011 100644 --- a/Src/input.c +++ b/Src/input.c @@ -141,7 +141,9 @@ shingetline(void) for (;;) { do { errno = 0; - c = fgetc(bshin); + ALLOWTRAPS { + c = fgetc(bshin); + } DISALLOWTRAPS; } while (c < 0 && errno == EINTR); if (c < 0 || c == '\n') { if (c == '\n') diff --git a/Src/jobs.c b/Src/jobs.c index a938e774b..28246d422 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -378,7 +378,7 @@ update_job(Job jn) zrefresh(); } if (sigtrapped[SIGCHLD] && job != thisjob) - dotrap(SIGCHLD); + dotrap(SIGCHLD, 0); /* When MONITOR is set, the foreground process runs in a different * * process group from the shell, so the shell will not receive * @@ -389,7 +389,7 @@ update_job(Job jn) if (sig == SIGINT || sig == SIGQUIT) { if (sigtrapped[sig]) { - dotrap(sig); + dotrap(sig, 0); /* We keep the errflag as set or not by dotrap. * This is to fulfil the promise to carry on * with the jobs if trap returns zero. @@ -878,7 +878,9 @@ waitforpid(pid_t pid) else kill(pid, SIGCONT); - child_suspend(SIGINT); + ALLOWTRAPS { + child_suspend(SIGINT); + } DISALLOWTRAPS; child_block(); } child_unblock(); @@ -900,7 +902,9 @@ waitjob(int job, int sig) while (!errflag && jn->stat && !(jn->stat & STAT_DONE) && !(interact && (jn->stat & STAT_STOPPED))) { - child_suspend(sig); + ALLOWTRAPS { + child_suspend(sig); + } DISALLOWTRAPS; /* Commenting this out makes ^C-ing a job started by a function stop the whole function again. But I guess it will stop something else from working properly, we have to find out @@ -1363,7 +1367,7 @@ bin_fg(char *name, char **argv, char *ops, int func) killjb(jobtab + job, SIGCONT); } if (func == BIN_WAIT) - waitjob(job, SIGINT); + waitjob(job, SIGINT); if (func != BIN_BG) { waitjobs(); retval = lastval2; diff --git a/Src/signals.c b/Src/signals.c index b397e1047..693337dbd 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -497,7 +497,7 @@ handler(int sig) case SIGHUP: if (sigtrapped[SIGHUP]) - dotrap(SIGHUP); + dotrap(SIGHUP, 0); else { stopmsg = 1; zexit(SIGHUP, 1); @@ -506,7 +506,7 @@ handler(int sig) case SIGINT: if (sigtrapped[SIGINT]) - dotrap(SIGINT); + dotrap(SIGINT, 0); else { if ((isset(PRIVILEGED) || isset(RESTRICTED)) && isset(INTERACTIVE) && noerrexit < 0) @@ -523,14 +523,14 @@ handler(int sig) case SIGWINCH: adjustwinsize(1); /* check window size and adjust */ if (sigtrapped[SIGWINCH]) - dotrap(SIGWINCH); + dotrap(SIGWINCH, 0); break; #endif case SIGALRM: if (sigtrapped[SIGALRM]) { int tmout; - dotrap(SIGALRM); + dotrap(SIGALRM, 0); if ((tmout = getiparam("TMOUT"))) alarm(tmout); /* reset the alarm */ @@ -549,7 +549,7 @@ handler(int sig) break; default: - dotrap(sig); + dotrap(sig, 0); break; } /* end of switch(sig) */ @@ -907,7 +907,9 @@ dotrapargs(int sig, int *sigtr, void *sigfn) * function will test for this, but this way we keep status flags * * intact without working too hard. Special cases (e.g. calling * * a trap for SIGINT after the error flag was set) are handled * - * by the calling code. (PWS 1995/06/08). */ + * by the calling code. (PWS 1995/06/08). * + * * + * This test is now replicated in dotrap(). */ if ((*sigtr & ZSIG_IGNORED) || !sigfn || errflag) return; @@ -953,15 +955,67 @@ dotrapargs(int sig, int *sigtr, void *sigfn) breaks = loops; } + /* + * If zle was running while the trap was executed, see if we + * need to restore the display. + */ + if (zleactive && resetneeded) + zrefresh(); + if (*sigtr != ZSIG_IGNORED) *sigtr &= ~ZSIG_IGNORED; } -/* Standard call to execute a trap for a given signal */ +/* != 0 if trap handlers can be called immediately */ + +/**/ +mod_export int trapsallowed; + +/* Queued traps and allocated length of queue. */ + +static int *trapqueue, trapqlen; + +/* Number of used slots in trap queue. */ + +/**/ +mod_export int trapqused; + +/* Standard call to execute a trap for a given signal. The second + * argument should be zero if we may need to put the trap on the queue + * and 1 if it may be called immediately. It should never be set to + * anything less than zero, that's used internally. */ /**/ void -dotrap(int sig) +dotrap(int sig, int now) { - dotrapargs(sig, sigtrapped+sig, sigfuncs[sig]); + /* Copied from dotrapargs(). */ + if ((sigtrapped[sig] & ZSIG_IGNORED) || !sigfuncs[sig] || errflag) + return; + + if (now || trapsallowed) { + if (now < 0) + RUNTRAPS(); + dotrapargs(sig, sigtrapped+sig, sigfuncs[sig]); + } else { + if (trapqlen == trapqused) + trapqueue = (int *) zrealloc(trapqueue, (trapqlen += 32)); + trapqueue[trapqused++] = sig; + } +} + +/**/ +mod_export void +doqueuedtraps(void) +{ + int sig, ota = trapsallowed; + + trapsallowed = 1; + while (trapqused) { + trapqused--; + sig = *trapqueue; + memcpy(trapqueue, trapqueue + 1, trapqused * sizeof(int)); + dotrap(sig, -1); + } + trapsallowed = ota; } diff --git a/Src/signals.h b/Src/signals.h index b6485e6b3..45978dd1e 100644 --- a/Src/signals.h +++ b/Src/signals.h @@ -56,8 +56,8 @@ # define sigismember(s,n) ((*(s) & (1 << ((n) - 1))) != 0) #endif /* ifndef POSIX_SIGNALS */ -#define child_block() signal_block(signal_mask(SIGCHLD)) -#define child_unblock() signal_unblock(signal_mask(SIGCHLD)) +#define child_block() signal_block(sigchld_mask) +#define child_unblock() signal_unblock(sigchld_mask) #define child_suspend(S) signal_suspend(SIGCHLD, S) /* ignore a signal */ @@ -92,3 +92,34 @@ } \ } \ } while (0) + + +/* Make some signal functions faster. */ + +#ifdef POSIX_SIGNALS +#define signal_block(S) \ + ((dummy_sigset1 = (S)), \ + sigprocmask(SIG_BLOCK, &dummy_sigset1, &dummy_sigset2), \ + dummy_sigset2) +#else +# ifdef BSD_SIGNALS +#define signal_block(S) sigblock(S) +# else +extern sigset_t signal_block _((sigset_t)); +# endif /* BSD_SIGNALS */ +#endif /* POSIX_SIGNALS */ + +#ifdef POSIX_SIGNALS +#define signal_unblock(S) \ + ((dummy_sigset1 = (S)), \ + sigprocmask(SIG_UNBLOCK, &dummy_sigset1, &dummy_sigset2), \ + dummy_sigset2) +#else +extern sigset_t signal_unblock _((sigset_t)); +#endif /* POSIX_SIGNALS */ + +#define RUNTRAPS() do { if (trapqused) doqueuedtraps(); } while (0) +#define ALLOWTRAPS do { RUNTRAPS(); trapsallowed++; do +#define DISALLOWTRAPS while (0); RUNTRAPS(); trapsallowed--; } while (0) +#define ALLOWTRAPS_RETURN(V) \ + do { RUNTRAPS(); trapsallowed--; return (V); } while (0) diff --git a/Src/utils.c b/Src/utils.c index b7b8d1295..e61e84a03 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1418,12 +1418,38 @@ checkrmall(char *s) } /**/ +mod_export int +ztrapread(int fd, char *buf, int len) +{ + int ret; + + ALLOWTRAPS { + ret = read(fd, buf, len); + } DISALLOWTRAPS; + + return ret; +} + +/**/ +mod_export int +ztrapwrite(int fd, char *buf, int len) +{ + int ret; + + ALLOWTRAPS { + ret = write(fd, buf, len); + } DISALLOWTRAPS; + + return ret; +} + +/**/ int read1char(void) { char c; - while (read(SHTTY, &c, 1) != 1) { + while (ztrapread(SHTTY, &c, 1) != 1) { if (errno != EINTR || errflag || retflag || breaks || contflag) return -1; } @@ -1440,7 +1466,7 @@ noquery(int purge) ioctl(SHTTY, FIONREAD, (char *)&val); if (purge) { for (; val; val--) - read(SHTTY, &c, 1); + ztrapread(SHTTY, &c, 1); } #endif diff --git a/Src/zsh.h b/Src/zsh.h index cdf1ed489..c4642434b 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1627,8 +1627,6 @@ struct heap { #endif ; -# define LASTALLOC_RETURN return - # define NEWHEAPS(h) do { Heap _switch_oldheaps = h = new_heaps(); do # define OLDHEAPS while (0); old_heaps(_switch_oldheaps); } while (0); |