--- freem/src/global_dispatch.c 2025/03/29 16:50:42 1.6 +++ freem/src/global_dispatch.c 2025/04/17 14:34:27 1.11 @@ -1,5 +1,5 @@ /* - * $Id: global_dispatch.c,v 1.6 2025/03/29 16:50:42 snw Exp $ + * $Id: global_dispatch.c,v 1.11 2025/04/17 14:34:27 snw Exp $ * global handler dispatch module * * @@ -24,6 +24,21 @@ * along with FreeM. If not, see . * * $Log: global_dispatch.c,v $ + * 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 * @@ -53,23 +68,16 @@ #include "journal.h" #include "iftab.h" #include "shmmgr.h" +#include "log.h" void (*gbl_u)(short, char *, char *); void (*gbl_s)(short, char *, char *); void global_set_engine(char ns, char *engine) { - - - 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"); + + if (strcmp (engine, "BUILTIN") != 0) { - j[2] = '\201'; - } - printf ("\r\nERROR: '%s' is not a valid global storage engine\r\n", engine); merr_raise (M38); @@ -85,14 +93,9 @@ void global_set_engine(char ns, char *en if (strcmp (engine, "BUILTIN") == 0) { gbl_u = &global_bltin; } -#if defined(GVH_BDB) - else if (strcmp (engine, "BERKELEYDB") == 0) { - gbl_u = &global_bdb; - } -#endif else { - fprintf (stderr, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support.\r\n", 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: invalid global handler '%s' or FreeM built without '%s' global handler support", engine, engine); + logprintf (FM_LOG_WARNING, "global_set_engine: defaulting to 'BUILTIN' global handler for namespace '%s'", nsname); gbl_u = &global_bltin; } @@ -104,14 +107,9 @@ void global_set_engine(char ns, char *en if (strcmp (engine, "BUILTIN") == 0) { gbl_s = &global_bltin; } -#if defined(GVH_BDB) - else if (strcmp (engine, "BERKELEYDB") == 0) { - gbl_s = &global_bdb; - } -#endif else { - fprintf (stderr, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support.\r\n", engine, engine); - fprintf (stderr, "global set_engine: defaulting to 'BUILTIN' global handler for namespace 'SYSTEM'.\r\n"); + logprintf (FM_LOG_WARNING, "global_set_engine: invalid global handler '%s' or FreeM built without '%s' global handler support", engine, engine); + logprintf (FM_LOG_WARNING, "global_set_engine: defaulting to 'BUILTIN' global handler for namespace 'SYSTEM'"); gbl_s = &global_bltin; } @@ -119,8 +117,6 @@ void global_set_engine(char ns, char *en } - //ssvn_job_update (); - merr_raise (OK); return; @@ -198,7 +194,7 @@ void global (short action, char *key, ch name[i] = '\0'; 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); @@ -346,7 +342,7 @@ void global (short action, char *key, ch /* grab the rest of the gvn */ subprt = nssave + i + 1; - snprintf (r->name, 255, "^%s", subprt); + sprintf (r->name, "^%s", subprt); /* get a fully-formed key */ key = mref_to_internal (r);