2009-06-05 21:53:06 +00:00
|
|
|
Index: edit.c
|
|
|
|
===================================================================
|
|
|
|
--- edit.c.orig 2009-03-30 21:45:51.000000000 +0200
|
|
|
|
+++ edit.c 2009-06-03 15:20:08.000000000 +0200
|
|
|
|
@@ -152,7 +152,7 @@ back_textlist(tlist, prev)
|
2006-12-18 23:16:54 +00:00
|
|
|
/*
|
|
|
|
* Close the current input file.
|
|
|
|
*/
|
|
|
|
- static void
|
|
|
|
+ public void
|
|
|
|
close_file()
|
|
|
|
{
|
|
|
|
struct scrpos scrpos;
|
2009-06-05 21:53:06 +00:00
|
|
|
Index: funcs.h
|
|
|
|
===================================================================
|
|
|
|
--- funcs.h.orig 2009-06-03 15:17:47.000000000 +0200
|
|
|
|
+++ funcs.h 2009-06-03 15:20:08.000000000 +0200
|
|
|
|
@@ -97,6 +97,7 @@
|
2006-12-18 23:16:54 +00:00
|
|
|
public void init_textlist ();
|
|
|
|
public char * forw_textlist ();
|
|
|
|
public char * back_textlist ();
|
|
|
|
+ public void close_file ();
|
|
|
|
public int edit ();
|
|
|
|
public int edit_ifile ();
|
|
|
|
public int edit_list ();
|
2009-06-05 21:53:06 +00:00
|
|
|
Index: signal.c
|
|
|
|
===================================================================
|
|
|
|
--- signal.c.orig 2009-03-30 22:35:36.000000000 +0200
|
|
|
|
+++ signal.c 2009-06-03 15:20:08.000000000 +0200
|
|
|
|
@@ -37,6 +37,35 @@ extern int quit_on_intr;
|
|
|
|
extern long jump_sline_fraction;
|
2006-12-18 23:16:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
+ * Terminate signal handler.
|
|
|
|
+ */
|
|
|
|
+ static RETSIGTYPE
|
|
|
|
+terminate(type)
|
|
|
|
+ int type;
|
|
|
|
+{
|
|
|
|
+ /*
|
|
|
|
+ * run $LESSCLOSE if needed
|
|
|
|
+ */
|
|
|
|
+ close_file();
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Clean up the terminal.
|
|
|
|
+ */
|
|
|
|
+#ifdef SIGTTOU
|
|
|
|
+ LSIGNAL(SIGTTOU, SIG_IGN);
|
|
|
|
+#endif
|
|
|
|
+ clear_bot();
|
|
|
|
+ deinit();
|
|
|
|
+ flush();
|
|
|
|
+ raw_mode(0);
|
|
|
|
+#ifdef SIGTTOU
|
|
|
|
+ LSIGNAL(SIGTTOU, SIG_DFL);
|
|
|
|
+#endif
|
|
|
|
+ LSIGNAL(SIGTERM, SIG_DFL);
|
|
|
|
+ kill(getpid(), SIGTERM);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
* Interrupt signal handler.
|
|
|
|
*/
|
|
|
|
/* ARGSUSED*/
|
2009-06-05 21:53:06 +00:00
|
|
|
@@ -147,6 +176,7 @@ init_signals(on)
|
2006-12-18 23:16:54 +00:00
|
|
|
* Set signal handlers.
|
|
|
|
*/
|
|
|
|
(void) LSIGNAL(SIGINT, u_interrupt);
|
|
|
|
+ (void) LSIGNAL(SIGTERM, terminate);
|
|
|
|
#if MSDOS_COMPILER==WIN32C
|
|
|
|
SetConsoleCtrlHandler(wbreak_handler, TRUE);
|
|
|
|
#endif
|
2009-06-05 21:53:06 +00:00
|
|
|
@@ -168,6 +198,7 @@ init_signals(on)
|
2006-12-18 23:16:54 +00:00
|
|
|
* Restore signals to defaults.
|
|
|
|
*/
|
|
|
|
(void) LSIGNAL(SIGINT, SIG_DFL);
|
|
|
|
+ (void) LSIGNAL(SIGTERM, SIG_DFL);
|
|
|
|
#if MSDOS_COMPILER==WIN32C
|
|
|
|
SetConsoleCtrlHandler(wbreak_handler, FALSE);
|
|
|
|
#endif
|