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