--- freem/src/fma_globals.c 2025/01/19 02:04:04 1.1 +++ freem/src/fma_globals.c 2025/05/02 16:30:16 1.6 @@ -1,23 +1,11 @@ /* - * * - * * * - * * * - * *************** - * * * * * - * * MUMPS * - * * * * * - * *************** - * * * - * * * - * * - * - * fma_globals.c + * $Id: fma_globals.c,v 1.6 2025/05/02 16:30:16 snw Exp $ * fmadm - globals * * - * Author: Serena Willis + * Author: Serena Willis * 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. @@ -35,6 +23,19 @@ * You should have received a copy of the GNU Affero Public License * along with FreeM. If not, see . * + * $Log: fma_globals.c,v $ + * Revision 1.6 2025/05/02 16:30:16 snw + * Fix broken build due to time issues + * + * Revision 1.5 2025/03/22 18:43:54 snw + * Make STRLEN 255 chars and add BIGSTR macro for larger buffers + * + * 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 @@ -52,10 +53,11 @@ void gl (char *global, short kf, short df, short nr, int chop); int gverify (char *gpath); -static short int g_collate (); /* if 't' follows 's' in MUMPS collating */ +/*static short int g_collate ();*/ /* if 't' follows 's' in MUMPS collating */ int key_check (char *key); -void check (); -void show (); +void check (unsigned long blknbr); +static short int g_collate (char s[], char t[]); /* if 't' follows 's' in MUMPS collating */ +void show (char key[]); /* global variables for gverify */ short filedes; /* file descriptor */ @@ -79,7 +81,7 @@ int fma_globals_list (int optc, char **o DIR *dir; struct dirent *ent; - char filename[STRLEN]; + char filename[PATHLEN]; int ct = 0; @@ -96,7 +98,7 @@ int fma_globals_list (int optc, char **o while ((ent = readdir (dir)) != NULL) { - strncpy (filename, ent->d_name, STRLEN - 1); + strncpy (filename, ent->d_name, PATHLEN - 1); if (filename[0] == '^' && filename[1] != '$') { printf (" %s\n", filename); @@ -117,7 +119,7 @@ int fma_globals_examine (int optc, char DIR *dir; struct dirent *ent; - char gpath[STRLEN]; + char gpath[PATHLEN]; int i; int ct = 0; @@ -152,7 +154,7 @@ int fma_globals_examine (int optc, char for (i = fma_base_opt; i < optc; i++) { - snprintf (gpath, STRLEN - 1, "%s/%s", fma_global_path, opts[i]); + snprintf (gpath, PATHLEN - 1, "%s/%s", fma_global_path, opts[i]); gl (gpath, FALSE, FALSE, FALSE, strlen (fma_global_path)); ct++; @@ -164,11 +166,11 @@ int fma_globals_examine (int optc, char while ((ent = readdir (dir)) != NULL) { - strncpy (gpath, ent->d_name, STRLEN - 1); + strncpy (gpath, ent->d_name, PATHLEN - 1); if (gpath[0] == '^' && gpath[1] != '$') { - snprintf (gpath, STRLEN - 1, "%s/%s", fma_global_path, ent->d_name); + snprintf (gpath, PATHLEN - 1, "%s/%s", fma_global_path, ent->d_name); gl (gpath, FALSE, FALSE, FALSE, strlen (fma_global_path)); @@ -190,7 +192,7 @@ int fma_globals_examine (int optc, char int fma_globals_remove (int optc, char **opts) { - char gpath[STRLEN]; + char gpath[PATHLEN]; int i; int ct = 0; int er = 0; @@ -205,7 +207,7 @@ int fma_globals_remove (int optc, char * for (i = fma_base_opt; i < optc; i++) { printf ("%-10s\t", opts[i]); - snprintf (gpath, STRLEN - 1, "%s/%s", fma_global_path, opts[i]); + snprintf (gpath, PATHLEN - 1, "%s/%s", fma_global_path, opts[i]); if (unlink (gpath) == -1) { printf ("[FAIL]\n"); @@ -231,7 +233,7 @@ int fma_globals_verify (int optc, char * DIR *dir; struct dirent *ent; - char gpath[STRLEN]; + char gpath[PATHLEN]; int i; int ct = 0; @@ -265,7 +267,7 @@ int fma_globals_verify (int optc, char * for (i = fma_base_opt; i < optc; i++) { - snprintf (gpath, STRLEN - 1, "%s/%s", fma_global_path, opts[i]); + snprintf (gpath, PATHLEN - 1, "%s/%s", fma_global_path, opts[i]); exstat = 0; gverify (gpath); @@ -281,11 +283,11 @@ int fma_globals_verify (int optc, char * while ((ent = readdir (dir)) != NULL) { - strncpy (gpath, ent->d_name, STRLEN - 1); + strncpy (gpath, ent->d_name, PATHLEN - 1); if (gpath[0] == '^') { - snprintf (gpath, STRLEN - 1, "%s/%s", fma_global_path, ent->d_name); + snprintf (gpath, PATHLEN - 1, "%s/%s", fma_global_path, ent->d_name); exstat = 0; gverify (gpath); @@ -1008,7 +1010,7 @@ showpath () for (i = 0; i < level; i++) printf (" path level(%d)=%ld\012\015", i, llink[i]); if (++exstat >= ERRLIM) { - fprintf (stderr, "Error limit exceeded (%hd errors)\012\015", exstat, ERRLIM); + fprintf (stderr, "Error limit exceeded (%hd errors)\012\015", exstat); return; } return; @@ -1044,11 +1046,7 @@ int key_check (char *key) /* checks a return 0; } /* end key_check */ /******************************************************************************/ -static short int -g_collate (s, t) /* if 't' follows 's' in MUMPS collating */ - char s[]; /* sequence a TRUE is returned */ - char t[]; - +static short int g_collate (char s[], char t[]) /* if 't' follows 's' in MUMPS collating */ { register int chs = *s; register int cht = *t; @@ -1149,9 +1147,7 @@ g_collate (s, t) /* if 't' follows 's' return dif > 0; } /* end g_collate */ /******************************************************************************/ -void -show (key) - char key[]; /* key in internal format to be expanded and shown */ +void show (char key[]) { int k, ch,