From 6c25fbce927077384da510a98bd34631ca3d4963 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 7 Apr 2020 03:44:17 +0000 Subject: [PATCH] Allow settings for newly-imported sub-boards to be specified on the scfg command-line (uisng -misc=<value> in addition to -import=<filename>). The value can be decimal or 0x-prefixed hexadecimal, but you need to know the property bit-flag value (SUB_* in sbbsdefs.h). For use with init-fidonet.js --- src/sbbs3/scfg/scfg.c | 8 +++++++- src/sbbs3/scfg/scfg.h | 2 +- src/sbbs3/scfg/scfgmsg.c | 6 ++++-- src/sbbs3/scfg/scfgnet.c | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/sbbs3/scfg/scfg.c b/src/sbbs3/scfg/scfg.c index 2c433da3ef..b6038d48d0 100644 --- a/src/sbbs3/scfg/scfg.c +++ b/src/sbbs3/scfg/scfg.c @@ -185,6 +185,7 @@ int main(int argc, char **argv) const char* grpname = NULL; unsigned int grpnum = 0; faddr_t faddr = {0}; + uint32_t misc = 0; for(i=1;i<argc;i++) { if(argv[i][0]=='-' #ifndef __unix__ @@ -199,6 +200,10 @@ int main(int argc, char **argv) faddr = atofaddr(argv[i] + 7); continue; } + if(strncmp(argv[i], "-misc=", 6) == 0) { + misc = strtoul(argv[i] + 7, NULL, 0); + continue; + } if(strcmp(argv[i], "-insert") == 0) { uifc.insert_mode = TRUE; continue; @@ -298,6 +303,7 @@ int main(int argc, char **argv) "-e# = set escape delay to #msec\n" "-import=<filename> = import a message area list file\n" "-faddr=<addr> = specify your FTN address for imported subs\n" + "-misc=<value> = specify option flags for imported subs\n" "-g# = set group number (or name) to import into\n" "-iX = set interface mode to X (default=auto) where X is one of:\n" #ifdef __unix__ @@ -379,7 +385,7 @@ int main(int argc, char **argv) case msgbase: { enum import_list_type list_type = determine_msg_list_type(fname); - ported = import_msg_areas(list_type, fp, grpnum, 1, 99999, /* qhub: */NULL, /* pkt_orig: */NULL, &faddr, &added); + ported = import_msg_areas(list_type, fp, grpnum, 1, 99999, /* qhub: */NULL, /* pkt_orig: */NULL, &faddr, misc, &added); break; } case filebase: diff --git a/src/sbbs3/scfg/scfg.h b/src/sbbs3/scfg/scfg.h index 7317d5e391..baa4cc83a0 100644 --- a/src/sbbs3/scfg/scfg.h +++ b/src/sbbs3/scfg/scfg.h @@ -166,7 +166,7 @@ BOOL save_chat_cfg(scfg_t*, int); BOOL save_xtrn_cfg(scfg_t*, int); long import_msg_areas(enum import_list_type, FILE*, unsigned grpnum, int min_confnum, int max_confnum - , qhub_t*, const char* pkt_orig, faddr_t* faddr, long* added); + , qhub_t*, const char* pkt_orig, faddr_t* faddr, uint32_t misc, long* added); /* Prepare a string to be used as an internal code; Note: use the return value, Luke */ char* prep_code(char *str, const char* prefix); diff --git a/src/sbbs3/scfg/scfgmsg.c b/src/sbbs3/scfg/scfgmsg.c index 197a3d00f1..5ff8670c71 100644 --- a/src/sbbs3/scfg/scfgmsg.c +++ b/src/sbbs3/scfg/scfgmsg.c @@ -100,7 +100,7 @@ static bool new_grp(unsigned new_grpnum) // Return number of imported (including over-written) subs or negative on error long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum - , int min_confnum, int max_confnum, qhub_t* qhub, const char* pkt_orig, faddr_t* faddr + , int min_confnum, int max_confnum, qhub_t* qhub, const char* pkt_orig, faddr_t* faddr, uint32_t misc , long* added) { char str[256]; @@ -156,6 +156,7 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum new_sub_misc = SUB_FIDO; break; } + new_sub_misc |= misc; while(1) { memset(&tmpsub,0,sizeof(tmpsub)); @@ -1026,7 +1027,8 @@ void msgs_cfg() } uifc.pop("Importing Areas..."); long added = 0; - ported = import_msg_areas(k, stream, i, min_confnum, max_confnum, /* qhub: */NULL, pkt_orig, /* faddr: */NULL, &added); + ported = import_msg_areas(k, stream, i, min_confnum, max_confnum, /* qhub: */NULL + , pkt_orig, /* faddr: */NULL, /* misc: */0, &added); fclose(stream); uifc.pop(0); if(ported < 0) diff --git a/src/sbbs3/scfg/scfgnet.c b/src/sbbs3/scfg/scfgnet.c index 56c61dd57d..897e894a12 100644 --- a/src/sbbs3/scfg/scfgnet.c +++ b/src/sbbs3/scfg/scfgnet.c @@ -1261,7 +1261,7 @@ BOOL import_qwk_conferences(uint qhubnum) } uifc.pop("Importing Areas..."); long added = 0; - long ported = import_msg_areas(IMPORT_LIST_TYPE_QWK_CONTROL_DAT, fp, grpnum, min_confnum, max_confnum, cfg.qhub[qhubnum], /* pkt_orig */NULL, /* faddr: */NULL, &added); + long ported = import_msg_areas(IMPORT_LIST_TYPE_QWK_CONTROL_DAT, fp, grpnum, min_confnum, max_confnum, cfg.qhub[qhubnum], /* pkt_orig */NULL, /* faddr: */NULL, /* misc: */0, &added); fclose(fp); uifc.pop(NULL); if(ported < 0) -- GitLab