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