|
|
1.1.1.2 ! root 1: /* echocfg.c */ ! 2: ! 3: /* SBBSecho configuration utility */ ! 4: ! 5: /* $Id: echocfg.c,v 1.22 2011/07/20 02:40:37 rswindell Exp $ */ ! 6: ! 7: /**************************************************************************** ! 8: * @format.tab-size 4 (Plain Text/Source Code File Header) * ! 9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * ! 10: * * ! 11: * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * ! 12: * * ! 13: * This program is free software; you can redistribute it and/or * ! 14: * modify it under the terms of the GNU General Public License * ! 15: * as published by the Free Software Foundation; either version 2 * ! 16: * of the License, or (at your option) any later version. * ! 17: * See the GNU General Public License for more details: gpl.txt or * ! 18: * http://www.fsf.org/copyleft/gpl.html * ! 19: * * ! 20: * Anonymous FTP access to the most recent released source is available at * ! 21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * ! 22: * * ! 23: * Anonymous CVS access to the development source and modification history * ! 24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: * ! 25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login * ! 26: * (just hit return, no password is necessary) * ! 27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src * ! 28: * * ! 29: * For Synchronet coding style and modification guidelines, see * ! 30: * http://www.synchro.net/source.html * ! 31: * * ! 32: * You are encouraged to submit any modifications (preferably in Unix diff * ! 33: * format) via e-mail to [email protected] * ! 34: * * ! 35: * Note: If this box doesn't appear square, then you need to fix your tabs. * ! 36: ****************************************************************************/ ! 37: ! 38: /* Portions written by Allen Christiansen 1994-1996 */ ! 39: ! 40: #include <stdio.h> ! 41: ! 42: #undef JAVASCRIPT ! 43: ! 44: /* XPDEV Headers */ ! 45: #include "gen_defs.h" ! 46: ! 47: #define __COLORS ! 48: #include "ciolib.h" ! 49: #include "uifc.h" ! 50: #include "sbbs.h" ! 51: #include "sbbsecho.h" ! 52: ! 53: char **opt; ! 54: ! 55: /* Declaration removed... why? ToDo */ ! 56: /* void uifc.bail(int code); */ ! 57: int main(); ! 58: ! 59: long misc=0; ! 60: config_t cfg; ! 61: ! 62: unsigned _stklen=16000; ! 63: ! 64: uifcapi_t uifc; ! 65: ! 66: void bail(int code) ! 67: { ! 68: ! 69: if(uifc.bail!=NULL) ! 70: uifc.bail(); ! 71: exit(code); ! 72: } ! 73: ! 74: /****************************************************************************/ ! 75: /* Returns an ASCII string for FidoNet address 'addr' */ ! 76: /****************************************************************************/ ! 77: char *wcfaddrtoa(faddr_t* addr) ! 78: { ! 79: static char str[25]; ! 80: char tmp[25]; ! 81: ! 82: str[0]=0; ! 83: if(addr->zone==0xffff) ! 84: strcpy(str,"ALL"); ! 85: else if(addr->zone) { ! 86: sprintf(str,"%u:",addr->zone); ! 87: if(addr->net==0xffff) ! 88: strcat(str,"ALL"); ! 89: else { ! 90: sprintf(tmp,"%u/",addr->net); ! 91: strcat(str,tmp); ! 92: if(addr->node==0xffff) ! 93: strcat(str,"ALL"); ! 94: else { ! 95: sprintf(tmp,"%u",addr->node); ! 96: strcat(str,tmp); ! 97: if(addr->point==0xffff) ! 98: strcat(str,".ALL"); ! 99: else if(addr->point) { ! 100: sprintf(tmp,".%u",addr->point); ! 101: strcat(str,tmp); ! 102: } ! 103: } ! 104: } ! 105: } ! 106: return(str); ! 107: } ! 108: ! 109: /* These correlate with the LOG_* definitions in syslog.h/gen_defs.h */ ! 110: static char* logLevelStringList[] ! 111: = {"Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Informational", "Debugging", NULL}; ! 112: ! 113: int main(int argc, char **argv) ! 114: { ! 115: char str[256],*p; ! 116: int i,j,k,x,dflt,nodeop=0; ! 117: FILE *stream; ! 118: echolist_t savlistcfg; ! 119: nodecfg_t savnodecfg; ! 120: arcdef_t savarcdef; ! 121: BOOL door_mode=FALSE; ! 122: int ciolib_mode=CIOLIB_MODE_AUTO; ! 123: ! 124: fprintf(stderr,"\nSBBSecho Configuration Version %s Copyright 2003 " ! 125: "Rob Swindell\n\n",SBBSECHO_VER); ! 126: ! 127: memset(&cfg,0,sizeof(config_t)); ! 128: str[0]=0; ! 129: for(i=1;i<argc;i++) { ! 130: if(argv[i][0]=='-') ! 131: switch(toupper(argv[i][1])) { ! 132: case 'D': ! 133: printf("NOTICE: The -d option is depreciated, use -id instead\r\n"); ! 134: SLEEP(2000); ! 135: door_mode=TRUE; ! 136: break; ! 137: case 'L': ! 138: uifc.scrn_len=atoi(argv[i]+2); ! 139: break; ! 140: case 'E': ! 141: uifc.esc_delay=atoi(argv[i]+2); ! 142: break; ! 143: case 'I': ! 144: switch(toupper(argv[i][2])) { ! 145: case 'A': ! 146: ciolib_mode=CIOLIB_MODE_ANSI; ! 147: break; ! 148: case 'C': ! 149: ciolib_mode=CIOLIB_MODE_CURSES; ! 150: break; ! 151: case 0: ! 152: printf("NOTICE: The -i option is depreciated, use -if instead\r\n"); ! 153: SLEEP(2000); ! 154: case 'F': ! 155: ciolib_mode=CIOLIB_MODE_CURSES_IBM; ! 156: break; ! 157: case 'X': ! 158: ciolib_mode=CIOLIB_MODE_X; ! 159: break; ! 160: case 'W': ! 161: ciolib_mode=CIOLIB_MODE_CONIO; ! 162: break; ! 163: case 'D': ! 164: door_mode=TRUE; ! 165: break; ! 166: default: ! 167: goto USAGE; ! 168: } ! 169: break; ! 170: case 'M': /* Monochrome mode */ ! 171: uifc.mode|=UIFC_MONO; ! 172: break; ! 173: case 'C': ! 174: uifc.mode|=UIFC_COLOR; ! 175: break; ! 176: case 'V': ! 177: textmode(atoi(argv[i]+2)); ! 178: break; ! 179: default: ! 180: USAGE: ! 181: printf("\nusage: echocfg [ctrl_dir] [options]" ! 182: "\n\noptions:\n\n" ! 183: "-c = force color mode\r\n" ! 184: "-m = force monochrome mode\r\n" ! 185: "-e# = set escape delay to #msec\r\n" ! 186: "-iX = set interface mode to X (default=auto) where X is one of:\r\n" ! 187: #ifdef __unix__ ! 188: " X = X11 mode\r\n" ! 189: " C = Curses mode\r\n" ! 190: " F = Curses mode with forced IBM charset\r\n" ! 191: #else ! 192: " W = Win32 native mode\r\n" ! 193: #endif ! 194: " A = ANSI mode\r\n" ! 195: " D = standard input/output/door mode\r\n" ! 196: "-v# = set video mode to # (default=auto)\r\n" ! 197: "-l# = set screen lines to # (default=auto-detect)\r\n" ! 198: ); ! 199: exit(0); ! 200: } ! 201: else ! 202: strcpy(str,argv[1]); ! 203: } ! 204: if(str[0]==0) { ! 205: p=getenv("SBBSCTRL"); ! 206: if(!p) { ! 207: p=getenv("SBBSNODE"); ! 208: if(!p) { ! 209: printf("usage: echocfg [cfg_file]\n"); ! 210: exit(1); } ! 211: strcpy(str,p); ! 212: backslash(str); ! 213: strcat(str,"../ctrl/sbbsecho.cfg"); } ! 214: else { ! 215: strcpy(str,p); ! 216: backslash(str); ! 217: strcat(str,"sbbsecho.cfg"); ! 218: } ! 219: } ! 220: strcpy(cfg.cfgfile,str); ! 221: ! 222: read_echo_cfg(); ! 223: ! 224: // savnum=0; ! 225: if((opt=(char **)malloc(sizeof(char *)*300))==NULL) { ! 226: uifc.bail(); ! 227: puts("memory allocation error\n"); ! 228: exit(1); ! 229: } ! 230: for(i=0;i<300;i++) ! 231: if((opt[i]=(char *)malloc(MAX_OPLN))==NULL) { ! 232: uifc.bail(); ! 233: puts("memory allocation error\n"); ! 234: exit(1); ! 235: } ! 236: uifc.size=sizeof(uifc); ! 237: if(!door_mode) { ! 238: i=initciolib(ciolib_mode); ! 239: if(i!=0) { ! 240: printf("ciolib library init returned error %d\n",i); ! 241: exit(1); ! 242: } ! 243: i=uifcini32(&uifc); /* curses/conio/X/ANSI */ ! 244: } ! 245: else ! 246: i=uifcinix(&uifc); /* stdio */ ! 247: ! 248: if(i!=0) { ! 249: printf("uifc library init returned error %d\n",i); ! 250: exit(1); ! 251: } ! 252: ! 253: sprintf(str,"SBBSecho Configuration v%s",SBBSECHO_VER); ! 254: uifc.scrn(str); ! 255: ! 256: dflt=0; ! 257: while(1) { ! 258: uifc.helpbuf= ! 259: "~ SBBSecho Configuration ~\r\n\r\n" ! 260: "Move through the various options using the arrow keys. Select the\r\n" ! 261: "highlighted options by pressing ENTER.\r\n\r\n"; ! 262: i=0; ! 263: sprintf(opt[i++],"%-30.30s %s","Mailer Type" ! 264: ,misc&FLO_MAILER ? "Binkley/FLO":"FrontDoor/Attach"); ! 265: sprintf(opt[i++],"%-30.30s %luK","Maximum Packet Size" ! 266: ,cfg.maxpktsize/1024UL); ! 267: sprintf(opt[i++],"%-30.30s %luK","Maximum Bundle Size" ! 268: ,cfg.maxbdlsize/1024UL); ! 269: if(cfg.notify) ! 270: sprintf(str,"User #%u",cfg.notify); ! 271: else ! 272: strcpy(str,"Disabled"); ! 273: sprintf(opt[i++],"%-30.30s %s","Areafix Failure Notification",str); ! 274: sprintf(opt[i++],"Nodes..."); ! 275: sprintf(opt[i++],"Paths..."); ! 276: sprintf(opt[i++],"%-30.30s %s","Log Level",logLevelStringList[cfg.log_level]); ! 277: sprintf(opt[i++],"Log Options..."); ! 278: sprintf(opt[i++],"Toggle Options..."); ! 279: sprintf(opt[i++],"Archive Programs..."); ! 280: sprintf(opt[i++],"Additional Echo Lists..."); ! 281: opt[i][0]=0; ! 282: switch(uifc.list(WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,0,0,52,&dflt,0 ! 283: ,cfg.cfgfile,opt)) { ! 284: ! 285: case 0: ! 286: misc^=FLO_MAILER; ! 287: break; ! 288: ! 289: case 1: ! 290: uifc.helpbuf= ! 291: "~ Maximum Packet Size ~\r\n\r\n" ! 292: "This is the maximum file size that SBBSecho will create when placing\r\n" ! 293: "outgoing messages into packets. The default size is 250k.\r\n"; ! 294: sprintf(str,"%lu",cfg.maxpktsize); ! 295: uifc.input(WIN_MID|WIN_BOT,0,0,"Maximum Packet Size",str ! 296: ,9,K_EDIT|K_NUMBER); ! 297: cfg.maxpktsize=atol(str); ! 298: break; ! 299: ! 300: case 2: ! 301: uifc.helpbuf= ! 302: "~ Maximum Bundle Size ~\r\n\r\n" ! 303: "This is the maximum file size that SBBSecho will create when placing\r\n" ! 304: "outgoing packets into bundles. The default size is 250k.\r\n"; ! 305: sprintf(str,"%lu",cfg.maxbdlsize); ! 306: uifc.input(WIN_MID|WIN_BOT,0,0,"Maximum Bundle Size",str ! 307: ,9,K_EDIT|K_NUMBER); ! 308: cfg.maxbdlsize=atol(str); ! 309: break; ! 310: ! 311: case 3: ! 312: uifc.helpbuf= ! 313: "~ Areafix Failure Notification ~\r\n\r\n" ! 314: "Setting this option to a user number (usually #1), enables the\r\n" ! 315: "automatic notification of that user, via e-mail, of failed areafix\r\n" ! 316: "attempts. Setting this option to 0, disables this feature.\r\n"; ! 317: sprintf(str,"%u",cfg.notify); ! 318: uifc.input(WIN_MID|WIN_BOT,0,0,"Areafix Notification User Number",str ! 319: ,5,K_EDIT|K_NUMBER); ! 320: cfg.notify=atoi(str); ! 321: break; ! 322: ! 323: case 4: ! 324: uifc.helpbuf= ! 325: "~ Nodes... ~\r\n\r\n" ! 326: "From this menu you can configure the area manager options for your\r\n" ! 327: "uplink nodes.\r\n"; ! 328: i=0; ! 329: while(1) { ! 330: for(j=0;j<cfg.nodecfgs;j++) ! 331: strcpy(opt[j],wcfaddrtoa(&cfg.nodecfg[j].faddr)); ! 332: opt[j][0]=0; ! 333: i=uifc.list(WIN_ORG|WIN_INS|WIN_DEL|WIN_ACT|WIN_GET|WIN_PUT ! 334: |WIN_INSACT|WIN_DELACT|WIN_XTR ! 335: ,0,0,0,&i,0,"Nodes",opt); ! 336: if(i==-1) ! 337: break; ! 338: if((i&MSK_ON)==MSK_INS) { ! 339: i&=MSK_OFF; ! 340: str[0]=0; ! 341: uifc.helpbuf= ! 342: "~ Address ~\r\n\r\n" ! 343: "This is the FidoNet style address of the node you wish to add\r\n"; ! 344: if(uifc.input(WIN_MID,0,0 ! 345: ,"Node Address (ALL wildcard allowed)",str ! 346: ,25,K_EDIT)<1) ! 347: continue; ! 348: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 349: ,sizeof(nodecfg_t)*(cfg.nodecfgs+1)))==NULL) { ! 350: printf("\nMemory Allocation Error\n"); ! 351: exit(1); } ! 352: for(j=cfg.nodecfgs;j>i;j--) ! 353: memcpy(&cfg.nodecfg[j],&cfg.nodecfg[j-1] ! 354: ,sizeof(nodecfg_t)); ! 355: cfg.nodecfgs++; ! 356: memset(&cfg.nodecfg[i],0,sizeof(nodecfg_t)); ! 357: cfg.nodecfg[i].faddr=atofaddr(str); ! 358: continue; } ! 359: ! 360: if((i&MSK_ON)==MSK_DEL) { ! 361: i&=MSK_OFF; ! 362: cfg.nodecfgs--; ! 363: if(cfg.nodecfgs<=0) { ! 364: cfg.nodecfgs=0; ! 365: continue; } ! 366: for(j=i;j<cfg.nodecfgs;j++) ! 367: memcpy(&cfg.nodecfg[j],&cfg.nodecfg[j+1] ! 368: ,sizeof(nodecfg_t)); ! 369: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg ! 370: ,sizeof(nodecfg_t)*(cfg.nodecfgs)))==NULL) { ! 371: printf("\nMemory Allocation Error\n"); ! 372: exit(1); } ! 373: continue; } ! 374: if((i&MSK_ON)==MSK_GET) { ! 375: i&=MSK_OFF; ! 376: memcpy(&savnodecfg,&cfg.nodecfg[i],sizeof(nodecfg_t)); ! 377: continue; } ! 378: if((i&MSK_ON)==MSK_PUT) { ! 379: i&=MSK_OFF; ! 380: memcpy(&cfg.nodecfg[i],&savnodecfg,sizeof(nodecfg_t)); ! 381: continue; } ! 382: while(1) { ! 383: uifc.helpbuf= ! 384: "~ Node Options ~\r\n\r\n" ! 385: "These are the configurable options available for this node.\r\n"; ! 386: j=0; ! 387: sprintf(opt[j++],"%-20.20s %s","Address" ! 388: ,wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 389: sprintf(opt[j++],"%-20.20s %s","Archive Type" ! 390: ,cfg.nodecfg[i].arctype>cfg.arcdefs ? ! 391: "None":cfg.arcdef[cfg.nodecfg[i].arctype].name); ! 392: sprintf(opt[j++],"%-20.20s %s","Packet Type" ! 393: ,cfg.nodecfg[i].pkt_type==PKT_TWO ? "2" ! 394: :cfg.nodecfg[i].pkt_type==PKT_TWO_TWO ? "2.2":"2+"); ! 395: sprintf(opt[j++],"%-20.20s %s","Packet Password" ! 396: ,cfg.nodecfg[i].pktpwd); ! 397: sprintf(opt[j++],"%-20.20s %s","Areafix Password" ! 398: ,cfg.nodecfg[i].password); ! 399: str[0]=0; ! 400: for(k=0;k<cfg.nodecfg[i].numflags;k++) { ! 401: strcat(str,cfg.nodecfg[i].flag[k].flag); ! 402: strcat(str," "); } ! 403: sprintf(opt[j++],"%-20.20s %s","Areafix Flags",str); ! 404: sprintf(opt[j++],"%-20.20s %s","Status" ! 405: ,cfg.nodecfg[i].attr&ATTR_CRASH ? "Crash" ! 406: :cfg.nodecfg[i].attr&ATTR_HOLD ? "Hold" : "None"); ! 407: sprintf(opt[j++],"%-20.20s %s","Direct" ! 408: ,cfg.nodecfg[i].attr&ATTR_DIRECT ? "Yes":"No"); ! 409: sprintf(opt[j++],"%-20.20s %s","Passive" ! 410: ,cfg.nodecfg[i].attr&ATTR_PASSIVE ? "Yes":"No"); ! 411: sprintf(opt[j++],"%-20.20s %s","Send Notify List" ! 412: ,cfg.nodecfg[i].attr&SEND_NOTIFY ? "Yes" : "No"); ! 413: if(misc&FLO_MAILER) ! 414: sprintf(opt[j++],"%-20.20s %s","Route To" ! 415: ,cfg.nodecfg[i].route.zone ! 416: ? wcfaddrtoa(&cfg.nodecfg[i].route) : "Disabled"); ! 417: opt[j][0]=0; ! 418: k=uifc.list(WIN_MID|WIN_ACT,0,0,40,&nodeop,0 ! 419: ,wcfaddrtoa(&cfg.nodecfg[i].faddr),opt); ! 420: if(k==-1) ! 421: break; ! 422: switch(k) { ! 423: case 0: ! 424: uifc.helpbuf= ! 425: "~ Address ~\r\n\r\n" ! 426: "This is the FidoNet style address of this node.\r\n"; ! 427: strcpy(str,wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 428: uifc.input(WIN_MID|WIN_SAV,0,0 ! 429: ,"Node Address (ALL wildcard allowed)",str ! 430: ,25,K_EDIT|K_UPPER); ! 431: cfg.nodecfg[i].faddr=atofaddr(str); ! 432: break; ! 433: case 1: ! 434: uifc.helpbuf= ! 435: "~ Archive Type ~\r\n\r\n" ! 436: "This is the compression type that will be used for compressing packets\r\n" ! 437: "to and decompressing packets from this node.\r\n"; ! 438: for(j=0;j<cfg.arcdefs;j++) ! 439: strcpy(opt[j],cfg.arcdef[j].name); ! 440: strcpy(opt[j++],"None"); ! 441: opt[j][0]=0; ! 442: if(cfg.nodecfg[i].arctype<j) ! 443: j=cfg.nodecfg[i].arctype; ! 444: k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&j,0 ! 445: ,"Archive Type",opt); ! 446: if(k==-1) ! 447: break; ! 448: if(k>=cfg.arcdefs) ! 449: cfg.nodecfg[i].arctype=0xffff; ! 450: else ! 451: cfg.nodecfg[i].arctype=k; ! 452: break; ! 453: case 2: ! 454: uifc.helpbuf= ! 455: "~ Packet Type ~\r\n\r\n" ! 456: "This is the packet header type that will be used in mail packets to\r\n" ! 457: "this node. SBBSecho defaults to using type 2.2.\r\n"; ! 458: j=0; ! 459: strcpy(opt[j++],"2+"); ! 460: strcpy(opt[j++],"2.2"); ! 461: strcpy(opt[j++],"2"); ! 462: opt[j][0]=0; ! 463: j=cfg.nodecfg[i].pkt_type; ! 464: k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&j,0,"Packet Type" ! 465: ,opt); ! 466: if(k==-1) ! 467: break; ! 468: cfg.nodecfg[i].pkt_type=k; ! 469: break; ! 470: case 3: ! 471: uifc.helpbuf= ! 472: "~ Packet Password ~\r\n\r\n" ! 473: "This is an optional password that SBBSecho will place into packets\r\n" ! 474: "destined for this node.\r\n"; ! 475: uifc.input(WIN_MID|WIN_SAV,0,0 ! 476: ,"Packet Password (optional)" ! 477: ,cfg.nodecfg[i].pktpwd,8,K_EDIT|K_UPPER); ! 478: break; ! 479: case 4: ! 480: uifc.helpbuf= ! 481: "~ Areafix Password ~\r\n\r\n" ! 482: "This is the password that will be used by this node when doing remote\r\n" ! 483: "areamanager functions.\r\n"; ! 484: uifc.input(WIN_MID|WIN_SAV,0,0 ! 485: ,"Areafix Password" ! 486: ,cfg.nodecfg[i].password,8,K_EDIT|K_UPPER); ! 487: break; ! 488: case 5: ! 489: uifc.helpbuf= ! 490: "~ Areafix Flag ~\r\n\r\n" ! 491: "This is a flag to to be given to this node allowing access to one or\r\n" ! 492: "more of the configured echo lists\r\n"; ! 493: while(1) { ! 494: for(j=0;j<cfg.nodecfg[i].numflags;j++) ! 495: strcpy(opt[j],cfg.nodecfg[i].flag[j].flag); ! 496: opt[j][0]=0; ! 497: k=uifc.list(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT| ! 498: WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT ! 499: ,0,0,0,&k,0,"Areafix Flags",opt); ! 500: if(k==-1) ! 501: break; ! 502: if((k&MSK_ON)==MSK_INS) { ! 503: k&=MSK_OFF; ! 504: str[0]=0; ! 505: if(uifc.input(WIN_MID|WIN_SAV,0,0 ! 506: ,"Areafix Flag",str,4 ! 507: ,K_EDIT|K_UPPER)<1) ! 508: continue; ! 509: if((cfg.nodecfg[i].flag=(flag_t *) ! 510: realloc(cfg.nodecfg[i].flag ! 511: ,sizeof(flag_t)* ! 512: (cfg.nodecfg[i].numflags+1)))==NULL) { ! 513: printf("\nMemory Allocation Error\n"); ! 514: exit(1); } ! 515: for(j=cfg.nodecfg[i].numflags;j>i;j--) ! 516: memcpy(&cfg.nodecfg[i].flag[j] ! 517: ,&cfg.nodecfg[i].flag[j-1] ! 518: ,sizeof(flag_t)); ! 519: cfg.nodecfg[i].numflags++; ! 520: memset(&cfg.nodecfg[i].flag[k].flag ! 521: ,0,sizeof(flag_t)); ! 522: strcpy(cfg.nodecfg[i].flag[k].flag,str); ! 523: continue; } ! 524: ! 525: if((k&MSK_ON)==MSK_DEL) { ! 526: k&=MSK_OFF; ! 527: cfg.nodecfg[i].numflags--; ! 528: if(cfg.nodecfg[i].numflags<=0) { ! 529: cfg.nodecfg[i].numflags=0; ! 530: continue; } ! 531: for(j=k;j<cfg.nodecfg[i].numflags;j++) ! 532: strcpy(cfg.nodecfg[i].flag[j].flag ! 533: ,cfg.nodecfg[i].flag[j+1].flag); ! 534: if((cfg.nodecfg[i].flag=(flag_t *) ! 535: realloc(cfg.nodecfg[i].flag ! 536: ,sizeof(flag_t)* ! 537: (cfg.nodecfg[i].numflags)))==NULL) { ! 538: printf("\nMemory Allocation Error\n"); ! 539: exit(1); } ! 540: continue; } ! 541: strcpy(str,cfg.nodecfg[i].flag[k].flag); ! 542: uifc.input(WIN_MID|WIN_SAV,0,0,"Areafix Flag" ! 543: ,str,4,K_EDIT|K_UPPER); ! 544: strcpy(cfg.nodecfg[i].flag[k].flag,str); ! 545: continue; } ! 546: break; ! 547: case 6: ! 548: if(cfg.nodecfg[i].attr&ATTR_CRASH) { ! 549: cfg.nodecfg[i].attr^=ATTR_CRASH; ! 550: cfg.nodecfg[i].attr|=ATTR_HOLD; ! 551: break; } ! 552: if(cfg.nodecfg[i].attr&ATTR_HOLD) { ! 553: cfg.nodecfg[i].attr^=ATTR_HOLD; ! 554: break; } ! 555: cfg.nodecfg[i].attr|=ATTR_CRASH; ! 556: break; ! 557: case 7: ! 558: cfg.nodecfg[i].attr^=ATTR_DIRECT; ! 559: break; ! 560: case 8: ! 561: cfg.nodecfg[i].attr^=ATTR_PASSIVE; ! 562: break; ! 563: case 9: ! 564: cfg.nodecfg[i].attr^=SEND_NOTIFY; ! 565: break; ! 566: case 10: ! 567: uifc.helpbuf= ! 568: "~ Route To ~\r\n\r\n" ! 569: "When using a FLO type mailer, this is the node number of an address\r\n" ! 570: "to route mail to for this node.\r\n"; ! 571: strcpy(str,wcfaddrtoa(&cfg.nodecfg[i].route)); ! 572: uifc.input(WIN_MID|WIN_SAV,0,0 ! 573: ,"Node Address to Route To",str ! 574: ,25,K_EDIT); ! 575: if(str[0]) ! 576: cfg.nodecfg[i].route=atofaddr(str); ! 577: else ! 578: cfg.nodecfg[i].route.zone=0; ! 579: break; ! 580: } } } ! 581: break; ! 582: ! 583: case 5: ! 584: uifc.helpbuf= ! 585: "~ Paths... ~\r\n\r\n" ! 586: "From this menu you can configure the paths that SBBSecho will use\r\n" ! 587: "when importing and exporting.\r\n"; ! 588: j=0; ! 589: while(1) { ! 590: i=0; ! 591: sprintf(opt[i++],"%-30.30s %s","Inbound Directory" ! 592: ,cfg.inbound[0] ? cfg.inbound : "<Specified in SCFG>"); ! 593: sprintf(opt[i++],"%-30.30s %s","Secure Inbound (optional)" ! 594: ,cfg.secure[0] ? cfg.secure : "None Specified"); ! 595: sprintf(opt[i++],"%-30.30s %s","Outbound Directory" ! 596: ,cfg.outbound); ! 597: sprintf(opt[i++],"%-30.30s %s","Area File" ! 598: ,cfg.areafile[0] ? cfg.areafile ! 599: : "SCFG->data/areas.bbs"); ! 600: sprintf(opt[i++],"%-30.30s %s","Log File" ! 601: ,cfg.logfile[0] ? cfg.logfile ! 602: : "SCFG->data/sbbsecho.log"); ! 603: opt[i][0]=0; ! 604: j=uifc.list(WIN_MID|WIN_ACT,0,0,60,&j,0 ! 605: ,"Paths and Filenames",opt); ! 606: if(j==-1) ! 607: break; ! 608: switch(j) { ! 609: case 0: ! 610: uifc.helpbuf= ! 611: "~ Inbound Directory ~\r\n\r\n" ! 612: "This is the complete path (drive and directory) where your front\r\n" ! 613: "end mailer stores, and where SBBSecho will look for, incoming message\r\n" ! 614: "bundles and packets."; ! 615: uifc.input(WIN_MID|WIN_SAV,0,0,"Inbound",cfg.inbound ! 616: ,50,K_EDIT); ! 617: break; ! 618: ! 619: case 1: ! 620: uifc.helpbuf= ! 621: "~ Secure Inbound Directory ~\r\n\r\n" ! 622: "This is the complete path (drive and directory) where your front\r\n" ! 623: "end mailer stores, and where SBBSecho will look for, incoming message\r\n" ! 624: "bundles and packets for SECURE sessions."; ! 625: uifc.input(WIN_MID|WIN_SAV,0,0,"Secure Inbound",cfg.secure ! 626: ,50,K_EDIT); ! 627: break; ! 628: ! 629: case 2: ! 630: uifc.helpbuf= ! 631: "~ Outbound Directory ~\r\n\r\n" ! 632: "This is the complete path (drive and directory) where your front\r\n" ! 633: "end mailer will look for, and where SBBSecho will place, outgoing\r\n" ! 634: "message bundles and packets."; ! 635: uifc.input(WIN_MID|WIN_SAV,0,0,"Outbound",cfg.outbound ! 636: ,50,K_EDIT); ! 637: break; ! 638: ! 639: case 3: ! 640: uifc.helpbuf= ! 641: "~ Area File ~\r\n\r\n" ! 642: "This is the complete path (drive, directory, and filename) of the\r\n" ! 643: "file SBBSecho will use as your AREAS.BBS file."; ! 644: uifc.input(WIN_MID|WIN_SAV,0,0,"Areafile",cfg.areafile ! 645: ,50,K_EDIT); ! 646: break; ! 647: ! 648: case 4: ! 649: uifc.helpbuf= ! 650: "~ Log File ~\r\n\r\n" ! 651: "This is the complete path (drive, directory, and filename) of the\r\n" ! 652: "file SBBSecho will use to log information each time it is run."; ! 653: uifc.input(WIN_MID|WIN_SAV,0,0,"Logfile",cfg.logfile ! 654: ,50,K_EDIT); ! 655: break; } } ! 656: break; ! 657: case 6: ! 658: uifc.helpbuf= ! 659: "~ Log Level ~\r\n" ! 660: "\r\n" ! 661: "Select the minimum severity of log entries to be logged to the log file."; ! 662: j=cfg.log_level; ! 663: i=uifc.list(WIN_MID,0,0,0,&j,0,"Log Level",logLevelStringList); ! 664: if(i>=0 && i<=LOG_DEBUG) ! 665: cfg.log_level=i; ! 666: break; ! 667: case 7: ! 668: uifc.helpbuf= ! 669: "~ Log Options ~\r\n" ! 670: "\r\n" ! 671: "Each loggable item can be toggled off or on from this menu. You must run\r\n" ! 672: "`SBBSecho` with the `/L` command line option for any of these items to be\r\n" ! 673: "logged."; ! 674: j=0; ! 675: while(1) { ! 676: i=0; ! 677: strcpy(opt[i++],"ALL"); ! 678: strcpy(opt[i++],"NONE"); ! 679: strcpy(opt[i++],"DEFAULT"); ! 680: sprintf(opt[i++],"%-35.35s%-3.3s","Ignored NetMail Messages" ! 681: ,cfg.log&LOG_IGNORED ? "Yes":"No"); ! 682: sprintf(opt[i++],"%-35.35s%-3.3s","NetMail for Unknown Users" ! 683: ,cfg.log&LOG_UNKNOWN ? "Yes":"No"); ! 684: sprintf(opt[i++],"%-35.35s%-3.3s","Areafix NetMail Messages" ! 685: ,cfg.log&LOG_AREAFIX ? "Yes":"No"); ! 686: sprintf(opt[i++],"%-35.35s%-3.3s","Imported NetMail Messages" ! 687: ,cfg.log&LOG_IMPORTED ? "Yes":"No"); ! 688: sprintf(opt[i++],"%-35.35s%-3.3s","Packing Out-bound NetMail" ! 689: ,cfg.log&LOG_PACKING ? "Yes":"No"); ! 690: sprintf(opt[i++],"%-35.35s%-3.3s","Routing Out-bound NetMail" ! 691: ,cfg.log&LOG_ROUTING ? "Yes":"No"); ! 692: sprintf(opt[i++],"%-35.35s%-3.3s","In-bound Packet Information" ! 693: ,cfg.log&LOG_PACKETS ? "Yes":"No"); ! 694: sprintf(opt[i++],"%-35.35s%-3.3s","In-bound Security Violations" ! 695: ,cfg.log&LOG_SECURE ? "Yes":"No"); ! 696: sprintf(opt[i++],"%-35.35s%-3.3s","In-bound Grunged Messages" ! 697: ,cfg.log&LOG_GRUNGED ? "Yes":"No"); ! 698: sprintf(opt[i++],"%-35.35s%-3.3s","Disallowed Private EchoMail" ! 699: ,cfg.log&LOG_PRIVATE ? "Yes":"No"); ! 700: sprintf(opt[i++],"%-35.35s%-3.3s","Circular EchoMail Messages" ! 701: ,cfg.log&LOG_CIRCULAR ? "Yes":"No"); ! 702: sprintf(opt[i++],"%-35.35s%-3.3s","Duplicate EchoMail Messages" ! 703: ,cfg.log&LOG_DUPES ? "Yes":"No"); ! 704: sprintf(opt[i++],"%-35.35s%-3.3s","Area Totals" ! 705: ,cfg.log&LOG_AREA_TOTALS ? "Yes":"No"); ! 706: sprintf(opt[i++],"%-35.35s%-3.3s","Over-All Totals" ! 707: ,cfg.log&LOG_TOTALS ? "Yes":"No"); ! 708: opt[i][0]=0; ! 709: j=uifc.list(0,0,0,43,&j,0,"Log Options",opt); ! 710: if(j==-1) ! 711: break; ! 712: switch(j) { ! 713: case 0: ! 714: cfg.log=~0L; ! 715: break; ! 716: case 1: ! 717: cfg.log=0; ! 718: break; ! 719: case 2: ! 720: cfg.log=LOG_DEFAULTS; ! 721: break; ! 722: case 3: ! 723: cfg.log^=LOG_IGNORED; ! 724: break; ! 725: case 4: ! 726: cfg.log^=LOG_UNKNOWN; ! 727: break; ! 728: case 5: ! 729: cfg.log^=LOG_AREAFIX; ! 730: break; ! 731: case 6: ! 732: cfg.log^=LOG_IMPORTED; ! 733: break; ! 734: case 7: ! 735: cfg.log^=LOG_PACKING; ! 736: break; ! 737: case 8: ! 738: cfg.log^=LOG_ROUTING; ! 739: break; ! 740: case 9: ! 741: cfg.log^=LOG_PACKETS; ! 742: break; ! 743: case 10: ! 744: cfg.log^=LOG_SECURE; ! 745: break; ! 746: case 11: ! 747: cfg.log^=LOG_GRUNGED; ! 748: break; ! 749: case 12: ! 750: cfg.log^=LOG_PRIVATE; ! 751: break; ! 752: case 13: ! 753: cfg.log^=LOG_CIRCULAR; ! 754: break; ! 755: case 14: ! 756: cfg.log^=LOG_DUPES; ! 757: break; ! 758: case 15: ! 759: cfg.log^=LOG_AREA_TOTALS; ! 760: break; ! 761: case 16: ! 762: cfg.log^=LOG_TOTALS; ! 763: break; } } ! 764: break; ! 765: ! 766: ! 767: case 8: ! 768: uifc.helpbuf= ! 769: "`Secure Operation` tells SBBSecho to check the AREAS.BBS file to insure\r\n" ! 770: " that the packet origin exists there as well as check the password of\r\n" ! 771: " that node (if configured).\r\n\r\n" ! 772: "`Convert Existing Tear Lines` tells SBBSecho to convert any tear lines\r\n" ! 773: " (`---`) existing in the message text to to `===`.\r\n\r\n" ! 774: "`Fuzzy Zone Operation` when set to yes if SBBSecho receives an inbound\r\n" ! 775: " netmail with no international zone information, it will compare the\r\n" ! 776: " net/node of the destination to the net/node information in your AKAs\r\n" ! 777: " and assume the zone of a matching AKA.\r\n\r\n" ! 778: "`Store PATH/SEEN-BY/Unkown Kludge Lines in Message Base` allows you to\r\n" ! 779: " determine whether or not SBBSecho will store this information from\r\n" ! 780: " incoming messages in the Synchronet message base.\r\n\r\n" ! 781: "`Allow Nodes to Add Areas in the AREAS.BBS List` when set to `YES` allows\r\n" ! 782: " uplinks to add areas listed in the AREAS.BBS file\r\n"; ! 783: j=0; ! 784: while(1) { ! 785: i=0; ! 786: sprintf(opt[i++],"%-50.50s%-3.3s","Secure Operation" ! 787: ,misc&SECURE ? "Yes":"No"); ! 788: sprintf(opt[i++],"%-50.50s%-3.3s","Convert Existing Tear Lines" ! 789: ,misc&CONVERT_TEAR ? "Yes":"No"); ! 790: sprintf(opt[i++],"%-50.50s%-3.3s","Fuzzy Zone Operation" ! 791: ,misc&FUZZY_ZONE ? "Yes":"No"); ! 792: sprintf(opt[i++],"%-50.50s%-3.3s","Store PATH Lines in " ! 793: "Message Base",misc&STORE_SEENBY ? "Yes":"No"); ! 794: sprintf(opt[i++],"%-50.50s%-3.3s","Store SEEN-BY Lines in " ! 795: "Message Base",misc&STORE_PATH ? "Yes":"No"); ! 796: sprintf(opt[i++],"%-50.50s%-3.3s","Store Unknown Kludge Lines " ! 797: "in Message Base",misc&STORE_KLUDGE ? "Yes":"No"); ! 798: sprintf(opt[i++],"%-50.50s%-3.3s","Allow Nodes to Add Areas " ! 799: "in the AREAS.BBS List",misc&ELIST_ONLY?"No":"Yes"); ! 800: sprintf(opt[i++],"%-50.50s%-3.3s","Strip Line Feeds " ! 801: "From Outgoing Messages",misc&STRIP_LF ? "Yes":"No"); ! 802: sprintf(opt[i++],"%-50.50s%-3.3s","Kill/Ignore Empty NetMail " ! 803: "Messages",misc&KILL_EMPTY_MAIL ? "Yes":"No"); ! 804: sprintf(opt[i++],"%-50.50s%s","Circular Path Detection" ! 805: ,cfg.check_path ? "Enabled" : "Disabled"); ! 806: sprintf(opt[i++],"%-50.50s%s","Bundle Attachments" ! 807: ,misc&TRUNC_BUNDLES ? "Truncate" : "Kill"); ! 808: opt[i][0]=0; ! 809: j=uifc.list(0,0,0,65,&j,0,"Toggle Options",opt); ! 810: if(j==-1) ! 811: break; ! 812: switch(j) { ! 813: case 0: ! 814: misc^=SECURE; ! 815: break; ! 816: case 1: ! 817: misc^=CONVERT_TEAR; ! 818: break; ! 819: case 2: ! 820: misc^=FUZZY_ZONE; ! 821: break; ! 822: case 3: ! 823: misc^=STORE_SEENBY; ! 824: break; ! 825: case 4: ! 826: misc^=STORE_PATH; ! 827: break; ! 828: case 5: ! 829: misc^=STORE_KLUDGE; ! 830: break; ! 831: case 6: ! 832: misc^=ELIST_ONLY; ! 833: break; ! 834: case 7: ! 835: misc^=STRIP_LF; ! 836: break; ! 837: case 8: ! 838: misc^=KILL_EMPTY_MAIL; ! 839: break; ! 840: case 9: ! 841: cfg.check_path=!cfg.check_path; ! 842: break; ! 843: case 10: ! 844: misc^=TRUNC_BUNDLES; ! 845: break; ! 846: } ! 847: } ! 848: break; ! 849: case 9: ! 850: uifc.helpbuf= ! 851: "~ Archive Programs ~\r\n\r\n" ! 852: "These are the archiving programs (types) which are available for\r\n" ! 853: "compressing outgoing packets.\r\n"; ! 854: i=0; ! 855: while(1) { ! 856: for(j=0;j<cfg.arcdefs;j++) ! 857: sprintf(opt[j],"%-30.30s",cfg.arcdef[j].name); ! 858: opt[j][0]=0; ! 859: i=uifc.list(WIN_ORG|WIN_INS|WIN_DEL|WIN_ACT|WIN_GET|WIN_PUT ! 860: |WIN_INSACT|WIN_DELACT|WIN_XTR ! 861: ,0,0,0,&i,0,"Archive Programs",opt); ! 862: if(i==-1) ! 863: break; ! 864: if((i&MSK_ON)==MSK_INS) { ! 865: i&=MSK_OFF; ! 866: str[0]=0; ! 867: uifc.helpbuf= ! 868: "~ Packer Name ~\r\n\r\n" ! 869: "This is the identifying name of the archiving program\r\n"; ! 870: if(uifc.input(WIN_MID,0,0 ! 871: ,"Packer Name",str,25,K_EDIT|K_UPPER)<1) ! 872: continue; ! 873: if((cfg.arcdef=(arcdef_t *)realloc(cfg.arcdef ! 874: ,sizeof(arcdef_t)*(cfg.arcdefs+1)))==NULL) { ! 875: printf("\nMemory Allocation Error\n"); ! 876: exit(1); } ! 877: for(j=cfg.arcdefs;j>i;j--) ! 878: memcpy(&cfg.arcdef[j],&cfg.arcdef[j-1] ! 879: ,sizeof(arcdef_t)); ! 880: strcpy(cfg.arcdef[j].name ! 881: ,cfg.arcdef[j-1].name); ! 882: cfg.arcdefs++; ! 883: memset(&cfg.arcdef[i],0,sizeof(arcdef_t)); ! 884: strcpy(cfg.arcdef[i].name,str); ! 885: continue; } ! 886: ! 887: if((i&MSK_ON)==MSK_DEL) { ! 888: i&=MSK_OFF; ! 889: cfg.arcdefs--; ! 890: if(cfg.arcdefs<=0) { ! 891: cfg.arcdefs=0; ! 892: continue; } ! 893: for(j=i;j<cfg.arcdefs;j++) ! 894: memcpy(&cfg.arcdef[j],&cfg.arcdef[j+1] ! 895: ,sizeof(arcdef_t)); ! 896: if((cfg.arcdef=(arcdef_t *)realloc(cfg.arcdef ! 897: ,sizeof(arcdef_t)*(cfg.arcdefs)))==NULL) { ! 898: printf("\nMemory Allocation Error\n"); ! 899: exit(1); } ! 900: continue; } ! 901: if((i&MSK_ON)==MSK_GET) { ! 902: i&=MSK_OFF; ! 903: memcpy(&savarcdef,&cfg.arcdef[i],sizeof(arcdef_t)); ! 904: continue; } ! 905: if((i&MSK_ON)==MSK_PUT) { ! 906: i&=MSK_OFF; ! 907: memcpy(&cfg.arcdef[i],&savarcdef,sizeof(arcdef_t)); ! 908: continue; } ! 909: while(1) { ! 910: j=0; ! 911: sprintf(opt[j++],"%-20.20s %s","Packer Name" ! 912: ,cfg.arcdef[i].name); ! 913: sprintf(opt[j++],"%-20.20s %s","Hexadecimal ID" ! 914: ,cfg.arcdef[i].hexid); ! 915: sprintf(opt[j++],"%-20.20s %u","Offset to Hex ID" ! 916: ,cfg.arcdef[i].byteloc); ! 917: sprintf(opt[j++],"%-20.20s %s","Pack Command Line" ! 918: ,cfg.arcdef[i].pack); ! 919: sprintf(opt[j++],"%-20.20s %s","Unpack Command Line" ! 920: ,cfg.arcdef[i].unpack); ! 921: opt[j][0]=0; ! 922: sprintf(str,"%.30s",cfg.arcdef[i].name); ! 923: k=uifc.list(WIN_MID|WIN_ACT,0,0,60,&nodeop,0,str,opt); ! 924: if(k==-1) ! 925: break; ! 926: switch(k) { ! 927: case 0: ! 928: uifc.input(WIN_MID|WIN_SAV,0,0 ! 929: ,"Packer Name",cfg.arcdef[i].name,25 ! 930: ,K_EDIT|K_UPPER); ! 931: break; ! 932: case 1: ! 933: uifc.input(WIN_MID|WIN_SAV,0,0 ! 934: ,"Hexadecimal ID",cfg.arcdef[i].hexid,25 ! 935: ,K_EDIT|K_UPPER); ! 936: break; ! 937: case 2: ! 938: sprintf(str,"%u",cfg.arcdef[i].byteloc); ! 939: uifc.input(WIN_MID|WIN_SAV,0,0 ! 940: ,"Offset to Hex ID",str,5 ! 941: ,K_NUMBER|K_EDIT); ! 942: cfg.arcdef[i].byteloc=atoi(str); ! 943: break; ! 944: case 3: ! 945: uifc.input(WIN_MID|WIN_SAV,0,0 ! 946: ,"Pack Command Line",cfg.arcdef[i].pack,50 ! 947: ,K_EDIT); ! 948: break; ! 949: case 4: ! 950: uifc.input(WIN_MID|WIN_SAV,0,0 ! 951: ,"Unpack Command Line",cfg.arcdef[i].unpack,50 ! 952: ,K_EDIT); ! 953: break; ! 954: } } } ! 955: break; ! 956: case 10: ! 957: uifc.helpbuf= ! 958: "~ Additional Echo Lists ~\r\n\r\n" ! 959: "This feature allows you to specify echo lists (in addition to your\r\n" ! 960: "AREAS.BBS file) for SBBSecho to search for area add requests.\r\n"; ! 961: i=0; ! 962: while(1) { ! 963: for(j=0;j<cfg.listcfgs;j++) ! 964: sprintf(opt[j],"%-50.50s",cfg.listcfg[j].listpath); ! 965: opt[j][0]=0; ! 966: i=uifc.list(WIN_ORG|WIN_INS|WIN_DEL|WIN_ACT|WIN_GET|WIN_PUT ! 967: |WIN_INSACT|WIN_DELACT|WIN_XTR ! 968: ,0,0,0,&i,0,"Additional Echo Lists",opt); ! 969: if(i==-1) ! 970: break; ! 971: if((i&MSK_ON)==MSK_INS) { ! 972: i&=MSK_OFF; ! 973: str[0]=0; ! 974: uifc.helpbuf= ! 975: "~ Echo List ~\r\n\r\n" ! 976: "This is the path and filename of the echo list file you wish\r\n" ! 977: "to add.\r\n"; ! 978: if(uifc.input(WIN_MID|WIN_SAV,0,0 ! 979: ,"Echo List Path/Name",str,50,K_EDIT)<1) ! 980: continue; ! 981: if((cfg.listcfg=(echolist_t *)realloc(cfg.listcfg ! 982: ,sizeof(echolist_t)*(cfg.listcfgs+1)))==NULL) { ! 983: printf("\nMemory Allocation Error\n"); ! 984: exit(1); } ! 985: for(j=cfg.listcfgs;j>i;j--) ! 986: memcpy(&cfg.listcfg[j],&cfg.listcfg[j-1] ! 987: ,sizeof(echolist_t)); ! 988: cfg.listcfgs++; ! 989: memset(&cfg.listcfg[i],0,sizeof(echolist_t)); ! 990: strcpy(cfg.listcfg[i].listpath,str); ! 991: continue; } ! 992: ! 993: if((i&MSK_ON)==MSK_DEL) { ! 994: i&=MSK_OFF; ! 995: cfg.listcfgs--; ! 996: if(cfg.listcfgs<=0) { ! 997: cfg.listcfgs=0; ! 998: continue; } ! 999: for(j=i;j<cfg.listcfgs;j++) ! 1000: memcpy(&cfg.listcfg[j],&cfg.listcfg[j+1] ! 1001: ,sizeof(echolist_t)); ! 1002: if((cfg.listcfg=(echolist_t *)realloc(cfg.listcfg ! 1003: ,sizeof(echolist_t)*(cfg.listcfgs)))==NULL) { ! 1004: printf("\nMemory Allocation Error\n"); ! 1005: exit(1); } ! 1006: continue; } ! 1007: if((i&MSK_ON)==MSK_GET) { ! 1008: i&=MSK_OFF; ! 1009: memcpy(&savlistcfg,&cfg.listcfg[i],sizeof(echolist_t)); ! 1010: continue; } ! 1011: if((i&MSK_ON)==MSK_PUT) { ! 1012: i&=MSK_OFF; ! 1013: memcpy(&cfg.listcfg[i],&savlistcfg,sizeof(echolist_t)); ! 1014: continue; } ! 1015: while(1) { ! 1016: j=0; ! 1017: sprintf(opt[j++],"%-20.20s %.19s","Echo List Path/Name" ! 1018: ,cfg.listcfg[i].listpath); ! 1019: sprintf(opt[j++],"%-20.20s %s","Hub Address" ! 1020: ,(cfg.listcfg[i].forward.zone) ? ! 1021: wcfaddrtoa(&cfg.listcfg[i].forward) : "None"); ! 1022: sprintf(opt[j++],"%-20.20s %s","Forward Password" ! 1023: ,(cfg.listcfg[i].password[0]) ? ! 1024: cfg.listcfg[i].password : "None"); ! 1025: sprintf(opt[j++],"%-20.20s %s","Forward Requests" ! 1026: ,(cfg.listcfg[i].misc&NOFWD) ? "No" : "Yes"); ! 1027: str[0]=0; ! 1028: for(k=0;k<cfg.listcfg[i].numflags;k++) { ! 1029: strcat(str,cfg.listcfg[i].flag[k].flag); ! 1030: strcat(str," "); } ! 1031: sprintf(opt[j++],"%-20.20s %s","Echo List Flags",str); ! 1032: opt[j][0]=0; ! 1033: k=uifc.list(WIN_MID|WIN_ACT,0,0,60,&nodeop,0,"Echo List",opt); ! 1034: if(k==-1) ! 1035: break; ! 1036: switch(k) { ! 1037: case 0: ! 1038: strcpy(str,cfg.listcfg[i].listpath); ! 1039: if(uifc.input(WIN_MID|WIN_SAV,0,0 ! 1040: ,"Echo List Path/Name",str,50 ! 1041: ,K_EDIT)<1) ! 1042: continue; ! 1043: strcpy(cfg.listcfg[i].listpath,str); ! 1044: break; ! 1045: case 1: ! 1046: if(cfg.listcfg[i].forward.zone) ! 1047: strcpy(str,wcfaddrtoa(&cfg.listcfg[i].forward)); ! 1048: else ! 1049: str[0]=0; ! 1050: uifc.input(WIN_MID|WIN_SAV,0,0 ! 1051: ,"Hub Address",str ! 1052: ,25,K_EDIT); ! 1053: if(str[0]) ! 1054: cfg.listcfg[i].forward=atofaddr(str); ! 1055: else ! 1056: memset(&cfg.listcfg[i].forward,0 ! 1057: ,sizeof(faddr_t)); ! 1058: break; ! 1059: case 2: ! 1060: uifc.input(WIN_MID|WIN_SAV,0,0 ! 1061: ,"Password to use when forwarding requests" ! 1062: ,cfg.listcfg[i].password,25,K_EDIT|K_UPPER); ! 1063: break; ! 1064: case 3: ! 1065: cfg.listcfg[i].misc^=NOFWD; ! 1066: if(cfg.listcfg[i].misc&NOFWD) ! 1067: cfg.listcfg[i].password[0]=0; ! 1068: break; ! 1069: case 4: ! 1070: while(1) { ! 1071: for(j=0;j<cfg.listcfg[i].numflags;j++) ! 1072: strcpy(opt[j],cfg.listcfg[i].flag[j].flag); ! 1073: opt[j][0]=0; ! 1074: x=uifc.list(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT| ! 1075: WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT ! 1076: ,0,0,0,&x,0,"Echo List Flags",opt); ! 1077: if(x==-1) ! 1078: break; ! 1079: if((x&MSK_ON)==MSK_INS) { ! 1080: x&=MSK_OFF; ! 1081: str[0]=0; ! 1082: uifc.helpbuf= ! 1083: "~ Echo List Flag ~\r\n\r\n" ! 1084: "These flags determine which nodes have access to the current\r\n" ! 1085: "echolist file\r\n"; ! 1086: if(uifc.input(WIN_MID|WIN_SAV,0,0 ! 1087: ,"Echo List Flag",str,4 ! 1088: ,K_EDIT|K_UPPER)<1) ! 1089: continue; ! 1090: if((cfg.listcfg[i].flag=(flag_t *) ! 1091: realloc(cfg.listcfg[i].flag ! 1092: ,sizeof(flag_t)* ! 1093: (cfg.listcfg[i].numflags+1)))==NULL) { ! 1094: printf("\nMemory Allocation Error\n"); ! 1095: exit(1); } ! 1096: for(j=cfg.listcfg[i].numflags;j>x;j--) ! 1097: memcpy(&cfg.listcfg[i].flag[j] ! 1098: ,&cfg.listcfg[i].flag[j-1] ! 1099: ,sizeof(flag_t)); ! 1100: cfg.listcfg[i].numflags++; ! 1101: memset(&cfg.listcfg[i].flag[x].flag ! 1102: ,0,sizeof(flag_t)); ! 1103: strcpy(cfg.listcfg[i].flag[x].flag,str); ! 1104: continue; } ! 1105: ! 1106: if((x&MSK_ON)==MSK_DEL) { ! 1107: x&=MSK_OFF; ! 1108: cfg.listcfg[i].numflags--; ! 1109: if(cfg.listcfg[i].numflags<=0) { ! 1110: cfg.listcfg[i].numflags=0; ! 1111: continue; } ! 1112: for(j=x;j<cfg.listcfg[i].numflags;j++) ! 1113: strcpy(cfg.listcfg[i].flag[j].flag ! 1114: ,cfg.listcfg[i].flag[j+1].flag); ! 1115: if((cfg.listcfg[i].flag=(flag_t *) ! 1116: realloc(cfg.listcfg[i].flag ! 1117: ,sizeof(flag_t)* ! 1118: (cfg.listcfg[i].numflags)))==NULL) { ! 1119: printf("\nMemory Allocation Error\n"); ! 1120: exit(1); } ! 1121: continue; } ! 1122: strcpy(str,cfg.listcfg[i].flag[x].flag); ! 1123: uifc.helpbuf= ! 1124: "~ Echo List Flag ~\r\n\r\n" ! 1125: "These flags determine which nodes have access to the current\r\n" ! 1126: "echolist file\r\n"; ! 1127: uifc.input(WIN_MID|WIN_SAV,0,0,"Echo List Flag" ! 1128: ,str,4,K_EDIT|K_UPPER); ! 1129: strcpy(cfg.listcfg[i].flag[x].flag,str); ! 1130: continue; } ! 1131: break; ! 1132: } } } ! 1133: break; ! 1134: ! 1135: case -1: ! 1136: uifc.helpbuf= ! 1137: "~ Save Configuration File ~\r\n\r\n" ! 1138: "Select `Yes` to save the config file, `No` to quit without saving,\r\n" ! 1139: "or hit ~ ESC ~ to go back to the menu.\r\n\r\n"; ! 1140: i=0; ! 1141: strcpy(opt[0],"Yes"); ! 1142: strcpy(opt[1],"No"); ! 1143: opt[2][0]=0; ! 1144: i=uifc.list(WIN_MID,0,0,0,&i,0,"Save Config File",opt); ! 1145: if(i==-1) break; ! 1146: if(i) {uifc.bail(); exit(0);} ! 1147: if((stream=fnopen(NULL,cfg.cfgfile,O_CREAT|O_TRUNC|O_WRONLY|O_TEXT))==NULL) { ! 1148: uifc.bail(); ! 1149: printf("Error %d opening %s\n",errno,cfg.cfgfile); ! 1150: exit(1); ! 1151: } ! 1152: if(!cfg.check_path) ! 1153: fprintf(stream,"NOPATHCHECK\n"); ! 1154: if(cfg.notify) ! 1155: fprintf(stream,"NOTIFY %u\n",cfg.notify); ! 1156: if(misc&CONVERT_TEAR) ! 1157: fprintf(stream,"CONVERT_TEAR\n"); ! 1158: if(misc&SECURE) ! 1159: fprintf(stream,"SECURE_ECHOMAIL\n"); ! 1160: if(misc&KILL_EMPTY_MAIL) ! 1161: fprintf(stream,"KILL_EMPTY\n"); ! 1162: if(misc&STORE_SEENBY) ! 1163: fprintf(stream,"STORE_SEENBY\n"); ! 1164: if(misc&STORE_PATH) ! 1165: fprintf(stream,"STORE_PATH\n"); ! 1166: if(misc&STORE_KLUDGE) ! 1167: fprintf(stream,"STORE_KLUDGE\n"); ! 1168: if(misc&FUZZY_ZONE) ! 1169: fprintf(stream,"FUZZY_ZONE\n"); ! 1170: if(misc&FLO_MAILER) ! 1171: fprintf(stream,"FLO_MAILER\n"); ! 1172: if(misc&ELIST_ONLY) ! 1173: fprintf(stream,"ELIST_ONLY\n"); ! 1174: if(misc&STRIP_LF) ! 1175: fprintf(stream,"STRIP_LF\n"); ! 1176: if(misc&TRUNC_BUNDLES) ! 1177: fprintf(stream,"TRUNC_BUNDLES\n"); ! 1178: ! 1179: if(cfg.areafile[0]) ! 1180: fprintf(stream,"AREAFILE %s\n",cfg.areafile); ! 1181: if(cfg.logfile[0]) ! 1182: fprintf(stream,"LOGFILE %s\n",cfg.logfile); ! 1183: if(cfg.log!=LOG_DEFAULTS) { ! 1184: if(cfg.log==0xffffffffUL) ! 1185: fprintf(stream,"LOG ALL\n"); ! 1186: else if(cfg.log==0L) ! 1187: fprintf(stream,"LOG NONE\n"); ! 1188: else ! 1189: fprintf(stream,"LOG %08lX\n",cfg.log); } ! 1190: fprintf(stream,"LOG_LEVEL %u\n",cfg.log_level); ! 1191: if(cfg.inbound[0]) ! 1192: fprintf(stream,"INBOUND %s\n",cfg.inbound); ! 1193: if(cfg.secure[0]) ! 1194: fprintf(stream,"SECURE_INBOUND %s\n",cfg.secure); ! 1195: if(cfg.outbound[0]) ! 1196: fprintf(stream,"OUTBOUND %s\n",cfg.outbound); ! 1197: if(cfg.maxbdlsize!=DFLT_BDL_SIZE) ! 1198: fprintf(stream,"ARCSIZE %lu\n",cfg.maxbdlsize); ! 1199: if(cfg.maxpktsize!=DFLT_PKT_SIZE) ! 1200: fprintf(stream,"PKTSIZE %lu\n",cfg.maxpktsize); ! 1201: for(i=j=0;i<cfg.nodecfgs;i++) ! 1202: if(cfg.nodecfg[i].attr&SEND_NOTIFY) { ! 1203: if(!j) fprintf(stream,"SEND_NOTIFY"); ! 1204: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1205: j++; } ! 1206: if(j) fprintf(stream,"\n"); ! 1207: for(i=j=0;i<cfg.nodecfgs;i++) ! 1208: if(cfg.nodecfg[i].attr&ATTR_HOLD) { ! 1209: if(!j) fprintf(stream,"HOLD"); ! 1210: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1211: j++; } ! 1212: if(j) fprintf(stream,"\n"); ! 1213: for(i=j=0;i<cfg.nodecfgs;i++) ! 1214: if(cfg.nodecfg[i].attr&ATTR_DIRECT) { ! 1215: if(!j) fprintf(stream,"DIRECT"); ! 1216: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1217: j++; } ! 1218: if(j) fprintf(stream,"\n"); ! 1219: for(i=j=0;i<cfg.nodecfgs;i++) ! 1220: if(cfg.nodecfg[i].attr&ATTR_CRASH) { ! 1221: if(!j) fprintf(stream,"CRASH"); ! 1222: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1223: j++; } ! 1224: if(j) fprintf(stream,"\n"); ! 1225: for(i=j=0;i<cfg.nodecfgs;i++) ! 1226: if(cfg.nodecfg[i].attr&ATTR_PASSIVE) { ! 1227: if(!j) fprintf(stream,"PASSIVE"); ! 1228: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1229: j++; } ! 1230: if(j) fprintf(stream,"\n"); ! 1231: ! 1232: for(i=0;i<cfg.nodecfgs;i++) ! 1233: if(cfg.nodecfg[i].pktpwd[0]) ! 1234: fprintf(stream,"PKTPWD %s %s\n" ! 1235: ,wcfaddrtoa(&cfg.nodecfg[i].faddr),cfg.nodecfg[i].pktpwd); ! 1236: ! 1237: for(i=0;i<cfg.nodecfgs;i++) ! 1238: if(cfg.nodecfg[i].pkt_type) ! 1239: fprintf(stream,"PKTTYPE %s %s\n" ! 1240: ,cfg.nodecfg[i].pkt_type==PKT_TWO_TWO ? "2.2":"2" ! 1241: ,wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1242: ! 1243: for(i=0;i<cfg.arcdefs;i++) ! 1244: fprintf(stream,"PACKER %s %u %s\n PACK %s\n" ! 1245: " UNPACK %s\nEND\n" ! 1246: ,cfg.arcdef[i].name ! 1247: ,cfg.arcdef[i].byteloc ! 1248: ,cfg.arcdef[i].hexid ! 1249: ,cfg.arcdef[i].pack ! 1250: ,cfg.arcdef[i].unpack ! 1251: ); ! 1252: for(i=0;i<cfg.arcdefs;i++) { ! 1253: for(j=k=0;j<cfg.nodecfgs;j++) ! 1254: if(cfg.nodecfg[j].arctype==i) { ! 1255: if(!k) ! 1256: fprintf(stream,"%-10s %s","USEPACKER" ! 1257: ,cfg.arcdef[i].name); ! 1258: k++; ! 1259: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[j].faddr)); } ! 1260: if(k) ! 1261: fprintf(stream,"\n"); } ! 1262: ! 1263: for(i=j=0;i<cfg.nodecfgs;i++) ! 1264: if(cfg.nodecfg[i].arctype==0xffff) { ! 1265: if(!j) ! 1266: fprintf(stream,"%-10s %s","USEPACKER","NONE"); ! 1267: j++; ! 1268: fprintf(stream," %s",wcfaddrtoa(&cfg.nodecfg[i].faddr)); } ! 1269: if(j) ! 1270: fprintf(stream,"\n"); ! 1271: ! 1272: for(i=0;i<cfg.listcfgs;i++) { ! 1273: fprintf(stream,"%-10s","ECHOLIST"); ! 1274: if(cfg.listcfg[i].password[0]) ! 1275: fprintf(stream," FORWARD %s %s" ! 1276: ,wcfaddrtoa(&cfg.listcfg[i].forward) ! 1277: ,cfg.listcfg[i].password); ! 1278: else if(cfg.listcfg[i].misc&NOFWD && ! 1279: cfg.listcfg[i].forward.zone) ! 1280: fprintf(stream," HUB %s" ! 1281: ,wcfaddrtoa(&cfg.listcfg[i].forward)); ! 1282: fprintf(stream," %s",cfg.listcfg[i].listpath); ! 1283: for(j=0;j<cfg.listcfg[i].numflags;j++) ! 1284: fprintf(stream," %s",cfg.listcfg[i].flag[j].flag); ! 1285: fprintf(stream,"\n"); } ! 1286: ! 1287: for(i=0;i<cfg.nodecfgs;i++) ! 1288: if(cfg.nodecfg[i].password[0]) { ! 1289: fprintf(stream,"%-10s %s %s","AREAFIX" ! 1290: ,wcfaddrtoa(&cfg.nodecfg[i].faddr) ! 1291: ,cfg.nodecfg[i].password); ! 1292: for(j=0;j<cfg.nodecfg[i].numflags;j++) ! 1293: fprintf(stream," %s",cfg.nodecfg[i].flag[j].flag); ! 1294: fprintf(stream,"\n"); } ! 1295: ! 1296: for(i=0;i<cfg.nodecfgs;i++) ! 1297: if(cfg.nodecfg[i].route.zone) { ! 1298: fprintf(stream,"%-10s %s","ROUTE_TO" ! 1299: ,wcfaddrtoa(&cfg.nodecfg[i].route)); ! 1300: fprintf(stream," %s" ! 1301: ,wcfaddrtoa(&cfg.nodecfg[i].faddr)); ! 1302: for(j=i+1;j<cfg.nodecfgs;j++) ! 1303: if(!memcmp(&cfg.nodecfg[j].route,&cfg.nodecfg[i].route ! 1304: ,sizeof(faddr_t))) { ! 1305: fprintf(stream," %s" ! 1306: ,wcfaddrtoa(&cfg.nodecfg[j].faddr)); ! 1307: cfg.nodecfg[j].route.zone=0; } ! 1308: fprintf(stream,"\n"); } ! 1309: ! 1310: fclose(stream); ! 1311: uifc.bail(); ! 1312: exit(0); ! 1313: } ! 1314: } ! 1315: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.