--- freem/src/init.c 2025/04/20 03:13:17 1.14 +++ freem/src/init.c 2026/03/19 19:03:58 1.18 @@ -1,5 +1,5 @@ /* - * $Id: init.c,v 1.14 2025/04/20 03:13:17 snw Exp $ + * $Id: init.c,v 1.18 2026/03/19 19:03:58 snw Exp $ * FreeM initialization * * @@ -24,6 +24,18 @@ * along with FreeM. If not, see . * * $Log: init.c,v $ + * Revision 1.18 2026/03/19 19:03:58 snw + * Attempt to rectify terminal corruption problem when the user performs a gracious exit + * + * Revision 1.17 2026/03/14 21:04:51 snw + * Fix segfault in OPEN command with I/O channel specified but no file + * + * Revision 1.16 2026/01/07 19:51:33 snw + * Fix segfault in reverse $QUERY + * + * Revision 1.15 2025/05/16 04:02:14 snw + * Make FreeM build on macOS on Apple Silicon + * * Revision 1.14 2025/04/20 03:13:17 snw * Updates to init_execution_context * @@ -77,14 +89,24 @@ # endif # define termio termios # else -# if !defined(MSDOS) +# if !defined(MSDOS) && !defined(__linux__) # include +# else +# include +# define termio termios # endif # endif #else # include #endif + +#if defined(__APPLE__) +# define termio termios +# define TCGETA TIOCGETA +# define TCSETA TIOCSETA +#endif + #include "config.h" #if defined(HAVE_MWAPI_MOTIF) @@ -604,6 +626,7 @@ void init_io (void) else { dev[HOME][0] = EOL; /* ...we are in a pipe */ } + for (i = 5; i <= MAXDEV; i++) dev[i][0] = EOL; #else #if defined(__AMIGA) strcpy (dev[HOME], "CONSOLE:"); @@ -745,9 +768,7 @@ void cleanup (void) unlink (pid_file_path); } - } - - + } free (buff); /* free previously allocated space */ free (svntable);