version 1.1.1.1, 2025/01/19 02:04:04
|
version 1.4, 2025/03/22 18:43:54
|
Line 1
|
Line 1
|
/* |
/* |
* * |
* $Id$ |
* * * |
* ^$ROUTINE ssvn |
* * * |
|
* *************** |
|
* * * * * |
|
* * MUMPS * |
|
* * * * * |
|
* *************** |
|
* * * |
|
* * * |
|
* * |
|
* |
|
* ssvn_routine.c |
|
* ^$ROUTINE 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.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: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 58 void ssvn_routine_add_dir(char *rtndir)
|
Line 56 void ssvn_routine_add_dir(char *rtndir)
|
{ |
{ |
DIR *dir; |
DIR *dir; |
struct dirent *ent; |
struct dirent *ent; |
char filename[STRLEN]; |
char filename[PATHLEN]; |
char rtnname[256]; |
char rtnname[PATHLEN]; |
char *rtnext; |
char *rtnext; |
|
|
char k_buf[512]; |
char k_buf[STRLEN]; |
char d_buf[512]; |
char d_buf[STRLEN]; |
char t_buf[512]; |
char t_buf[STRLEN]; |
|
|
dir = opendir (rtndir); |
dir = opendir (rtndir); |
while ((ent = readdir (dir)) != NULL) { |
while ((ent = readdir (dir)) != NULL) { |
|
|
strncpy (filename, ent->d_name, STRLEN - 1); |
strncpy (filename, ent->d_name, PATHLEN); |
|
|
rtnext = ent->d_name + (strlen (ent->d_name) - 2); |
rtnext = ent->d_name + (strlen (ent->d_name) - 2); |
|
|
Line 78 void ssvn_routine_add_dir(char *rtndir)
|
Line 76 void ssvn_routine_add_dir(char *rtndir)
|
strcpy (rtnname, ent->d_name); |
strcpy (rtnname, ent->d_name); |
rtnname[strlen (ent->d_name) - 2] = '\0'; |
rtnname[strlen (ent->d_name) - 2] = '\0'; |
|
|
snprintf (k_buf, 512 - 1, "^$ROUTINE\202%s\202CHARACTER\201", rtnname); |
snprintf (k_buf, STRLEN, "^$ROUTINE\202%s\202CHARACTER\201", rtnname); |
snprintf (d_buf, 512 - 1, "M\201"); |
snprintf (d_buf, STRLEN, "M\201"); |
symtab_bltin (set_sym, k_buf, d_buf); |
symtab_bltin (set_sym, k_buf, d_buf); |
|
|
snprintf (k_buf, 512 - 1, "^$ROUTINE\202%s\202NAMESPACE\201", rtnname); |
snprintf (k_buf, STRLEN, "^$ROUTINE\202%s\202NAMESPACE\201", rtnname); |
if (rtnname[0] == '%') { |
if (rtnname[0] == '%') { |
snprintf (d_buf, 512 - 1, "SYSTEM\201"); |
snprintf (d_buf, STRLEN, "SYSTEM\201"); |
} |
} |
else { |
else { |
snprintf (d_buf, 512 - 1, "%s\201", nsname); |
snprintf (d_buf, STRLEN, "%s\201", nsname); |
} |
} |
|
|
symtab_bltin (set_sym, k_buf, d_buf); |
symtab_bltin (set_sym, k_buf, d_buf); |
|
|
snprintf (k_buf, 512 - 1, "^$ROUTINE\202%s\202PATH\201", rtnname); |
snprintf (k_buf, STRLEN, "^$ROUTINE\202%s\202PATH\201", rtnname); |
|
|
if (rtnname[0] == '%') { |
if (rtnname[0] == '%') { |
stcpy (t_buf, rou0plib); |
stcpy (t_buf, rou0plib); |
Line 102 void ssvn_routine_add_dir(char *rtndir)
|
Line 100 void ssvn_routine_add_dir(char *rtndir)
|
} |
} |
|
|
stcnv_m2c (t_buf); |
stcnv_m2c (t_buf); |
snprintf (d_buf, 512 - 1, "%s/%s\201", t_buf, filename); |
snprintf (d_buf, STRLEN, "%s/%s\201", t_buf, filename); |
|
|
symtab_bltin (set_sym, k_buf, d_buf); |
symtab_bltin (set_sym, k_buf, d_buf); |
|
|