* PATCH: pws-22: local traps addition
@ 1999-06-20 12:25 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-06-20 12:25 UTC (permalink / raw)
To: Zsh hackers list
Couple of things I missed: don't stick the old trap on the list if we're
not in a function, but do if we are in a function and all that does is
unset any existing trap.
--- Src/signals.c.st2 Fri Jun 18 15:38:35 1999
+++ Src/signals.c Sun Jun 20 14:22:48 1999
@@ -668,7 +668,7 @@
* one, to aid in removing this one. However, if there's
* already one at the current locallevel we just overwrite it.
*/
- if (isset(LOCALTRAPS) &&
+ if (isset(LOCALTRAPS) && locallevel &&
(!sigtrapped[sig] || locallevel > (sigtrapped[sig] >> ZSIG_SHIFT))) {
dosavetrap(sig, locallevel);
} else if (sigfuncs[sig])
@@ -709,6 +709,19 @@
if (sig == -1 || !(trapped = sigtrapped[sig]) ||
(jobbing && (sig == SIGTTOU || sig == SIGTSTP || sig == SIGTTIN))) {
return;
+ }
+ if (isset(LOCALTRAPS) && locallevel &&
+ sigtrapped[sig] && locallevel > (sigtrapped[sig] >> ZSIG_SHIFT)) {
+ /*
+ * This calls unsettrap recursively to do any dirty work, so
+ * make sure this bit doesn't happen: a bit messy, but hard
+ * to avoid.
+ */
+ int oldlt = opts[LOCALTRAPS];
+ opts[LOCALTRAPS] = 0;
+ dosavetrap(sig, locallevel);
+ opts[LOCALTRAPS] = oldlt;
+ return;
}
sigtrapped[sig] = 0;
if (sig == SIGINT && interact) {
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-06-20 12:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-20 12:25 PATCH: pws-22: local traps addition Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).