Annotation of freem/src/cmd_unmap.c, revision 1.5
1.1 snw 1: /*
1.5 ! snw 2: * $Id: cmd_unmap.c,v 1.4 2025/04/09 19:52:02 snw Exp $
1.1 snw 3: * Implementation of the UNMAP command
4: *
5: *
1.2 snw 6: * Author: Serena Willis <snw@coherent-logic.com>
1.1 snw 7: * Copyright (C) 1998 MUG Deutschland
1.3 snw 8: * Copyright (C) 2023, 2025 Coherent Logic Development LLC
1.1 snw 9: *
10: *
11: * This file is part of FreeM.
12: *
13: * FreeM is free software: you can redistribute it and/or modify
14: * it under the terms of the GNU Affero Public License as published by
15: * the Free Software Foundation, either version 3 of the License, or
16: * (at your option) any later version.
17: *
18: * FreeM is distributed in the hope that it will be useful,
19: * but WITHOUT ANY WARRANTY; without even the implied warranty of
20: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: * GNU Affero Public License for more details.
22: *
23: * You should have received a copy of the GNU Affero Public License
24: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
25: *
1.4 snw 26: * $Log: cmd_unmap.c,v $
1.5 ! snw 27: * Revision 1.4 2025/04/09 19:52:02 snw
! 28: * Eliminate as many warnings as possible while building with -Wall
! 29: *
1.4 snw 30: * Revision 1.3 2025/03/09 19:14:24 snw
31: * First phase of REUSE compliance and header reformat
32: *
1.3 snw 33: *
34: * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
35: * SPDX-License-Identifier: AGPL-3.0-or-later
1.1 snw 36: **/
37:
38: #include <string.h>
39: #include <stdlib.h>
40: #include "mpsdef.h"
41: #include "mcommand.h"
42:
43: MRESULT cmd_unmap(MACTION *ra)
44: {
1.5 ! snw 45: char mapping_obj[STRLEN];
! 46: char tmp_data[STRLEN];
! 47: char tmp_key[STRLEN];
1.1 snw 48:
49: if (rtn_dialect () != D_FREEM) {
50: return NOSTAND;
51: }
52:
53: if (is_standard ()) {
54: return NOSTAND;
55: }
56:
57: expr (NAME);
58: if (merr ()) return merr ();
1.4 snw 59:
60: if (stcmp (varnam, "GLOBAL\201") != 0 && stcmp (varnam, "global\201") != 0 && stcmp (varnam, "ROUTINE\201") != 0 && stcmp (varnam, "routine\201") != 0) {
1.1 snw 61: return ARGLIST;
62: }
63:
64: codptr += 2;
65:
66: expr (NAME);
67: if (merr ()) return merr ();
68:
69: stcpy (mapping_obj, varnam);
70: stcnv_m2c (mapping_obj);
71:
1.5 ! snw 72: snprintf (tmp_key, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", mapping_obj);
1.1 snw 73: global (kill_sym, tmp_key, tmp_data);
74:
75: codptr++;
76:
77: *ra = RA_CONTINUE;
78: return OK;
79:
80: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>