--- freem/src/cmd_map.c 2025/03/09 15:20:18 1.2
+++ freem/src/cmd_map.c 2025/04/13 04:22:43 1.5
@@ -1,17 +1,5 @@
/*
- * *
- * * *
- * * *
- * ***************
- * * * * *
- * * MUMPS *
- * * * * *
- * ***************
- * * *
- * * *
- * *
- *
- * cmd_map.c
+ * $Id: cmd_map.c,v 1.5 2025/04/13 04:22:43 snw Exp $
* Implementation of the MAP command
*
*
@@ -35,6 +23,19 @@
* You should have received a copy of the GNU Affero Public License
* along with FreeM. If not, see .
*
+ * $Log: cmd_map.c,v $
+ * Revision 1.5 2025/04/13 04:22:43 snw
+ * Fix snprintf calls
+ *
+ * Revision 1.4 2025/04/09 19:52:02 snw
+ * Eliminate as many warnings as possible while building with -Wall
+ *
+ * Revision 1.3 2025/03/09 19:14:24 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
@@ -44,10 +45,9 @@
MRESULT cmd_map(MACTION *ra)
{
- char mapping_type;
- char mapping_obj[256];
- char mapping_ns[256];
- char tmp_key[256];
+ char mapping_obj[STRLEN];
+ char mapping_ns[STRLEN];
+ char tmp_key[STRLEN];
if (rtn_dialect () != D_FREEM) {
return NOSTAND;
@@ -59,14 +59,7 @@ MRESULT cmd_map(MACTION *ra)
expr (NAME);
- if (stcmp (varnam, "GLOBAL\201") == 0 || stcmp (varnam, "global\201") == 0) {
- mapping_type = 'g';
- }
- else if (stcmp (varnam, "ROUTINE\201") == 0 || stcmp (varnam, "routine\201") == 0) {
- mapping_type = 'r';
- return ARGLIST;
- }
- else {
+ if (stcmp (varnam, "GLOBAL\201") != 0 && stcmp (varnam, "global\201") != 0 && stcmp (varnam, "ROUTINE\201") != 0 && stcmp (varnam, "routine\201") != 0) {
return ARGLIST;
}
@@ -91,7 +84,7 @@ MRESULT cmd_map(MACTION *ra)
stcpy (mapping_ns, argptr);
- snprintf (tmp_key, 255, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", mapping_obj);
+ snprintf (tmp_key, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", mapping_obj);
global (set_sym, tmp_key, mapping_ns);
*ra = RA_CONTINUE;