From a10cc665d204bab676a7c44e75ec44f2b7629a4b Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 31 Mar 2020 06:05:59 +0000 Subject: [PATCH] Add support -faddr=<address> option to specify your FTN address when importing message areas. If not specified, the address from the template sub will be used (if there is one), else the first specified system FTN AKA is used (as before). Removed a bunch of superfluous carriage-returns. Use the Copyright notice defined in sbbsdefs.h. --- src/sbbs3/scfg/scfg.c | 58 ++++++++++++++++++++++------------------ src/sbbs3/scfg/scfg.h | 2 +- src/sbbs3/scfg/scfgmsg.c | 6 +++-- src/sbbs3/scfg/scfgnet.c | 2 +- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/sbbs3/scfg/scfg.c b/src/sbbs3/scfg/scfg.c index fb52447bae..3b6df51fa2 100644 --- a/src/sbbs3/scfg/scfg.c +++ b/src/sbbs3/scfg/scfg.c @@ -73,7 +73,7 @@ char *num_flags= void allocfail(uint size) { - printf("\7Error allocating %u bytes of memory.\r\n",size); + printf("\7Error allocating %u bytes of memory.\n",size); bail(1); } @@ -170,8 +170,8 @@ int main(int argc, char **argv) BOOL door_mode=FALSE; int ciolib_mode=CIOLIB_MODE_AUTO; - printf("\r\nSynchronet Configuration Utility (%s) v%s Copyright %s " - "Rob Swindell\r\n",PLATFORM_DESC,VERSION,__DATE__+7); + printf("\nSynchronet Configuration Utility (%s) v%s " COPYRIGHT_NOTICE + "\n",PLATFORM_DESC,VERSION); xp_randomize(); cfg.size=sizeof(cfg); @@ -184,6 +184,7 @@ int main(int argc, char **argv) const char* import = NULL; const char* grpname = NULL; unsigned int grpnum = 0; + faddr_t faddr = {0}; for(i=1;i<argc;i++) { if(argv[i][0]=='-' #ifndef __unix__ @@ -194,6 +195,10 @@ int main(int argc, char **argv) import = argv[i] + 8; continue; } + if(strncmp(argv[i]+1, "faddr=", 6) == 0) { + faddr = atofaddr(argv[i] + 6); + continue; + } if(strcmp(argv[i]+1, "insert") == 0) { uifc.insert_mode = TRUE; continue; @@ -213,7 +218,7 @@ int main(int argc, char **argv) uifc.mode|=UIFC_COLOR; break; case 'D': - printf("NOTICE: The -d option is deprecated, use -id instead\r\n"); + printf("NOTICE: The -d option is deprecated, use -id instead\n"); SLEEP(2000); door_mode=TRUE; break; @@ -283,30 +288,31 @@ int main(int argc, char **argv) USAGE: printf("\nusage: scfg [ctrl_dir] [options]" "\n\noptions:\n\n" - "-f = force save of configuration files\r\n" - "-a = update all message base status headers\r\n" - "-h = don't update message base status headers\r\n" + "-f = force save of configuration files\n" + "-a = update all message base status headers\n" + "-h = don't update message base status headers\n" "-u# = set file creation permissions mask (in octal)\n" - "-k = keyboard mode only (no mouse support)\r\n" - "-c = force color mode\r\n" - "-m = force monochrome mode\r\n" - "-e# = set escape delay to #msec\r\n" - "-import=<filename> = import a message area list file\r\n" - "-g# = set group number (or name) to import into\r\n" - "-iX = set interface mode to X (default=auto) where X is one of:\r\n" + "-k = keyboard mode only (no mouse support)\n" + "-c = force color mode\n" + "-m = force monochrome mode\n" + "-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" + "-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__ - " X = X11 mode\r\n" - " C = Curses mode\r\n" - " F = Curses mode with forced IBM charset\r\n" + " X = X11 mode\n" + " C = Curses mode\n" + " F = Curses mode with forced IBM charset\n" #else - " W = Win32 native mode\r\n" + " W = Win32 native mode\n" #endif - " A = ANSI mode\r\n" - " D = standard input/output/door mode\r\n" - "-v# = set video mode to # (default=auto)\r\n" - "-l# = set screen lines to # (default=auto-detect)\r\n" - "-b# = set automatic back-up level (default=%d)\r\n" - "-y = automatically save changes (don't ask)\r\n" + " A = ANSI mode\n" + " D = standard input/output/door mode\n" + "-v# = set video mode to # (default=auto)\n" + "-l# = set screen lines to # (default=auto-detect)\n" + "-b# = set automatic back-up level (default=%d)\n" + "-y = automatically save changes (don't ask)\n" ,backup_level ); exit(0); @@ -373,7 +379,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, &added); + ported = import_msg_areas(list_type, fp, grpnum, 1, 99999, /* qhub: */NULL, /* pkt_orig: */NULL, &faddr, &added); break; } case filebase: @@ -440,7 +446,7 @@ int main(int argc, char **argv) sprintf(str,"Synchronet for %s v%s",PLATFORM_DESC,VERSION); if(uifc.scrn(str)) { - printf(" USCRN (len=%d) failed!\r\n",uifc.scrn_len+1); + printf(" USCRN (len=%d) failed!\n",uifc.scrn_len+1); bail(1); } diff --git a/src/sbbs3/scfg/scfg.h b/src/sbbs3/scfg/scfg.h index d30970356e..7317d5e391 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, long* added); + , qhub_t*, const char* pkt_orig, faddr_t* faddr, 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 1c16d22d89..197a3d00f1 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 + , int min_confnum, int max_confnum, qhub_t* qhub, const char* pkt_orig, faddr_t* faddr , long* added) { char str[256]; @@ -421,6 +421,8 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum if(tmpsub.data_dir[0]) SAFECOPY(cfg.sub[j]->data_dir,tmpsub.data_dir); } + if(faddr != NULL && faddr->zone) + cfg.sub[j]->faddr = *faddr; if(qhub != NULL) new_qhub_sub(qhub, qhub->subs, cfg.sub[j], qwk_confnum); ported++; @@ -1024,7 +1026,7 @@ 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, &added); + ported = import_msg_areas(k, stream, i, min_confnum, max_confnum, /* qhub: */NULL, pkt_orig, /* faddr: */NULL, &added); fclose(stream); uifc.pop(0); if(ported < 0) diff --git a/src/sbbs3/scfg/scfgnet.c b/src/sbbs3/scfg/scfgnet.c index 54d4bfe8e6..56c61dd57d 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, &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, &added); fclose(fp); uifc.pop(NULL); if(ported < 0) -- GitLab