Annotation of sbbs/sbbs3/rechocfg.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.