about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/.distfiles1
-rw-r--r--Src/builtin.c1
-rw-r--r--Src/init.c7
-rw-r--r--Src/zsh.h6
4 files changed, 15 insertions, 0 deletions
diff --git a/Src/Modules/.distfiles b/Src/Modules/.distfiles
index 5bb3f6ef6..4ef91ad62 100644
--- a/Src/Modules/.distfiles
+++ b/Src/Modules/.distfiles
@@ -11,4 +11,5 @@ DISTFILES_SRC='
     zftp.mdd zftp.c
     zprof.mdd zprof.c
     zutil.mdd zutil.c
+    zpty.mdd zpty.c
 '
diff --git a/Src/builtin.c b/Src/builtin.c
index 96c86d291..6b09eb3aa 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3219,6 +3219,7 @@ zexit(int val, int from_signal)
 	}
 	if (sigtrapped[SIGEXIT])
 	    dotrap(SIGEXIT);
+	runhookdef(EXITHOOK, NULL);
 	if (mypid != getpid())
 	    _exit(val);
 	else
diff --git a/Src/init.c b/Src/init.c
index 1921935eb..0dc063f7b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -89,6 +89,11 @@ mod_export int (*getkeyptr) _((int));
 mod_export int alloc_stackp;
 #endif
 
+/**/
+mod_export struct hookdef zshhooks[] = {
+    HOOKDEF("exit", NULL, HOOKF_ALL),
+};
+
 /* keep executing lists until EOF found */
 
 /**/
@@ -560,6 +565,8 @@ setupvals(void)
 # endif
 #endif
 
+    addhookdefs(argzero, zshhooks, sizeof(zshhooks)/sizeof(*zshhooks));
+
     init_eprog();
 
     getkeyptr = NULL;
diff --git a/Src/zsh.h b/Src/zsh.h
index ea8ba8598..51c21d073 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1651,3 +1651,9 @@ typedef unsigned char * (*ZleReadFn) _((char *, char *, int));
 /***************************************/
 
 #define mod_export
+
+/***************************************/
+/* Hooks in core.                      */
+/***************************************/
+
+#define EXITHOOK (zshhooks + 0)