Diff for /freem/src/ssvn_global.c between versions 1.1 and 1.8

version 1.1, 2025/01/19 02:04:04 version 1.8, 2025/04/13 04:22:43
Line 1 Line 1
 /*  /*
  *                            *   *   $Id$
  *                           * *   *    ^$GLOBAL ssvn
  *                          *   *  
  *                     ***************  
  *                      * *       * *  
  *                       *  MUMPS  *  
  *                      * *       * *  
  *                     ***************  
  *                          *   *  
  *                           * *  
  *                            *  
  *  
  *   ssvn_global.c  
  *    ^$GLOBAL ssv  
  *   *
  *     *  
  *   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.8  2025/04/13 04:22:43  snw
    *   Fix snprintf calls
    *
    *   Revision 1.7  2025/04/10 17:21:54  snw
    *   Remove traces of BDB global handler
    *
    *   Revision 1.6  2025/04/09 19:52:02  snw
    *   Eliminate as many warnings as possible while building with -Wall
    *
    *   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: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 <stdio.h>  #include <stdio.h>
Line 126  void frm_decode_block(db_blockinfo *b, c Line 133  void frm_decode_block(db_blockinfo *b, c
 void ssvn_global(short action, char *key, char *data)  void ssvn_global(short action, char *key, char *data)
 {  {
     char gb_ns[STRLEN];      char gb_ns[STRLEN];
     char gb_path[STRLEN];      char gb_path[PATHLEN];
     char gb_cpath[STRLEN];      char gb_cpath[PATHLEN];
   
     char ns_key[256];      char ns_key[STRLEN];
     char ns_data[256];  
           
     long blkcount;      long blkcount;
   
Line 155  void ssvn_global(short action, char *key Line 161  void ssvn_global(short action, char *key
                 goto done;                  goto done;
             }              }
   
             snprintf (ns_key, 255, "^$SYSTEM\202MAPPINGS\202GLOBAL\202^%s\201", mref_get_subscript (r, 0));              snprintf (ns_key, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202^%s\201", mref_get_subscript (r, 0));
             global (set_sym, ns_key, data);              symtab_shm (set_sym, ns_key, data);
   
             goto done;              goto done;
   
Line 167  void ssvn_global(short action, char *key Line 173  void ssvn_global(short action, char *key
                 goto done;                  goto done;
             }              }
   
             snprintf (ns_key, 255, "^$SYSTEM\202MAPPINGS\202GLOBAL\202^%s\201", mref_get_subscript (r, 0));              snprintf (ns_key, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202^%s\201", mref_get_subscript (r, 0));
             global (kill_sym, ns_key, data);              symtab_shm (kill_sym, ns_key, data);
   
             goto done;              goto done;
   
Line 230  void ssvn_global(short action, char *key Line 236  void ssvn_global(short action, char *key
                         goto done;                          goto done;
                     }                      }
                                           
                     sprintf (data, "%d\201", bi->blockcount);                      sprintf (data, "%ld\201", bi->blockcount);
                     merr_raise (OK);                      merr_raise (OK);
                     goto done;                                          goto done;                    
                 }                  }
Line 253  void ssvn_global(short action, char *key Line 259  void ssvn_global(short action, char *key
                     }                      }
   
                                           
                     sprintf (data, "%d\201", bi->rlptr);                      sprintf (data, "%ld\201", bi->rlptr);
                     merr_raise (OK);                      merr_raise (OK);
                     goto done;                      goto done;
                 }                  }
Line 264  void ssvn_global(short action, char *key Line 270  void ssvn_global(short action, char *key
                         goto done;                          goto done;
                     }                      }
   
                     sprintf (data, "%d\201", bi->free_offset);                      sprintf (data, "%ld\201", bi->free_offset);
                     merr_raise (OK);                      merr_raise (OK);
                     goto done;                      goto done;
                 }                                  }                
Line 275  void ssvn_global(short action, char *key Line 281  void ssvn_global(short action, char *key
                         goto done;                                                  goto done;                        
                     }                      }
   
                     sprintf (data, "%d\201", bi->llptr);                      sprintf (data, "%ld\201", bi->llptr);
                     merr_raise (OK);                      merr_raise (OK);
                     goto done;                      goto done;
                 }                  }
Line 346  void ssvn_global(short action, char *key Line 352  void ssvn_global(short action, char *key
                                   
             }              }
             else if (strcmp (mref_get_subscript (r, 1), "BYTES") == 0) {              else if (strcmp (mref_get_subscript (r, 1), "BYTES") == 0) {
   
                 FILE *fp;  
                 long bytecount;                  long bytecount;
                                   
                 stcpy (gb_cpath, gb_path);                  stcpy (gb_cpath, gb_path);
Line 358  void ssvn_global(short action, char *key Line 362  void ssvn_global(short action, char *key
                 sprintf (data, "%ld\201", bytecount);                  sprintf (data, "%ld\201", bytecount);
   
                 merr_raise (OK);                  merr_raise (OK);
                 goto done;                  goto done;                
                   
             }              }
   
             merr_raise (M38);              merr_raise (M38);
Line 382  done: Line 385  done:
 short frm_global_exists(char *gbl_namespace, char *gbl_path, char *global_name)  short frm_global_exists(char *gbl_namespace, char *gbl_path, char *global_name)
 {  {
     char *gpth;      char *gpth;
     char glofile[STRLEN];      char glofile[PATHLEN];
     char goobuf[STRLEN];      char goobuf[STRLEN];
   
     char mapk_buf[255];      char mapk_buf[STRLEN];
     char mapd_buf[255];      char mapd_buf[STRLEN];
     char old_ns[255];      char old_ns[STRLEN];
           
     int ierr_sav = OK;      int ierr_sav = OK;
   
     if (global_name[0] != '^') {      if (global_name[0] != '^') {
         snprintf (mapk_buf, 254, "^$SYSTEM\202MAPPINGS\202GLOBAL\202^%s\201", global_name);          snprintf (mapk_buf, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202^%s\201", global_name);
     }      }
     else {      else {
         snprintf (mapk_buf, 254, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", global_name);          snprintf (mapk_buf, STRLEN - 1, "^$SYSTEM\202MAPPINGS\202GLOBAL\202%s\201", global_name);
     }      }
           
     global (get_sym, mapk_buf, mapd_buf);      symtab_shm (get_sym, mapk_buf, mapd_buf);
   
     stcnv_m2c (mapd_buf);      stcnv_m2c (mapd_buf);
   
Line 435  short frm_global_exists(char *gbl_namesp Line 438  short frm_global_exists(char *gbl_namesp
     stcnv_m2c (goobuf);      stcnv_m2c (goobuf);
   
     if (global_name[0] != '^') {      if (global_name[0] != '^') {
         snprintf (glofile, STRLEN - 1, "%s/^%s", goobuf, global_name);          snprintf (glofile, PATHLEN - 1, "%s/^%s", goobuf, global_name);
     }      }
     else {      else {
         snprintf (glofile, STRLEN - 1, "%s/%s", goobuf, global_name);          snprintf (glofile, PATHLEN - 1, "%s/%s", goobuf, global_name);
     }      }
           
     strcpy (gbl_path, glofile);      strcpy (gbl_path, glofile);

Removed from v.1.1  
changed lines
  Added in v.1.8


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>