--- freem/src/fma_routines.c	2025/01/19 02:04:04	1.1.1.1
+++ freem/src/fma_routines.c	2025/03/22 18:43:54	1.4
@@ -1,23 +1,11 @@
 /*
- *                            *
- *                           * *
- *                          *   *
- *                     ***************
- *                      * *       * *
- *                       *  MUMPS  *
- *                      * *       * *
- *                     ***************
- *                          *   *
- *                           * *
- *                            *
- *
- *   fma_routines.c
+ *   $Id: fma_routines.c,v 1.4 2025/03/22 18:43:54 snw Exp $
  *    fmadm - routines
  *
  *  
- *   Author: Serena Willis <jpw@coherent-logic.com>
+ *   Author: Serena Willis <snw@coherent-logic.com>
  *    Copyright (C) 1998 MUG Deutschland
- *    Copyright (C) 2020, 2023 Coherent Logic Development LLC
+ *    Copyright (C) 2020, 2023, 2025 Coherent Logic Development LLC
  *
  *
  *   This file is part of FreeM.
@@ -35,6 +23,16 @@
  *   You should have received a copy of the GNU Affero Public License
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *
+ *   $Log: fma_routines.c,v $
+ *   Revision 1.4  2025/03/22 18:43:54  snw
+ *   Make STRLEN 255 chars and add BIGSTR macro for larger buffers
+ *
+ *   Revision 1.3  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 <stdio.h>
@@ -61,7 +59,7 @@ int fma_routines_list (int optc, char **
     DIR *dir;
     struct dirent *ent;
 
-    char filename[STRLEN];
+    char filename[PATHLEN];
     char *rtnname;
     char *rtnext;
 
@@ -80,12 +78,12 @@ int fma_routines_list (int optc, char **
 
     while ((ent = readdir (dir)) != NULL) {
 
-        strncpy (filename, ent->d_name, STRLEN - 1);
+        strncpy (filename, ent->d_name, PATHLEN - 1);
 
         rtnname = strtok (filename, ".");
         rtnext = strtok (NULL, ".");
 
-        if (rtnext != NULL && strncmp (rtnext, "m", STRLEN - 1) == 0) {
+        if (rtnext != NULL && strncmp (rtnext, "m", PATHLEN - 1) == 0) {
             printf (" %s\n", rtnname);
             ct++;
         }
@@ -102,7 +100,7 @@ int fma_routines_list (int optc, char **
 int fma_routines_edit (int optc, char **opts)
 {
     FILE *fp;
-    char rpath[STRLEN];
+    char rpath[PATHLEN];
     char ecmd[STRLEN];
     char *editor;
 
@@ -123,7 +121,7 @@ int fma_routines_edit (int optc, char **
 
     }
 
-    snprintf (rpath, STRLEN - 1, "%s/%s.m", fma_routine_path, opts[fma_base_opt]);
+    snprintf (rpath, PATHLEN - 1, "%s/%s.m", fma_routine_path, opts[fma_base_opt]);
 
     if (file_exists (rpath) == FALSE) {
         if ((fp = fopen (rpath, "w")) == NULL) {
@@ -149,7 +147,7 @@ int fma_routines_examine (int optc, char
 
     FILE *fp;
     char c;
-    char rpath[STRLEN];
+    char rpath[PATHLEN];
     /* char *editor; */
 
     if (optc < fma_min_args) {
@@ -157,7 +155,7 @@ int fma_routines_examine (int optc, char
         return 1;
     }
 
-    snprintf (rpath, STRLEN - 1, "%s/%s.m", fma_routine_path, opts[fma_base_opt]);
+    snprintf (rpath, PATHLEN - 1, "%s/%s.m", fma_routine_path, opts[fma_base_opt]);
 
     if (file_exists (rpath) == FALSE) {
         fprintf (stderr, "fmadm:  routine %s does not exist in namespace %s\n", opts[1], fma_namespace);
@@ -184,21 +182,21 @@ int fma_routines_backup (int optc, char
     time_t t = time (NULL);
     struct tm *buf;
     char rcmd[STRLEN];
-    char backup_filename[STRLEN];
+    char backup_filename[PATHLEN];
     char dtstamp[STRLEN];
-    char bup_path[STRLEN];
+    char bup_path[PATHLEN];
 
     buf = gmtime (&t);
 
     if (optc > 1) {
-        strncpy (bup_path, opts[fma_base_opt], STRLEN - 1);
+        strncpy (bup_path, opts[fma_base_opt], PATHLEN - 1);
     }
     else {
-        strncpy (bup_path, "/tmp", STRLEN - 1);
+        strncpy (bup_path, "/tmp", PATHLEN - 1);
     }
 
     snprintf (dtstamp, STRLEN - 1, "%d%02d%02d%02d%02d%02d", buf->tm_year, buf->tm_mon, buf->tm_mday, buf->tm_hour, buf->tm_min, buf->tm_sec);
-    snprintf (backup_filename, STRLEN - 1, "%s/freem-routines-backup-%s-%s.tar", bup_path, fma_namespace, dtstamp);
+    snprintf (backup_filename, PATHLEN - 1, "%s/freem-routines-backup-%s-%s.tar", bup_path, fma_namespace, dtstamp);
 
     printf ("\nFreeM Routine Backup\n");
     printf ("--------------------\n\n");
@@ -271,7 +269,7 @@ int fma_routines_import (int optc, char
         return 1;
     }
 
-    if (strncmp (fma_namespace, "SYSTEM", STRLEN - 1) != 0) {
+    if (strncmp (fma_namespace, "SYSTEM", PATHLEN - 1) != 0) {
         
         if (get_conf ("SYSTEM", "routines_path", pct_rtn_path) == FALSE) {
             fprintf (stderr, "fmadm:  could not determine percent routine access path from configuration for namespace '%s'.\n", namespace);
@@ -408,9 +406,9 @@ int fma_routines_export (int optc, char
     DIR *dir;       /* namespace directory */
     
     struct dirent *ent;
-    char output_file[STRLEN];
-    char routine_spec[STRLEN];
-    char filename[STRLEN];
+    char output_file[PATHLEN];
+    char routine_spec[PATHLEN];
+    char filename[PATHLEN];
     char *rtnname;
     char *rtnext;
     int i;
@@ -425,11 +423,11 @@ int fma_routines_export (int optc, char
 
     /* if routines aren't listed, assume we should export entire namespace */
     if (optc == fma_min_args) {
-        strncpy (routine_spec, "*", STRLEN - 1);
+        strncpy (routine_spec, "*", PATHLEN - 1);
     }
 
-    strncpy (output_file, opts[1], STRLEN - 1);
-    strncpy (routine_spec, opts[2], STRLEN - 1);
+    strncpy (output_file, opts[1], PATHLEN - 1);
+    strncpy (routine_spec, opts[2], PATHLEN - 1);
 
     if (file_exists (output_file) == TRUE) {
         fprintf (stderr, "fmadm:  output file %s already exists\n", output_file);
@@ -475,12 +473,12 @@ int fma_routines_export (int optc, char
 
         while ((ent = readdir (dir)) != NULL) {
 
-            strncpy (filename, ent->d_name, STRLEN - 1);
+            strncpy (filename, ent->d_name, PATHLEN - 1);
 
             rtnname = strtok (filename, ".");
             rtnext = strtok (NULL, ".");
 
-            if (rtnext != NULL && strncmp (rtnext, "m", STRLEN - 1) == 0) {
+            if (rtnext != NULL && strncmp (rtnext, "m", PATHLEN - 1) == 0) {
                 ct += fma_do_export (out, rtnname);
             }
 
@@ -509,10 +507,10 @@ int fma_routines_export (int optc, char
 int fma_do_export (FILE *out, char *rtn_name)
 {
     FILE *in;
-    char rtnfile[STRLEN];
+    char rtnfile[PATHLEN];
     char line[FM_STR_MAX];
 
-    snprintf (rtnfile, STRLEN - 1, "%s/%s.m", fma_routine_path, rtn_name);
+    snprintf (rtnfile, PATHLEN - 1, "%s/%s.m", fma_routine_path, rtn_name);
 
     printf (" Exporting %-10s\t", rtn_name);
 
@@ -544,7 +542,7 @@ int fma_routines_create (int optc, char
 int fma_routines_remove (int optc, char **opts)
 {
     
-    char rpath[STRLEN];
+    char rpath[PATHLEN];
     int i;
     int ct = 0;
     int er = 0;
@@ -559,7 +557,7 @@ int fma_routines_remove (int optc, char
     for (i = fma_base_opt; i < optc; i++) {
         printf ("%-10s\t", opts[i]);
 
-        snprintf (rpath, STRLEN - 1, "%s/%s.m", fma_routine_path, opts[i]);
+        snprintf (rpath, PATHLEN - 1, "%s/%s.m", fma_routine_path, opts[i]);
 
         if (unlink (rpath) == -1) {
             printf ("[FAIL]\n");