|
|
| version 1.1, 2025/01/19 02:04:04 | version 1.10, 2025/04/10 01:24:38 |
|---|---|
| Line 1 | Line 1 |
| /* | /* |
| * * | * $Id$ |
| * * * | |
| * * * | |
| * *************** | |
| * * * * * | |
| * * MUMPS * | |
| * * * * * | |
| * *************** | |
| * * * | |
| * * * | |
| * * | |
| * | |
| * init.c | |
| * FreeM initialization | * FreeM initialization |
| * | * |
| * | * |
| * Author: Serena Willis <jpw@coherent-logic.com> | * Author: Serena Willis <snw@coherent-logic.com> |
| * Copyright (C) 1998 MUG Deutschland | * Copyright (C) 1998 MUG Deutschland |
| * Copyright (C) 2020 Coherent Logic Development LLC | * Copyright (C) 2020, 2025 Coherent Logic Development LLC |
| * | * |
| * | * |
| * This file is part of FreeM. | * This file is part of FreeM. |
| Line 35 | Line 23 |
| * You should have received a copy of the GNU Affero Public License | * You should have received a copy of the GNU Affero Public License |
| * along with FreeM. If not, see <https://www.gnu.org/licenses/>. | * along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
| * | * |
| * $Log$ | |
| * Revision 1.10 2025/04/10 01:24:38 snw | |
| * Remove C++ style comments | |
| * | |
| * Revision 1.9 2025/04/03 16:58:34 snw | |
| * Make error message for shm_init error during initialization more friendly | |
| * | |
| * Revision 1.8 2025/03/24 04:44:55 snw | |
| * Don't call ttyname on OS/2 | |
| * | |
| * Revision 1.7 2025/03/24 04:05:36 snw | |
| * Replace crlf with frm_crlf to avoid symbol conflict with readline on OS/2 | |
| * | |
| * Revision 1.6 2025/03/09 19:14:25 snw | |
| * First phase of REUSE compliance and header reformat | |
| * | |
| * | |
| * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC | |
| * SPDX-License-Identifier: AGPL-3.0-or-later | |
| **/ | **/ |
| #include <stdio.h> | #include <stdio.h> |
| Line 48 | Line 55 |
| #include <time.h> | #include <time.h> |
| #include <errno.h> | #include <errno.h> |
| #include <sys/ioctl.h> | #include <sys/ioctl.h> |
| #include <termios.h> | |
| #if !defined(__APPLE__) && !defined(__gnu_hurd__) && !defined(EMSCRIPTEN) | |
| # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__AMIGA) | |
| # include <termios.h> | |
| # if !defined(__AMIGA) | |
| # define TCGETA TIOCGETA | |
| # define TCSETA TIOCSETA | |
| # endif | |
| # define termio termios | |
| # else | |
| # if !defined(MSDOS) | |
| # include <termio.h> | |
| # endif | |
| # endif | |
| #else | |
| # include <termios.h> | |
| #endif | |
| #include "config.h" | #include "config.h" |
| Line 162 short init (char *namespace_name) | Line 185 short init (char *namespace_name) |
| retval = shm_init (shm_init_size); | retval = shm_init (shm_init_size); |
| if (retval == SHMS_GET_ERR) { | if (retval == SHMS_GET_ERR) { |
| fprintf (stderr, "init: error initializing shared memory [errno %d]\r\n", errno); | if (errno != 13) { |
| fprintf (stderr, "init: error initializing shared memory [errno %d]\r\n", errno); | |
| } | |
| else { | |
| fprintf (stderr, "init: error attaching to environment -- does your user belong to the group that owns environment '%s'?\r\n", shm_env); | |
| } | |
| if (run_daemon == FALSE) { | |
| set_io (UNIX); | |
| } | |
| exit (1); | exit (1); |
| } | } |
| Line 515 void init_mwapi (void) | Line 546 void init_mwapi (void) |
| gtk_init (0, NULL); | gtk_init (0, NULL); |
| } | } |
| */ | */ |
| //TODO: init Motif/libXt | /* TODO: init Motif/libXt */ |
| } | } |
| #else | #else |
| void init_mwapi (void) | void init_mwapi (void) |
| Line 536 void init_io (void) | Line 567 void init_io (void) |
| sq_modes[0] = '+'; | sq_modes[0] = '+'; |
| for (i = 0; i <= MAXDEV; ug_buf[i++][0] = EOL); /* init read-buffers */ | for (i = 0; i <= MAXDEV; ug_buf[i++][0] = EOL); /* init read-buffers */ |
| crlf[HOME] = frm_filter; | frm_crlf[HOME] = frm_filter; |
| if (hardcopy) zbreakon = ENABLE; /* enable CTRL/B */ | if (hardcopy) zbreakon = ENABLE; /* enable CTRL/B */ |
| set_io (MUMPS); /* set i/o parameters */ | set_io (MUMPS); /* set i/o parameters */ |
| #if !defined(__AMIGA) | #if !defined(__AMIGA) && !defined(__OS2__) |
| if (ttyname (HOME)) { /* for $IO of HOME */ | if (ttyname (HOME)) { /* for $IO of HOME */ |
| strcpy (dev[HOME], ttyname (HOME)); | strcpy (dev[HOME], ttyname (HOME)); |
| dev[HOME][strlen (dev[HOME])] = EOL; | dev[HOME][strlen (dev[HOME])] = EOL; |
| Line 551 void init_io (void) | Line 582 void init_io (void) |
| dev[HOME][0] = EOL; /* ...we are in a pipe */ | dev[HOME][0] = EOL; /* ...we are in a pipe */ |
| } | } |
| #else | #else |
| #if defined(__AMIGA) | |
| strcpy (dev[HOME], "CONSOLE:"); | strcpy (dev[HOME], "CONSOLE:"); |
| #else | |
| #if defined(__OS2__) | |
| strcpy (dev[HOME], "CON:"); | |
| #endif | |
| #endif | |
| #endif | #endif |
| /* init function keys */ | /* init function keys */ |