Hi Mike,

thanks, fixed in *SVN 1870*.

Best regards,
Jürgen


On 4/30/25 17:50, M.Hall wrote:
On macos 15.4.1, with gnu_apl Version / SVN:  1.9 / SVN: 1868M

In the 'tools' subdirectory, run "./APL_keyboard_show", and press control-C to exit. The  terminal settings are not restored (because the program exited w/o cleaning up.).
Catching SIGINT and restoring the terminal before exit seems to work.
A 'diff' follows:

--- APL_keyboard_show.cc-ORIG 2025-04-26 21:08:35.000000000 -0500
+++ APL_keyboard_show.cc 2025-04-26 21:18:19.000000000 -0500
@@ -20,6 +20,8 @@

 #include <stdio.h>
 #include <string.h>
+#include <signal.h>
+#include <stdlib.h>
 #include <termios.h>
 #include <unistd.h>
 #include <sys/select.h>
@@ -27,11 +29,21 @@
 struct termios orig_tios;

 //----------------------------------------------------------------------------
+void
+catchCC(int sig)
+{
+   tcsetattr(STDIN_FILENO, TCSANOW, &orig_tios);
+   exit(0);
+}
+
+//----------------------------------------------------------------------------
 int
 main(int argc, char *argv[])
 {
    printf("\nhit keys, ^C to quit...\n\n");

+   signal(SIGINT, catchCC);
+
 struct termios new_tios;
    tcgetattr(STDIN_FILENO, &orig_tios);
    tcgetattr(STDIN_FILENO, &new_tios);

--
Mike Hall


Reply via email to