|
|
1.1 root 1: /* rechocfg.C */
2:
3: /* Synchronet FidoNet EchoMail Scanning/Tossing and NetMail Tossing Utility */
4:
1.1.1.2 ! root 5: /* $Id: rechocfg.c,v 1.25 2011/07/20 02:41:42 rswindell Exp $ */
1.1 root 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: * *
1.1.1.2 ! root 11: * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 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 <time.h>
41: #include <errno.h>
42: #include <stdio.h>
43: #include <ctype.h>
44: #include <fcntl.h>
45: #include <stdarg.h>
46: #include <stdlib.h>
47: #include <string.h>
48: #include <sys/stat.h>
49:
50: #include "sbbs.h"
51: #include "sbbsecho.h"
52: #include "filewrap.h" /* O_DENYNONE */
53:
54: #ifdef __WATCOMC__
55: #include <mem.h>
56: #define O_DENYNONE SH_DENYNO
57: #endif
58:
59: extern long misc;
60: extern config_t cfg;
61:
62: /******************************************************************************
63: Here we take a string and put a terminator in place of the first TAB or SPACE
64: ******************************************************************************/
65: char *cleanstr(char *instr)
66: {
67: int i;
68:
69: for(i=0;instr[i];i++)
70: if((uchar)instr[i]<=' ')
71: break;
72: instr[i]=0;
73: return(instr);
74: }
75:
76: /****************************************************************************/
77: /* Returns the FidoNet address kept in str as ASCII. */
78: /****************************************************************************/
79: faddr_t atofaddr(char *instr)
80: {
81: char *p,str[51];
82: faddr_t addr;
83:
84: sprintf(str,"%.50s",instr);
85: cleanstr(str);
86: if(!stricmp(str,"ALL")) {
87: addr.zone=addr.net=addr.node=addr.point=0xffff;
88: return(addr); }
89: addr.zone=addr.net=addr.node=addr.point=0;
90: if((p=strchr(str,':'))!=NULL) {
91: if(!strnicmp(str,"ALL:",4))
92: addr.zone=0xffff;
93: else
94: addr.zone=atoi(str);
95: p++;
96: if(!strnicmp(p,"ALL",3))
97: addr.net=0xffff;
98: else
99: addr.net=atoi(p); }
100: else {
101: #ifdef SCFG
102: if(total_faddrs)
103: addr.zone=faddr[0].zone;
104: else
105: #endif
106: addr.zone=1;
107: addr.net=atoi(str); }
108: if(!addr.zone) /* no such thing as zone 0 */
109: addr.zone=1;
110: if((p=strchr(str,'/'))!=NULL) {
111: p++;
112: if(!strnicmp(p,"ALL",3))
113: addr.node=0xffff;
114: else
115: addr.node=atoi(p); }
116: else {
117: if(!addr.net) {
118: #ifdef SCFG
119: if(total_faddrs)
120: addr.net=faddr[0].net;
121: else
122: #endif
123: addr.net=1; }
124: addr.node=atoi(str); }
125: if((p=strchr(str,'.'))!=NULL) {
126: p++;
127: if(!strnicmp(p,"ALL",3))
128: addr.point=0xffff;
129: else
130: addr.point=atoi(p); }
131: return(addr);
132: }
133:
134: /******************************************************************************
135: This function returns the number of the node in the SBBSECHO.CFG file which
136: matches the address passed to it (or cfg.nodecfgs if no match).
137: ******************************************************************************/
138: int matchnode(faddr_t addr, int exact)
139: {
140: int i;
141:
142: if(exact!=2) {
143: for(i=0;i<cfg.nodecfgs;i++) /* Look for exact match */
144: if(!memcmp(&cfg.nodecfg[i].faddr,&addr,sizeof(faddr_t)))
145: break;
146: if(exact || i<cfg.nodecfgs)
147: return(i); }
148:
149: for(i=0;i<cfg.nodecfgs;i++) /* Look for point match */
150: if(cfg.nodecfg[i].faddr.point==0xffff
151: && addr.zone==cfg.nodecfg[i].faddr.zone
152: && addr.net==cfg.nodecfg[i].faddr.net
153: && addr.node==cfg.nodecfg[i].faddr.node)
154: break;
155: if(i<cfg.nodecfgs)
156: return(i);
157:
158: for(i=0;i<cfg.nodecfgs;i++) /* Look for node match */
159: if(cfg.nodecfg[i].faddr.node==0xffff
160: && addr.zone==cfg.nodecfg[i].faddr.zone
161: && addr.net==cfg.nodecfg[i].faddr.net)
162: break;
163: if(i<cfg.nodecfgs)
164: return(i);
165:
166: for(i=0;i<cfg.nodecfgs;i++) /* Look for net match */
167: if(cfg.nodecfg[i].faddr.net==0xffff
168: && addr.zone==cfg.nodecfg[i].faddr.zone)
169: break;
170: if(i<cfg.nodecfgs)
171: return(i);
172:
173: for(i=0;i<cfg.nodecfgs;i++) /* Look for total wild */
174: if(cfg.nodecfg[i].faddr.zone==0xffff)
175: break;
176: return(i);
177: }
178:
179: void read_echo_cfg()
180: {
181: uchar str[1025],tmp[512],*p,*tp;
182: short attr=0;
183: int i,j,file;
184: FILE *stream;
185: faddr_t addr,route_addr;
186:
187:
188: /****** READ IN SBBSECHO.CFG FILE *******/
189:
190: printf("\nReading %s\n",cfg.cfgfile);
191: if((stream=fnopen(&file,cfg.cfgfile,O_RDONLY))==NULL) {
192: printf("Unable to open %s for read.\n",cfg.cfgfile);
193: bail(1); }
194:
195: cfg.maxpktsize=DFLT_PKT_SIZE;
196: cfg.maxbdlsize=DFLT_BDL_SIZE;
197: cfg.badecho=-1;
198: cfg.log=LOG_DEFAULTS;
1.1.1.2 ! root 199: cfg.log_level=LOG_INFO;
1.1 root 200: cfg.check_path=TRUE;
201:
202: while(1) {
203: if(!fgets(str,256,stream))
204: break;
205: truncsp(str);
206: p=str;
207: while(*p && *p<=' ') p++;
208: if(*p==';')
209: continue;
210: sprintf(tmp,"%-.25s",p);
211: tp=strchr(tmp,' ');
212: if(tp)
213: *tp=0; /* Chop off at space */
214: #if 0
215: strupr(tmp); /* Convert code to uppercase */
216: #endif
217: while(*p>' ') p++; /* Skip code */
218: while(*p && *p<=' ') p++; /* Skip white space */
219:
220: if(!stricmp(tmp,"PACKER")) { /* Archive Definition */
221: if((cfg.arcdef=(arcdef_t *)realloc(cfg.arcdef
222: ,sizeof(arcdef_t)*(cfg.arcdefs+1)))==NULL) {
223: printf("\nError allocating %u bytes of memory for arcdef #%u.\n"
224: ,sizeof(arcdef_t)*(cfg.arcdefs+1),cfg.arcdefs+1);
225: bail(1); }
1.1.1.2 ! root 226: SAFECOPY(cfg.arcdef[cfg.arcdefs].name,p);
1.1 root 227: tp=cfg.arcdef[cfg.arcdefs].name;
228: while(*tp && *tp>' ') tp++;
229: *tp=0;
230: while(*p && *p>' ') p++;
231: while(*p && *p<=' ') p++;
232: cfg.arcdef[cfg.arcdefs].byteloc=atoi(p);
233: while(*p && *p>' ') p++;
234: while(*p && *p<=' ') p++;
1.1.1.2 ! root 235: SAFECOPY(cfg.arcdef[cfg.arcdefs].hexid,p);
1.1 root 236: tp=cfg.arcdef[cfg.arcdefs].hexid;
237: while(*tp && *tp>' ') tp++;
238: *tp=0;
239: while(fgets(str,256,stream) && strnicmp(str,"END",3)) {
240: p=str;
241: while(*p && *p<=' ') p++;
242: if(!strnicmp(p,"PACK ",5)) {
243: p+=5;
244: while(*p && *p<=' ') p++;
1.1.1.2 ! root 245: SAFECOPY(cfg.arcdef[cfg.arcdefs].pack,p);
1.1 root 246: truncsp(cfg.arcdef[cfg.arcdefs].pack);
247: continue; }
248: if(!strnicmp(p,"UNPACK ",7)) {
249: p+=7;
250: while(*p && *p<=' ') p++;
1.1.1.2 ! root 251: SAFECOPY(cfg.arcdef[cfg.arcdefs].unpack,p);
1.1 root 252: truncsp(cfg.arcdef[cfg.arcdefs].unpack); } }
253: ++cfg.arcdefs;
254: continue; }
255:
256: if(!stricmp(tmp,"REGNUM"))
257: continue;
258:
259: if(!stricmp(tmp,"NOPATHCHECK")) {
260: cfg.check_path=FALSE;
261: continue;
262: }
263:
264: if(!stricmp(tmp,"NOTIFY")) {
265: cfg.notify=atoi(cleanstr(p));
266: continue; }
267:
268: if(!stricmp(tmp,"LOG")) {
269: cleanstr(p);
270: if(!stricmp(p,"ALL"))
271: cfg.log=0xffffffffUL;
272: else if(!stricmp(p,"DEFAULT"))
273: cfg.log=LOG_DEFAULTS;
274: else if(!stricmp(p,"NONE"))
275: cfg.log=0L;
276: else
277: cfg.log=strtol(cleanstr(p),0,16);
278: continue; }
279:
1.1.1.2 ! root 280: if(!stricmp(tmp,"LOG_LEVEL")) {
! 281: cfg.log_level=atoi(cleanstr(p));
! 282: continue; }
! 283:
1.1 root 284: if(!stricmp(tmp,"NOSWAP")) {
285: continue; }
286:
287: if(!stricmp(tmp,"SECURE_ECHOMAIL")) {
288: misc|=SECURE;
289: continue; }
290:
291: if(!stricmp(tmp,"STRIP_LF")) {
292: misc|=STRIP_LF;
293: continue; }
294:
1.1.1.2 ! root 295: if(!stricmp(tmp,"CONVERT_TEAR")) {
! 296: misc|=CONVERT_TEAR;
! 297: continue;
! 298: }
! 299:
1.1 root 300: if(!stricmp(tmp,"STORE_SEENBY")) {
301: misc|=STORE_SEENBY;
302: continue; }
303:
304: if(!stricmp(tmp,"STORE_PATH")) {
305: misc|=STORE_PATH;
306: continue; }
307:
308: if(!stricmp(tmp,"STORE_KLUDGE")) {
309: misc|=STORE_KLUDGE;
310: continue; }
311:
312: if(!stricmp(tmp,"FUZZY_ZONE")) {
313: misc|=FUZZY_ZONE;
314: continue; }
315:
316: if(!stricmp(tmp,"TRUNC_BUNDLES")) {
317: misc|=TRUNC_BUNDLES;
318: continue; }
319:
320: if(!stricmp(tmp,"FLO_MAILER")) {
321: misc|=FLO_MAILER;
322: continue; }
323:
324: if(!stricmp(tmp,"ELIST_ONLY")) {
325: misc|=ELIST_ONLY;
326: continue; }
327:
328: if(!stricmp(tmp,"KILL_EMPTY")) {
329: misc|=KILL_EMPTY_MAIL;
330: continue; }
331:
332: if(!stricmp(tmp,"AREAFILE")) {
1.1.1.2 ! root 333: SAFECOPY(cfg.areafile,cleanstr(p));
1.1 root 334: continue; }
335:
336: if(!stricmp(tmp,"LOGFILE")) {
1.1.1.2 ! root 337: SAFECOPY(cfg.logfile,cleanstr(p));
1.1 root 338: continue; }
339:
340: if(!stricmp(tmp,"INBOUND")) { /* Inbound directory */
1.1.1.2 ! root 341: SAFECOPY(cfg.inbound,cleanstr(p));
1.1 root 342: backslash(cfg.inbound);
343: continue; }
344:
345: if(!stricmp(tmp,"SECURE_INBOUND")) { /* Secure Inbound directory */
1.1.1.2 ! root 346: SAFECOPY(cfg.secure,cleanstr(p));
1.1 root 347: backslash(cfg.secure);
348: continue; }
349:
350: if(!stricmp(tmp,"OUTBOUND")) { /* Outbound directory */
1.1.1.2 ! root 351: SAFECOPY(cfg.outbound,cleanstr(p));
1.1 root 352: backslash(cfg.outbound);
353: continue; }
354:
355: if(!stricmp(tmp,"ARCSIZE")) { /* Maximum bundle size */
356: cfg.maxbdlsize=atol(p);
357: continue; }
358:
359: if(!stricmp(tmp,"PKTSIZE")) { /* Maximum packet size */
360: cfg.maxpktsize=atol(p);
361: continue; }
362:
363: if(!stricmp(tmp,"USEPACKER")) { /* Which packer to use */
364: if(!*p)
365: continue;
1.1.1.2 ! root 366: SAFECOPY(str,p);
1.1 root 367: p=str;
368: while(*p && *p>' ') p++;
369: if(!*p)
370: continue;
371: *p=0;
372: p++;
373: for(i=0;i<cfg.arcdefs;i++)
374: if(!strnicmp(cfg.arcdef[i].name,str
375: ,strlen(cfg.arcdef[i].name)))
376: break;
377: if(i==cfg.arcdefs) /* i = number of arcdef til done */
378: i=0xffff; /* Uncompressed type if not found */
379: while(*p) {
380: while(*p && *p<=' ') p++;
381: if(!*p)
382: break;
383: addr=atofaddr(p);
384: while(*p && *p>' ') p++;
385: j=matchnode(addr,1);
386: if(j==cfg.nodecfgs) {
387: cfg.nodecfgs++;
388: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
389: ,sizeof(nodecfg_t)*(j+1)))==NULL) {
390: printf("\nError allocating memory for nodecfg #%u.\n"
391: ,j+1);
392: bail(1); }
393: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
394: cfg.nodecfg[j].faddr=addr; }
395: cfg.nodecfg[j].arctype=i; } }
396:
397: if(!stricmp(tmp,"PKTPWD")) { /* Packet Password */
398: if(!*p)
399: continue;
400: addr=atofaddr(p);
401: while(*p && *p>' ') p++; /* Skip address */
402: while(*p && *p<=' ') p++; /* Find beginning of password */
403: j=matchnode(addr,1);
404: if(j==cfg.nodecfgs) {
405: cfg.nodecfgs++;
406: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
407: ,sizeof(nodecfg_t)*(j+1)))==NULL) {
408: printf("\nError allocating memory for nodecfg #%u.\n"
409: ,j+1);
410: bail(1); }
411: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
412: cfg.nodecfg[j].faddr=addr; }
1.1.1.2 ! root 413: SAFECOPY(cfg.nodecfg[j].pktpwd,p); }
1.1 root 414:
415: if(!stricmp(tmp,"PKTTYPE")) { /* Packet Type to Use */
416: if(!*p)
417: continue;
1.1.1.2 ! root 418: SAFECOPY(str,p);
1.1 root 419: p=str;
420: while(*p && *p>' ') p++;
421: *p=0;
422: p++;
423: while(*p) {
424: while(*p && *p<=' ') p++;
425: if(!*p)
426: break;
427: addr=atofaddr(p);
428: while(*p && *p>' ') p++;
429: j=matchnode(addr,1);
430: if(j==cfg.nodecfgs) {
431: cfg.nodecfgs++;
432: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
433: ,sizeof(nodecfg_t)*(j+1)))==NULL) {
434: printf("\nError allocating memory for nodecfg #%u.\n"
435: ,j+1);
436: bail(1); }
437: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
438: cfg.nodecfg[j].faddr=addr; }
439: if(!strcmp(str,"2+"))
440: cfg.nodecfg[j].pkt_type=PKT_TWO_PLUS;
441: else if(!strcmp(str,"2.2"))
442: cfg.nodecfg[j].pkt_type=PKT_TWO_TWO;
443: else if(!strcmp(str,"2"))
444: cfg.nodecfg[j].pkt_type=PKT_TWO; } }
445:
446: if(!stricmp(tmp,"SEND_NOTIFY")) { /* Nodes to send notify lists to */
447: while(*p) {
448: while(*p && *p<=' ') p++;
449: if(!*p)
450: break;
451: addr=atofaddr(p);
452: while(*p && *p>' ') p++;
453: j=matchnode(addr,1);
454: if(j==cfg.nodecfgs) {
455: cfg.nodecfgs++;
456: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
457: ,sizeof(nodecfg_t)*(j+1)))==NULL) {
458: printf("\nError allocating memory for nodecfg #%u.\n"
459: ,j+1);
460: bail(1); }
461: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
462: cfg.nodecfg[j].faddr=addr; }
463: cfg.nodecfg[j].attr|=SEND_NOTIFY; } }
464:
465: if(!stricmp(tmp,"PASSIVE")
466: || !stricmp(tmp,"HOLD")
467: || !stricmp(tmp,"CRASH")
468: || !stricmp(tmp,"DIRECT")) { /* Set node attributes */
469: if(!stricmp(tmp,"PASSIVE"))
470: attr=ATTR_PASSIVE;
471: else if(!stricmp(tmp,"CRASH"))
472: attr=ATTR_CRASH;
473: else if(!stricmp(tmp,"HOLD"))
474: attr=ATTR_HOLD;
475: else if(!stricmp(tmp,"DIRECT"))
476: attr=ATTR_DIRECT;
477: while(*p) {
478: while(*p && *p<=' ') p++;
479: if(!*p)
480: break;
481: addr=atofaddr(p);
482: while(*p && *p>' ') p++;
483: j=matchnode(addr,1);
484: if(j==cfg.nodecfgs) {
485: cfg.nodecfgs++;
486: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
487: ,sizeof(nodecfg_t)*(j+1)))==NULL) {
488: printf("\nError allocating memory for nodecfg #%u.\n"
489: ,j+1);
490: bail(1); }
491: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
492: cfg.nodecfg[j].faddr=addr; }
493: cfg.nodecfg[j].attr|=attr; } }
494:
495: if(!stricmp(tmp,"ROUTE_TO")) {
496: while(*p && *p<=' ') p++;
497: if(*p) {
498: route_addr=atofaddr(p);
499: while(*p && *p>' ') p++; }
500: while(*p) {
501: while(*p && *p<=' ') p++;
502: if(!*p)
503: break;
504: addr=atofaddr(p);
505: while(*p && *p>' ') p++;
506: j=matchnode(addr,1);
507: if(j==cfg.nodecfgs) {
508: cfg.nodecfgs++;
509: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
510: ,sizeof(nodecfg_t)*(j+1)))==NULL) {
511: printf("\nError allocating memory for nodecfg #%u.\n"
512: ,j+1);
513: bail(1); }
514: memset(&cfg.nodecfg[j],0,sizeof(nodecfg_t));
515: cfg.nodecfg[j].faddr=addr; }
516: cfg.nodecfg[j].route=route_addr; } }
517:
518: if(!stricmp(tmp,"AREAFIX")) { /* Areafix stuff here */
519: if(!*p)
520: continue;
521: addr=atofaddr(p);
522: i=matchnode(addr,1);
523: if(i==cfg.nodecfgs) {
524: cfg.nodecfgs++;
525: if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
526: ,sizeof(nodecfg_t)*(i+1)))==NULL) {
527: printf("\nError allocating memory for nodecfg #%u.\n"
528: ,i+1);
529: bail(1); }
530: memset(&cfg.nodecfg[i],0,sizeof(nodecfg_t));
531: cfg.nodecfg[i].faddr=addr; }
532: cfg.nodecfg[i].flag=NULL;
533: while(*p && *p>' ') p++; /* Get to the end of the address */
534: while(*p && *p<=' ') p++; /* Skip over whitespace chars */
535: tp=p;
536: while(*p && *p>' ') p++; /* Find end of password */
537: *p=0; /* and terminate the string */
538: ++p;
1.1.1.2 ! root 539: SAFECOPY(cfg.nodecfg[i].password,tp);
1.1 root 540: while(*p && *p<=' ') p++; /* Search for more chars */
541: if(!*p) /* Nothing else there */
542: continue;
543: while(*p) {
544: tp=p;
545: while(*p && *p>' ') p++; /* Find end of this flag */
546: *p=0; /* and terminate it */
547: ++p;
548: for(j=0;j<cfg.nodecfg[i].numflags;j++)
549: if(!strnicmp(cfg.nodecfg[i].flag[j].flag,tp
550: ,strlen(cfg.nodecfg[i].flag[j].flag)))
551: break;
552: if(j==cfg.nodecfg[i].numflags) {
553: if((cfg.nodecfg[i].flag=
554: (flag_t *)realloc(cfg.nodecfg[i].flag
555: ,sizeof(flag_t)*(j+1)))==NULL) {
556: printf("\nError allocating memory for nodecfg #%u "
557: "flag #%u.\n",cfg.nodecfgs,j+1);
558: bail(1); }
559: cfg.nodecfg[i].numflags++;
1.1.1.2 ! root 560: SAFECOPY(cfg.nodecfg[i].flag[j].flag,tp); }
1.1 root 561: while(*p && *p<=' ') p++; } }
562:
563: if(!stricmp(tmp,"ECHOLIST")) { /* Echolists go here */
564: if((cfg.listcfg=(echolist_t *)realloc(cfg.listcfg
565: ,sizeof(echolist_t)*(cfg.listcfgs+1)))==NULL) {
566: printf("\nError allocating memory for echolist cfg #%u.\n"
567: ,cfg.listcfgs+1);
568: bail(1); }
569: memset(&cfg.listcfg[cfg.listcfgs],0,sizeof(echolist_t));
570: ++cfg.listcfgs;
571: /* Need to forward requests? */
572: if(!strnicmp(p,"FORWARD ",8) || !strnicmp(p,"HUB ",4)) {
573: if(!strnicmp(p,"HUB ",4))
574: cfg.listcfg[cfg.listcfgs-1].misc|=NOFWD;
575: while(*p && *p>' ') p++;
576: while(*p && *p<=' ') p++;
577: if(*p)
578: cfg.listcfg[cfg.listcfgs-1].forward=atofaddr(p);
579: while(*p && *p>' ') p++;
580: while(*p && *p<=' ') p++;
581: if(*p && !(cfg.listcfg[cfg.listcfgs-1].misc&NOFWD)) {
582: tp=p;
583: while(*p && *p>' ') p++;
584: *p=0;
585: ++p;
586: while(*p && *p<=' ') p++;
587: SAFECOPY(cfg.listcfg[cfg.listcfgs-1].password,tp); } }
588: else
589: cfg.listcfg[cfg.listcfgs-1].misc|=NOFWD;
590: if(!*p)
591: continue;
592: tp=p;
593: while(*p && *p>' ') p++;
594: *p=0;
595: p++;
596:
1.1.1.2 ! root 597: SAFECOPY(cfg.listcfg[cfg.listcfgs-1].listpath,tp);
1.1 root 598: cfg.listcfg[cfg.listcfgs-1].numflags=0;
599: cfg.listcfg[cfg.listcfgs-1].flag=NULL;
600: while(*p && *p<=' ') p++; /* Skip over whitespace chars */
601: while(*p) {
602: tp=p;
603: while(*p && *p>' ') p++; /* Find end of this flag */
604: *p=0; /* and terminate it */
605: ++p;
606: for(j=0;j<cfg.listcfg[cfg.listcfgs-1].numflags;j++)
607: if(!strnicmp(cfg.listcfg[cfg.listcfgs-1].flag[j].flag,tp
608: ,strlen(cfg.listcfg[cfg.listcfgs-1].flag[j].flag)))
609: break;
610: if(j==cfg.listcfg[cfg.listcfgs-1].numflags) {
611: if((cfg.listcfg[cfg.listcfgs-1].flag=
612: (flag_t *)realloc(cfg.listcfg[cfg.listcfgs-1].flag
613: ,sizeof(flag_t)*(j+1)))==NULL) {
614: printf("\nError allocating memory for listcfg #%u "
615: "flag #%u.\n",cfg.listcfgs,j+1);
616: bail(1); }
617: cfg.listcfg[cfg.listcfgs-1].numflags++;
1.1.1.2 ! root 618: SAFECOPY(cfg.listcfg[cfg.listcfgs-1].flag[j].flag,tp); }
1.1 root 619: while(*p && *p<=' ') p++; } }
620:
621: /* Message disabled why? ToDo */
622: /* printf("Unrecognized line in SBBSECHO.CFG file.\n"); */
623: }
624: fclose(stream);
625: printf("\n");
626: }
627:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.