version 1.1.1.1, 2025/01/19 02:04:04
|
version 1.5, 2025/04/13 04:22:43
|
Line 1
|
Line 1
|
/* |
/* |
* * |
* $Id$ |
* * * |
|
* * * |
|
* *************** |
|
* * * * * |
|
* * MUMPS * |
|
* * * * * |
|
* *************** |
|
* * * |
|
* * * |
|
* * |
|
* |
|
* merr.c |
|
* stuff for handling program bogosity |
* stuff for handling program bogosity |
* |
* |
* |
* |
* 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.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:50:47 snw |
|
* Second phase of REUSE compliance and header reformat |
|
* |
|
* |
|
* SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC |
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
**/ |
**/ |
|
|
#include <string.h> |
#include <string.h> |
Line 208 err_lut errtab[] = {
|
Line 209 err_lut errtab[] = {
|
|
|
inline int merr_raise(int num) |
inline int merr_raise(int num) |
{ |
{ |
char place[256]; |
|
char cod[256]; |
|
|
|
if (merr_in_break ()) { |
if (merr_in_break ()) { |
ierr = num - CTRLB; |
ierr = num - CTRLB; |
Line 308 void merr_set_ecode_ierr (void)
|
Line 307 void merr_set_ecode_ierr (void)
|
char *cod; |
char *cod; |
char *t; |
char *t; |
|
|
cod = (char *) malloc (256 * sizeof (char)); |
cod = (char *) malloc (MERR_COD_LENGTH * sizeof (char)); |
NULLPTRCHK(cod,"merr_set_ecode_ierr"); |
NULLPTRCHK(cod,"merr_set_ecode_ierr"); |
|
|
t = (char *) malloc (256 * sizeof (char)); |
t = (char *) malloc (MERR_COD_LENGTH * sizeof (char)); |
NULLPTRCHK(t,"merr_set_ecode_ierr"); |
NULLPTRCHK(t,"merr_set_ecode_ierr"); |
|
|
if ((merr_num_to_code (merr (), cod)) == -1) goto done; |
if ((merr_num_to_code (merr (), cod)) == -1) goto done; |
|
|
snprintf (t, 255, ",%s,\201", cod); |
snprintf (t, MERR_COD_LENGTH - 1, ",%s,\201", cod); |
merr_set_ecode (t); |
merr_set_ecode (t); |
|
|
job_set_ecode (pid, cod); |
job_set_ecode (pid, cod); |
Line 421 void merr_dump (int num, char *rtn, char
|
Line 420 void merr_dump (int num, char *rtn, char
|
strcpy (real_ecode, p->canonical_name); |
strcpy (real_ecode, p->canonical_name); |
} |
} |
|
|
|
|
|
|
if (!stlen (err_suppl)) { |
if (!stlen (err_suppl)) { |
sprintf (tbuf, "\r\n>> Error %s: %s in %s.%s::%s [$STACK = %d]\r\n\201", real_ecode, nem, shm_env, nsn, nrt, nstx); |
snprintf (tbuf, STRLEN - 1, "\r\n>> Error %s: %s in %s.%s::%s [$STACK = %d]\r\n\201", real_ecode, nem, shm_env, nsn, nrt, nstx); |
} |
} |
else { |
else { |
stcnv_m2c (err_suppl); |
stcnv_m2c (err_suppl); |
sprintf (tbuf, "\r\n>> Error %s: %s (%s) in %s::%s [$STACK = %d]\r\n\201", real_ecode, nem, err_suppl, nsn, nrt, nstx); |
snprintf (tbuf, STRLEN - 1, "\r\n>> Error %s: %s (%s) in %s::%s [$STACK = %d]\r\n\201", real_ecode, nem, err_suppl, nsn, nrt, nstx); |
err_suppl[0] = EOL; |
err_suppl[0] = EOL; |
} |
} |
write_m (tbuf); |
write_m (tbuf); |