Skip to content
Snippets Groups Projects
Commit 3823fea1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Allow sysop-choice of source of virtual sub-directory source name

By default, each file transfer directory's internal code suffix is
used as the source of the sub-directory of the virtual path used
to represent a file area in the FTP and Web servers. Now, a sysop
can change that source to either each directory's short name or
long name, if they prefer.

For MRO, because he asked (on DOVE-Net).
parent 938b9c91
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3119 passed
...@@ -310,6 +310,13 @@ enum area_sort { ...@@ -310,6 +310,13 @@ enum area_sort {
AREA_SORT_TYPES, AREA_SORT_TYPES,
}; };
// Values for lib[x].vdir_name
enum vdir_name {
VDIR_NAME_CODE,
VDIR_NAME_SHORT,
VDIR_NAME_LONG
};
enum { enum {
clr_mnehigh clr_mnehigh
,clr_mnelow ,clr_mnelow
......
...@@ -36,6 +36,13 @@ char* file_sort_desc[] = { ...@@ -36,6 +36,13 @@ char* file_sort_desc[] = {
NULL NULL
}; };
char* vdir_name_desc[] = {
"Internal Code Suffix",
"Short Name",
"Long Name",
NULL
};
static bool new_dir(unsigned new_dirnum, unsigned libnum) static bool new_dir(unsigned new_dirnum, unsigned libnum)
{ {
dir_t* new_directory = malloc(sizeof(dir_t)); dir_t* new_directory = malloc(sizeof(dir_t));
...@@ -425,6 +432,7 @@ void xfer_cfg() ...@@ -425,6 +432,7 @@ void xfer_cfg()
sprintf(opt[j++],"%-27.27s%s","Access to Sub-directories" sprintf(opt[j++],"%-27.27s%s","Access to Sub-directories"
,cfg.lib[libnum]->parent_path[0] ? (cfg.lib[libnum]->misc&LIB_DIRS ? "Yes":"No") : "N/A"); ,cfg.lib[libnum]->parent_path[0] ? (cfg.lib[libnum]->misc&LIB_DIRS ? "Yes":"No") : "N/A");
sprintf(opt[j++],"%-27.27s%s","Sort Library By Directory", area_sort_desc[cfg.lib[libnum]->sort]); sprintf(opt[j++],"%-27.27s%s","Sort Library By Directory", area_sort_desc[cfg.lib[libnum]->sort]);
sprintf(opt[j++],"%-27.27s%s","Virtual Sub-directories", vdir_name_desc[cfg.lib[libnum]->vdir_name]);
strcpy(opt[j++],"Clone Options"); strcpy(opt[j++],"Clone Options");
strcpy(opt[j++],"Export Areas..."); strcpy(opt[j++],"Export Areas...");
strcpy(opt[j++],"Import Areas..."); strcpy(opt[j++],"Import Areas...");
...@@ -564,6 +572,21 @@ void xfer_cfg() ...@@ -564,6 +572,21 @@ void xfer_cfg()
uifc.changes = TRUE; uifc.changes = TRUE;
} }
break; break;
case __COUNTER__:
uifc.helpbuf="`Source of Virtual Sub-directory Names:`\n"
"\n"
"File areas accessed via the FTP server or Web server are represented\n"
"by a virtual path. This setting determines the source of the\n"
"sub-directory portion of the virtual paths used to represent directories\n"
"within this file library.\n"
;
j = cfg.lib[libnum]->vdir_name;
j = uifc.list(WIN_MID|WIN_SAV, 0, 0, 0, &j, 0, "Source of Virtual Sub-directory Names", vdir_name_desc);
if(j >= 0) {
cfg.lib[libnum]->vdir_name = j;
uifc.changes = TRUE;
}
break;
case __COUNTER__: /* clone options */ case __COUNTER__: /* clone options */
j=0; j=0;
uifc.helpbuf= uifc.helpbuf=
......
...@@ -73,7 +73,7 @@ typedef struct { /* Message group info */ ...@@ -73,7 +73,7 @@ typedef struct { /* Message group info */
typedef struct { /* Transfer Directory Info */ typedef struct { /* Transfer Directory Info */
char code[LEN_EXTCODE+1]; /* Internal code (with optional lib prefix) */ char code[LEN_EXTCODE+1]; /* Internal code (with optional lib prefix) */
char code_suffix[LEN_CODE+1]; /* Eight character code suffix */ char code_suffix[LEN_CODE+1]; /* Eight character code suffix */
char* vdir; /* Virtual Directory name */ char vdir[LEN_SLNAME+1]; /* Virtual Directory name */
char area_tag[41]; char area_tag[41];
char lname[LEN_SLNAME+1], /* Long name - used for listing */ char lname[LEN_SLNAME+1], /* Long name - used for listing */
sname[LEN_SSNAME+1], /* Short name - used for prompts */ sname[LEN_SSNAME+1], /* Short name - used for prompts */
...@@ -114,6 +114,7 @@ typedef struct { /* Transfer Library Information */ ...@@ -114,6 +114,7 @@ typedef struct { /* Transfer Library Information */
uint32_t offline_dir; /* Offline file directory */ uint32_t offline_dir; /* Offline file directory */
uint32_t misc; /* Miscellaneous bits */ uint32_t misc; /* Miscellaneous bits */
enum area_sort sort; enum area_sort sort;
enum vdir_name vdir_name;
} lib_t; } lib_t;
......
...@@ -23,13 +23,25 @@ ...@@ -23,13 +23,25 @@
#include "nopen.h" #include "nopen.h"
#include "ars_defs.h" #include "ars_defs.h"
static void pathify(char* str)
{
char* p;
if(strchr(str, '.') == NULL) {
REPLACE_CHARS(str, ' ', '.', p);
} else {
REPLACE_CHARS(str, ' ', '_', p);
}
REPLACE_CHARS(str, '\\', '-', p);
REPLACE_CHARS(str, '/', '-', p);
}
/****************************************************************************/ /****************************************************************************/
/* Reads in FILE.CNF and initializes the associated variables */ /* Reads in FILE.CNF and initializes the associated variables */
/****************************************************************************/ /****************************************************************************/
BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen) BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
{ {
char str[MAX_PATH+1],c,cmd[LEN_CMD+1]; char str[MAX_PATH+1],c,cmd[LEN_CMD+1];
char* p;
short i,j; short i,j;
int16_t n; int16_t n;
long offset=0; long offset=0;
...@@ -292,11 +304,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen) ...@@ -292,11 +304,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
get_str(cfg->lib[i]->lname,instream); get_str(cfg->lib[i]->lname,instream);
get_str(cfg->lib[i]->sname,instream); get_str(cfg->lib[i]->sname,instream);
SAFECOPY(cfg->lib[i]->vdir, cfg->lib[i]->sname); SAFECOPY(cfg->lib[i]->vdir, cfg->lib[i]->sname);
if(strchr(cfg->lib[i]->vdir, '.') == NULL) { pathify(cfg->lib[i]->vdir);
REPLACE_CHARS(cfg->lib[i]->vdir, ' ', '.', p);
} else {
REPLACE_CHARS(cfg->lib[i]->vdir, ' ', '_', p);
}
get_str(cfg->lib[i]->arstr,instream); get_str(cfg->lib[i]->arstr,instream);
arstr(NULL, cfg->lib[i]->arstr, cfg, cfg->lib[i]->ar); arstr(NULL, cfg->lib[i]->arstr, cfg, cfg->lib[i]->ar);
...@@ -310,8 +318,10 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen) ...@@ -310,8 +318,10 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
get_int(cfg->lib[i]->misc, instream); get_int(cfg->lib[i]->misc, instream);
for(j=0;j<1;j++) get_int(c,instream);
get_int(n,instream); /* 0x0000 */ cfg->lib[i]->vdir_name = c;
get_int(c,instream); /* 0x00 */
for(j=0;j<16;j++) for(j=0;j<16;j++)
get_int(n,instream); /* 0xffff */ get_int(n,instream); /* 0xffff */
...@@ -353,8 +363,19 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen) ...@@ -353,8 +363,19 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
cfg->lib[cfg->dir[i]->lib]->offline_dir=i; cfg->lib[cfg->dir[i]->lib]->offline_dir=i;
get_str(cfg->dir[i]->code_suffix,instream); get_str(cfg->dir[i]->code_suffix,instream);
cfg->dir[i]->vdir = cfg->dir[i]->code_suffix;
switch(cfg->lib[cfg->dir[i]->lib]->vdir_name) {
case VDIR_NAME_SHORT:
SAFECOPY(cfg->dir[i]->vdir, cfg->dir[i]->sname);
break;
case VDIR_NAME_LONG:
SAFECOPY(cfg->dir[i]->vdir, cfg->dir[i]->lname);
break;
default:
SAFECOPY(cfg->dir[i]->vdir, cfg->dir[i]->code_suffix);
break;
}
pathify(cfg->dir[i]->vdir);
get_str(cfg->dir[i]->data_dir,instream); get_str(cfg->dir[i]->data_dir,instream);
get_str(cfg->dir[i]->arstr,instream); get_str(cfg->dir[i]->arstr,instream);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment