version 1.1.1.1, 2025/01/19 02:04:04
|
version 1.11, 2025/04/17 14:34:27
|
Line 1
|
Line 1
|
/* |
/* |
* * |
* $Id$ |
* * * |
|
* * * |
|
* *************** |
|
* * * * * |
|
* * MUMPS * |
|
* * * * * |
|
* *************** |
|
* * * |
|
* * * |
|
* * |
|
* |
|
* global_dispatch.c |
|
* global handler dispatch module |
* global handler dispatch module |
* |
* |
* |
* |
* 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.11 2025/04/17 14:34:27 snw |
|
* Further logging improvements |
|
* |
|
* Revision 1.10 2025/04/13 04:22:43 snw |
|
* Fix snprintf calls |
|
* |
|
* Revision 1.9 2025/04/10 01:24:38 snw |
|
* Remove C++ style comments |
|
* |
|
* Revision 1.8 2025/04/09 19:52:02 snw |
|
* Eliminate as many warnings as possible while building with -Wall |
|
* |
|
* Revision 1.7 2025/04/09 15:16:50 snw |
|
* Fix buffer overruns in mref_to_external and ssvn.c |
|
* |
|
* Revision 1.6 2025/03/29 16:50:42 snw |
|
* Back to cvs-current as version for development; temp fix for double-free issue in global_dispatch |
|
* |
|
* Revision 1.5 2025/03/24 04:13:11 snw |
|
* Replace action macro dat with fra_dat to avoid symbol conflict on OS/2 |
|
* |
|
* Revision 1.4 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 <stdlib.h> |
#include <stdlib.h> |
Line 52
|
Line 68
|
#include "journal.h" |
#include "journal.h" |
#include "iftab.h" |
#include "iftab.h" |
#include "shmmgr.h" |
#include "shmmgr.h" |
|
#include "log.h" |
|
|
void (*gbl_u)(short, char *, char *); |
void (*gbl_u)(short, char *, char *); |
void (*gbl_s)(short, char *, char *); |
void (*gbl_s)(short, char *, char *); |
|
|
void global_set_engine(char ns, char *engine) |
void global_set_engine(char ns, char *engine) |
{ |
{ |
|
|
|
if (strcmp (engine, "BUILTIN") != 0) { |
if ((strcmp (engine, "BUILTIN") != 0) && (strcmp (engine, "BERKELEYDB") != 0)) { |
|
|
|
if (strcmp (engine, "NICKELBACK") == 0) { |
|
char *j; |
|
printf ("\r\nERROR: please go burn your CD collection in fire. Here, have a segfault...\r\n"); |
|
|
|
j[2] = '\201'; |
|
} |
|
|
|
printf ("\r\nERROR: '%s' is not a valid global storage engine\r\n", engine); |
printf ("\r\nERROR: '%s' is not a valid global storage engine\r\n", engine); |
merr_raise (M38); |
merr_raise (M38); |
|
|
Line 84 void global_set_engine(char ns, char *en
|
Line 93 void global_set_engine(char ns, char *en
|
if (strcmp (engine, "BUILTIN") == 0) { |
if (strcmp (engine, "BUILTIN") == 0) { |
gbl_u = &global_bltin; |
gbl_u = &global_bltin; |
} |
} |
#if defined(GVH_BDB) |
|
else if (strcmp (engine, "BERKELEYDB") == 0) { |
|
gbl_u = &global_bdb; |
|
} |
|
#endif |
|
else { |
else { |
fprintf (stderr, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support.\r\n", engine, engine); |
logprintf (FM_LOG_WARNING, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support", engine, engine); |
fprintf (stderr, "global set_engine: defaulting to 'BUILTIN' global handler for namespace '%s'.\r\n", nsname); |
logprintf (FM_LOG_WARNING, "global_set_engine: defaulting to 'BUILTIN' global handler for namespace '%s'", nsname); |
gbl_u = &global_bltin; |
gbl_u = &global_bltin; |
} |
} |
|
|
Line 103 void global_set_engine(char ns, char *en
|
Line 107 void global_set_engine(char ns, char *en
|
if (strcmp (engine, "BUILTIN") == 0) { |
if (strcmp (engine, "BUILTIN") == 0) { |
gbl_s = &global_bltin; |
gbl_s = &global_bltin; |
} |
} |
#if defined(GVH_BDB) |
|
else if (strcmp (engine, "BERKELEYDB") == 0) { |
|
gbl_s = &global_bdb; |
|
} |
|
#endif |
|
else { |
else { |
fprintf (stderr, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support.\r\n", engine, engine); |
logprintf (FM_LOG_WARNING, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support", engine, engine); |
fprintf (stderr, "global set_engine: defaulting to 'BUILTIN' global handler for namespace 'SYSTEM'.\r\n"); |
logprintf (FM_LOG_WARNING, "global_set_engine: defaulting to 'BUILTIN' global handler for namespace 'SYSTEM'"); |
gbl_s = &global_bltin; |
gbl_s = &global_bltin; |
} |
} |
|
|
Line 118 void global_set_engine(char ns, char *en
|
Line 117 void global_set_engine(char ns, char *en
|
|
|
} |
} |
|
|
//ssvn_job_update (); |
|
|
|
merr_raise (OK); |
merr_raise (OK); |
return; |
return; |
|
|
Line 197 void global (short action, char *key, ch
|
Line 194 void global (short action, char *key, ch
|
name[i] = '\0'; |
name[i] = '\0'; |
|
|
snprintf (mapk_buf, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", name); |
snprintf (mapk_buf, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", name); |
global (get_sym, mapk_buf, mapd_buf); |
symtab_shm (get_sym, mapk_buf, mapd_buf); |
|
|
stcnv_m2c (mapd_buf); |
stcnv_m2c (mapd_buf); |
|
|
Line 292 void global (short action, char *key, ch
|
Line 289 void global (short action, char *key, ch
|
} |
} |
|
|
|
|
if ((r->name[1] == '|')) { |
if (r->name[1] == '|') { |
|
|
/* this is an mdc-style extended reference */ |
/* this is an mdc-style extended reference */ |
|
|
Line 345 void global (short action, char *key, ch
|
Line 342 void global (short action, char *key, ch
|
|
|
/* grab the rest of the gvn */ |
/* grab the rest of the gvn */ |
subprt = nssave + i + 1; |
subprt = nssave + i + 1; |
snprintf (r->name, 255, "^%s", subprt); |
sprintf (r->name, "^%s", subprt); |
|
|
/* get a fully-formed key */ |
/* get a fully-formed key */ |
key = mref_to_internal (r); |
key = mref_to_internal (r); |
Line 429 void global (short action, char *key, ch
|
Line 426 void global (short action, char *key, ch
|
case get_sym: |
case get_sym: |
sprintf (an, "GET"); |
sprintf (an, "GET"); |
break; |
break; |
case dat: |
case fra_dat: |
sprintf (an, "DATA"); |
sprintf (an, "DATA"); |
break; |
break; |
case fra_order: |
case fra_order: |
Line 471 void global (short action, char *key, ch
|
Line 468 void global (short action, char *key, ch
|
evt_enqueue (ev_id, EVT_CLS_TRIGGER, 0); |
evt_enqueue (ev_id, EVT_CLS_TRIGGER, 0); |
|
|
free (k_buf); |
free (k_buf); |
free (d_buf); |
/* free (d_buf); */ |
} |
} |
|
|
free (old_value); |
free (old_value); |