Annotation of sbbs/sbbs2/scfglib1.c, revision 1.1

1.1     ! root        1: #line 1 "SCFGLIB1.C"
        !             2: 
        !             3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
        !             4: 
        !             5: #include "sbbs.h"
        !             6: #include "scfglib.h"
        !             7: 
        !             8: void prep_path(char *path)
        !             9: {
        !            10:        char str[LEN_DIR*2];
        !            11:        int i;
        !            12: 
        !            13: if(!path[0])
        !            14:        return;
        !            15: if(path[0]!='\\' && path[1]!=':')           /* Relative to NODE directory */
        !            16:        sprintf(str,"%s%s",node_dir,path);
        !            17: else
        !            18:        strcpy(str,path);
        !            19: i=strlen(str);
        !            20: if(str[i-1]!=':' && str[i-1]!='\\')
        !            21:        strcat(str,"\\");
        !            22: strcat(str,".");                // Change C: to C:. and C:\SBBS\ to C:\SBBS\.
        !            23: _fullpath(path,str,LEN_DIR+1); // Change C:\SBBS\NODE1\..\EXEC to C:\SBBS\EXEC
        !            24: i=strlen(path);
        !            25: if(i && path[i-1]!='\\')
        !            26:        strcat(path,"\\");
        !            27: }
        !            28: 
        !            29: char *get_alloc(long *offset, char *outstr, int maxlen, FILE *instream)
        !            30: {
        !            31: 
        !            32: #ifdef SCFG
        !            33:        fread(outstr,1,maxlen+1,instream);
        !            34:        (*offset)+=maxlen+1;
        !            35: #else
        !            36:        char str[257];
        !            37: 
        !            38:        fread(str,1,maxlen+1,instream);
        !            39: //       lprintf("%s %d %p\r\n",__FILE__,__LINE__,offset);
        !            40:        (*offset)+=maxlen+1;    // this line was commented out (04/12/97) why?
        !            41:        if(!str[0])                     /* Save memory */
        !            42:                return(scfgnulstr);
        !            43:        if((outstr=(char *)MALLOC(strlen(str)+1))==NULL)
        !            44:                return(NULL);
        !            45:        strcpy(outstr,str);
        !            46: #endif
        !            47: 
        !            48: return(outstr);
        !            49: }
        !            50: 
        !            51: #ifdef SCFG    /* SCFG allocate max length */
        !            52:        #define readline_alloc(l,s,m,i) readline(l,s,m,i)
        !            53: #else
        !            54:        char *readline_alloc(long *offset, char *outstr, int maxline
        !            55:                , FILE *instream);
        !            56:        #define readline_alloc(l,s,m,i) s=readline_alloc(l,s,m,i)
        !            57:        #define get_alloc(o,s,l,i) s=get_alloc(o,s,l,i)
        !            58: #endif
        !            59: 
        !            60: /***********************************************************/
        !            61: /* These functions are called from here and must be linked */
        !            62: /***********************************************************/
        !            63: /***
        !            64:        nopen()
        !            65:        truncsp()
        !            66: ***/
        !            67: 
        !            68: void allocerr(read_cfg_text_t txt, long offset, char *fname, uint size)
        !            69: {
        !            70: lprintf(txt.error,offset,fname);
        !            71: lprintf(txt.allocerr,size);
        !            72: bail(1);
        !            73: }
        !            74: 
        !            75: #ifndef NO_NODE_CFG
        !            76: 
        !            77: /****************************************************************************/
        !            78: /* Reads in NODE.CNF and initializes the associated variables                          */
        !            79: /****************************************************************************/
        !            80: void read_node_cfg(read_cfg_text_t txt)
        !            81: {
        !            82:        char    c,str[256],cmd[64],fname[13],*p;
        !            83:        int     i;
        !            84:        short   n;
        !            85:        long    offset=0;
        !            86:        FILE    *instream;
        !            87: 
        !            88: strcpy(fname,"NODE.CNF");
        !            89: sprintf(str,"%s%s",node_dir,fname);
        !            90: if((instream=fnopen(&i,str,O_RDONLY))==NULL) {
        !            91:        lprintf(txt.openerr,str);
        !            92: #ifdef SBBS
        !            93:        lprintf("\r\nSBBS must be run from a NODE directory (e.g. ");
        !            94:        lclatr(WHITE);
        !            95:        lprintf("C:\\SBBS\\NODE1");
        !            96:        lclatr(LIGHTGRAY);
        !            97:        lprintf(").\r\n");
        !            98: #endif
        !            99:        bail(1); }
        !           100: 
        !           101: lprintf(txt.reading,fname);
        !           102: get_int(node_num,instream);
        !           103: if(!node_num) {
        !           104:        lprintf(txt.error,offset,fname);
        !           105:        lprintf("Node number must be non-zero\r\n");
        !           106:        bail(1); }
        !           107: get_str(node_name,instream);
        !           108: get_str(node_phone,instream);
        !           109: get_str(node_comspec,instream);
        !           110: if(!node_comspec[0])
        !           111:        strcpy(node_comspec,"C:\\OS2\\MDOS\\COMMAND.COM");
        !           112: get_int(node_misc,instream);
        !           113: get_int(node_ivt,instream);
        !           114: get_int(node_swap,instream);
        !           115: get_str(node_swapdir,instream);
        !           116: #ifndef SCFG
        !           117: if(!node_swapdir[0])
        !           118:        strcpy(node_swapdir,node_dir);
        !           119: else
        !           120:        prep_path(node_swapdir);
        !           121: #endif
        !           122: get_int(node_valuser,instream);
        !           123: get_int(node_minbps,instream);
        !           124: #ifdef SCFG
        !           125: get_str(node_ar,instream);
        !           126: #else
        !           127: fread(str,1,LEN_ARSTR+1,instream);
        !           128: offset+=LEN_ARSTR+1;
        !           129: node_ar=arstr(0,str);
        !           130: #endif
        !           131: get_int(node_dollars_per_call,instream);
        !           132: get_str(node_editor,instream);
        !           133: get_str(node_viewer,instream);
        !           134: get_str(node_daily,instream);
        !           135: get_int(c,instream);
        !           136: if(c) node_scrnlen=c;
        !           137: get_int(node_scrnblank,instream);
        !           138: get_str(ctrl_dir,instream);                            /* ctrl directory */
        !           139: get_str(text_dir,instream);                            /* text directory */
        !           140: get_str(temp_dir,instream);                            /* temp directory */
        !           141: if(!temp_dir[0])
        !           142:        strcpy(temp_dir,"TEMP");
        !           143: 
        !           144: #ifndef SCFG
        !           145: prep_path(ctrl_dir);
        !           146: prep_path(text_dir);
        !           147: prep_path(temp_dir);
        !           148: #endif
        !           149: 
        !           150: for(i=0;i<10;i++) {                                            /* WFC 0-9 DOS commands */
        !           151:        get_alloc(&offset,wfc_cmd[i],LEN_CMD,instream); }
        !           152: for(i=0;i<12;i++) {                                            /* WFC F1-F12 shrinking DOS cmds */
        !           153:        get_alloc(&offset,wfc_scmd[i],LEN_CMD,instream); }
        !           154: get_str(mdm_hang,instream);
        !           155: get_int(node_sem_check,instream);
        !           156: if(!node_sem_check) node_sem_check=60;
        !           157: get_int(node_stat_check,instream);
        !           158: if(!node_stat_check) node_stat_check=10;
        !           159: get_str(scfg_cmd,instream);
        !           160: if(!scfg_cmd[0])
        !           161:        strcpy(scfg_cmd,"%!scfg %k");
        !           162: get_int(sec_warn,instream);
        !           163: if(!sec_warn)
        !           164:        sec_warn=180;
        !           165: get_int(sec_hangup,instream);
        !           166: if(!sec_hangup)
        !           167:        sec_hangup=300;
        !           168: for(i=0;i<188;i++) {                           /* Unused - initialized to NULL */
        !           169:        fread(&n,1,2,instream);
        !           170:        offset+=2; }
        !           171: for(i=0;i<256;i++) {                           /* Unused - initialized to 0xff */
        !           172:        fread(&n,1,2,instream);
        !           173:        offset+=2; }
        !           174: 
        !           175: /***************/
        !           176: /* Modem Stuff */
        !           177: /***************/
        !           178: 
        !           179: get_int(com_port,instream);
        !           180: get_int(com_irq,instream);
        !           181: get_int(com_base,instream);
        !           182: get_int(com_rate,instream);
        !           183: get_int(mdm_misc,instream);
        !           184: get_str(mdm_init,instream);
        !           185: get_str(mdm_spec,instream);
        !           186: get_str(mdm_term,instream);
        !           187: get_str(mdm_dial,instream);
        !           188: get_str(mdm_offh,instream);
        !           189: get_str(mdm_answ,instream);
        !           190: get_int(mdm_reinit,instream);
        !           191: get_int(mdm_ansdelay,instream);
        !           192: get_int(mdm_rings,instream);
        !           193: 
        !           194: get_int(mdm_results,instream);
        !           195: 
        !           196: if(mdm_results) {
        !           197:        if((mdm_result=(mdm_result_t *)MALLOC(sizeof(mdm_result_t)*mdm_results))
        !           198:                ==NULL)
        !           199:        allocerr(txt,offset,fname,sizeof(mdm_result_t *)*mdm_results); }
        !           200: else
        !           201:        mdm_result=NULL;
        !           202: 
        !           203: for(i=0;i<mdm_results;i++) {
        !           204:        if(feof(instream)) break;
        !           205:        get_int(mdm_result[i].code,instream);
        !           206:        get_int(mdm_result[i].rate,instream);
        !           207:        get_int(mdm_result[i].cps,instream);
        !           208:        get_alloc(&offset,mdm_result[i].str,LEN_MODEM,instream); }
        !           209: mdm_results=i;
        !           210: fclose(instream);
        !           211: lprintf(txt.readit,fname);
        !           212: }
        !           213: 
        !           214: #endif
        !           215: 
        !           216: #ifndef NO_MAIN_CFG
        !           217: 
        !           218: /****************************************************************************/
        !           219: /* Reads in MAIN.CNF and initializes the associated variables                          */
        !           220: /****************************************************************************/
        !           221: void read_main_cfg(read_cfg_text_t txt)
        !           222: {
        !           223:        char    str[256],fname[13],*p,c;
        !           224:        int     file;
        !           225:        short   i,j,n;
        !           226:        long    offset=0;
        !           227:        FILE    *instream;
        !           228: 
        !           229: strcpy(fname,"MAIN.CNF");
        !           230: sprintf(str,"%s%s",ctrl_dir,fname);
        !           231: if((instream=fnopen(&file,str,O_RDONLY))==NULL) {
        !           232:        lprintf(txt.openerr,str);
        !           233:        bail(1); }
        !           234: 
        !           235: lprintf(txt.reading,fname);
        !           236: get_str(sys_name,instream);
        !           237: get_str(sys_id,instream);
        !           238: get_str(sys_location,instream);
        !           239: get_str(sys_phonefmt,instream);
        !           240: get_str(sys_op,instream);
        !           241: get_str(sys_guru,instream);
        !           242: get_str(sys_pass,instream);
        !           243: get_int(sys_nodes,instream);
        !           244: 
        !           245: if(!sys_nodes || sys_nodes<node_num || sys_nodes>MAX_NODES) {
        !           246:        lprintf(txt.error,offset,fname);
        !           247:        if(!sys_nodes)
        !           248:                lprintf("Total nodes on system must be non-zero.\r\n");
        !           249:        else if(sys_nodes>MAX_NODES)
        !           250:                lprintf("Total nodes exceeds %u.\r\n",MAX_NODES);
        !           251:        else
        !           252:                lprintf("Total nodes (%u) < node number in NODE.CNF (%u)\r\n"
        !           253:                        ,sys_nodes,node_num);
        !           254:        bail(1); }
        !           255: 
        !           256: if((node_path=(char **)MALLOC(sizeof(char *)*sys_nodes))==NULL)
        !           257:        allocerr(txt,offset,fname,sizeof(char *)*sys_nodes);
        !           258: 
        !           259: for(i=0;i<sys_nodes;i++) {
        !           260:        if(feof(instream)) break;
        !           261:        fread(str,LEN_DIR+1,1,instream);
        !           262:        offset+=LEN_DIR+1;
        !           263:        if((node_path[i]=(char *)MALLOC(strlen(str)+1))==NULL)
        !           264:                allocerr(txt,offset,fname,strlen(str)+1);
        !           265:        strcpy(node_path[i],str); }
        !           266: 
        !           267: get_str(data_dir,instream);                      /* data directory */
        !           268: get_str(exec_dir,instream);                      /* exec directory */
        !           269: 
        !           270: #ifndef SCFG
        !           271: prep_path(data_dir);
        !           272: prep_path(exec_dir);
        !           273: #endif
        !           274: 
        !           275: get_str(sys_logon,instream);
        !           276: get_str(sys_logout,instream);
        !           277: get_str(sys_daily,instream);
        !           278: get_int(sys_timezone,instream);
        !           279: get_int(sys_misc,instream);
        !           280: get_int(sys_lastnode,instream);
        !           281: get_int(sys_autonode,instream);
        !           282: get_int(uq,instream);
        !           283: get_int(sys_pwdays,instream);
        !           284: get_int(sys_deldays,instream);
        !           285: get_int(sys_exp_warn,instream);        /* Days left till expiration warning */
        !           286: get_int(sys_autodel,instream);
        !           287: get_int(sys_def_stat,instream);        /* default status line */
        !           288: 
        !           289: #ifdef SCFG
        !           290: get_str(sys_chat_ar,instream);
        !           291: #else
        !           292: fread(str,1,LEN_ARSTR+1,instream);
        !           293: offset+=LEN_ARSTR+1;
        !           294: sys_chat_ar=arstr(0,str);
        !           295: #endif
        !           296: 
        !           297: get_int(cdt_min_value,instream);
        !           298: get_int(max_minutes,instream);
        !           299: get_int(cdt_per_dollar,instream);
        !           300: get_str(new_pass,instream);
        !           301: get_str(new_magic,instream);
        !           302: get_str(new_sif,instream);
        !           303: get_str(new_sof,instream);
        !           304: if(!new_sof[0])                /* if output not specified, use input file */
        !           305:        strcpy(new_sof,new_sif);
        !           306: 
        !           307: /*********************/
        !           308: /* New User Settings */
        !           309: /*********************/
        !           310: 
        !           311: get_int(new_level,instream);
        !           312: get_int(new_flags1,instream);
        !           313: get_int(new_flags2,instream);
        !           314: get_int(new_flags3,instream);
        !           315: get_int(new_flags4,instream);
        !           316: get_int(new_exempt,instream);
        !           317: get_int(new_rest,instream);
        !           318: get_int(new_cdt,instream);
        !           319: get_int(new_min,instream);
        !           320: get_str(new_xedit,instream);
        !           321: get_int(new_expire,instream);
        !           322: get_int(new_shell,instream);
        !           323: get_int(new_misc,instream);
        !           324: get_int(new_prot,instream);
        !           325: if(new_prot<SP)
        !           326:        new_prot=SP;
        !           327: get_int(c,instream);
        !           328: for(i=0;i<7;i++)
        !           329:        get_int(n,instream);
        !           330: 
        !           331: /*************************/
        !           332: /* Expired User Settings */
        !           333: /*************************/
        !           334: 
        !           335: get_int(expired_level,instream);
        !           336: get_int(expired_flags1,instream);
        !           337: get_int(expired_flags2,instream);
        !           338: get_int(expired_flags3,instream);
        !           339: get_int(expired_flags4,instream);
        !           340: get_int(expired_exempt,instream);
        !           341: get_int(expired_rest,instream);
        !           342: 
        !           343: get_str(logon_mod,instream);
        !           344: get_str(logoff_mod,instream);
        !           345: get_str(newuser_mod,instream);
        !           346: get_str(login_mod,instream);
        !           347: if(!login_mod[0]) strcpy(login_mod,"LOGIN");
        !           348: get_str(logout_mod,instream);
        !           349: get_str(sync_mod,instream);
        !           350: get_str(expire_mod,instream);
        !           351: get_int(c,instream);
        !           352: 
        !           353: for(i=0;i<224;i++)                                     /* unused - initialized to NULL */
        !           354:        get_int(n,instream);
        !           355: for(i=0;i<256;i++)                                     /* unused - initialized to 0xff */
        !           356:        get_int(n,instream);
        !           357: 
        !           358: /*******************/
        !           359: /* Validation Sets */
        !           360: /*******************/
        !           361: 
        !           362: for(i=0;i<10 && !feof(instream);i++) {
        !           363:        get_int(val_level[i],instream);
        !           364:        get_int(val_expire[i],instream);
        !           365:        get_int(val_flags1[i],instream);
        !           366:        get_int(val_flags2[i],instream);
        !           367:        get_int(val_flags3[i],instream);
        !           368:        get_int(val_flags4[i],instream);
        !           369:        get_int(val_cdt[i],instream);
        !           370:        get_int(val_exempt[i],instream);
        !           371:        get_int(val_rest[i],instream);
        !           372:        for(j=0;j<8;j++)
        !           373:                get_int(n,instream); }
        !           374: 
        !           375: /***************************/
        !           376: /* Security Level Settings */
        !           377: /***************************/
        !           378: 
        !           379: for(i=0;i<100 && !feof(instream);i++) {
        !           380:        get_int(level_timeperday[i],instream);
        !           381:        if(level_timeperday[i]>500)
        !           382:                level_timeperday[i]=500;
        !           383:        get_int(level_timepercall[i],instream);
        !           384:        if(level_timepercall[i]>500)
        !           385:                level_timepercall[i]=500;
        !           386:        get_int(level_callsperday[i],instream);
        !           387:        get_int(level_freecdtperday[i],instream);
        !           388:        get_int(level_linespermsg[i],instream);
        !           389:        get_int(level_postsperday[i],instream);
        !           390:        get_int(level_emailperday[i],instream);
        !           391:        get_int(level_misc[i],instream);
        !           392:        get_int(level_expireto[i],instream);
        !           393:        get_int(c,instream);
        !           394:        for(j=0;j<5;j++)
        !           395:                get_int(n,instream); }
        !           396: if(i!=100) {
        !           397:        lprintf(txt.error,offset,fname);
        !           398:        lprintf("Insufficient User Level Information\r\n"
        !           399:                "%d user levels read, 100 needed.\r\n",i);
        !           400:        bail(1); }
        !           401: 
        !           402: get_int(total_shells,instream);
        !           403: #ifdef SBBS
        !           404: if(!total_shells) {
        !           405:        lprintf(txt.error,offset,fname);
        !           406:        lprintf("At least one command shell must be configured.\r\n");
        !           407:        bail(1); }
        !           408: #endif
        !           409: 
        !           410: if(total_shells) {
        !           411:        if((shell=(shell_t **)MALLOC(sizeof(shell_t *)*total_shells))==NULL)
        !           412:                allocerr(txt,offset,fname,sizeof(shell_t *)*total_shells); }
        !           413: else
        !           414:        shell=NULL;
        !           415: 
        !           416: for(i=0;i<total_shells;i++) {
        !           417:        if(feof(instream)) break;
        !           418:        if((shell[i]=(shell_t *)MALLOC(sizeof(shell_t)))==NULL)
        !           419:                allocerr(txt,offset,fname,sizeof(shell_t));
        !           420:        memset(shell[i],0,sizeof(shell_t));
        !           421: 
        !           422:        get_alloc(&offset,shell[i]->name,40,instream);
        !           423:        get_str(shell[i]->code,instream);
        !           424: #ifdef SCFG
        !           425:        get_str(shell[i]->ar,instream);
        !           426: #else
        !           427:        fread(str,1,LEN_ARSTR+1,instream);
        !           428:        offset+=LEN_ARSTR+1;
        !           429:        shell[i]->ar=arstr(0,str);
        !           430: #endif
        !           431:        get_int(shell[i]->misc,instream);
        !           432:        for(j=0;j<8;j++)
        !           433:                get_int(n,instream);
        !           434:        }
        !           435: total_shells=i;
        !           436: 
        !           437: 
        !           438: fclose(instream);
        !           439: lprintf(txt.readit,fname);
        !           440: }
        !           441: 
        !           442: #endif
        !           443: 
        !           444: #ifndef NO_MSGS_CFG
        !           445: 
        !           446: 
        !           447: /****************************************************************************/
        !           448: /* Reads in MSGS.CNF and initializes the associated variables                          */
        !           449: /****************************************************************************/
        !           450: void read_msgs_cfg(read_cfg_text_t txt)
        !           451: {
        !           452:        char    str[256],fname[13],tmp[128],c;
        !           453:        int     file;
        !           454:        short   i,j,k,l,n;
        !           455:        long    offset=0;
        !           456:        FILE    *instream;
        !           457: 
        !           458: #ifndef SCFG
        !           459: 
        !           460: sprintf(data_dir_subs,"%sSUBS\\",data_dir);
        !           461: prep_path(data_dir_subs);
        !           462: 
        !           463: #endif
        !           464: 
        !           465: strcpy(fname,"MSGS.CNF");
        !           466: sprintf(str,"%s%s",ctrl_dir,fname);
        !           467: if((instream=fnopen(&file,str,O_RDONLY))==NULL) {
        !           468:        lprintf(txt.openerr,str);
        !           469:        bail(1); }
        !           470: 
        !           471: lprintf(txt.reading,fname);
        !           472: 
        !           473: /*************************/
        !           474: /* General Message Stuff */
        !           475: /*************************/
        !           476: 
        !           477: get_int(max_qwkmsgs,instream);
        !           478: get_int(mail_maxcrcs,instream);
        !           479: get_int(mail_maxage,instream);
        !           480: #ifdef SCFG
        !           481:        get_str(preqwk_ar,instream);
        !           482: #else
        !           483:        fread(str,1,LEN_ARSTR+1,instream);
        !           484:        offset+=LEN_ARSTR+1;
        !           485:        preqwk_ar=arstr(0,str);
        !           486: #endif
        !           487: get_int(smb_retry_time,instream);       /* odd byte */
        !           488: if(!smb_retry_time)
        !           489:        smb_retry_time=30;
        !           490: for(i=0;i<235;i++)     /* NULL */
        !           491:        get_int(n,instream);
        !           492: for(i=0;i<256;i++)     /* 0xff */
        !           493:     get_int(n,instream);
        !           494: 
        !           495: 
        !           496: /******************/
        !           497: /* Message Groups */
        !           498: /******************/
        !           499: 
        !           500: get_int(total_grps,instream);
        !           501: 
        !           502: 
        !           503: if(total_grps) {
        !           504:        if((grp=(grp_t **)MALLOC(sizeof(grp_t *)*total_grps))==NULL)
        !           505:                allocerr(txt,offset,fname,sizeof(grp_t *)*total_grps); }
        !           506: else
        !           507:        grp=NULL;
        !           508: 
        !           509: 
        !           510: #ifdef SBBS
        !           511: 
        !           512: if(total_grps) {
        !           513: 
        !           514:        if((cursub=(uint *)MALLOC(sizeof(uint)*total_grps))==NULL)
        !           515:                allocerr(txt,offset,fname,sizeof(uint)*total_grps);
        !           516: 
        !           517:        if((usrgrp=(uint *)MALLOC(sizeof(uint)*total_grps))==NULL)
        !           518:                allocerr(txt,offset,fname,sizeof(uint)*total_grps);
        !           519: 
        !           520:        if((usrsubs=(uint *)MALLOC(sizeof(uint)*total_grps))==NULL)
        !           521:                allocerr(txt,offset,fname,sizeof(uint)*total_grps);
        !           522: 
        !           523:        if((usrsub=(uint **)MALLOC(sizeof(uint *)*total_grps))==NULL)
        !           524:                allocerr(txt,offset,fname,sizeof(uint *)*total_grps); }
        !           525: 
        !           526: #endif
        !           527: 
        !           528: for(i=0;i<total_grps;i++) {
        !           529: 
        !           530:        if(feof(instream)) break;
        !           531:        if((grp[i]=(grp_t *)MALLOC(sizeof(grp_t)))==NULL)
        !           532:                allocerr(txt,offset,fname,sizeof(grp_t));
        !           533:        memset(grp[i],0,sizeof(grp_t));
        !           534: 
        !           535:        get_alloc(&offset,grp[i]->lname,LEN_GLNAME,instream);
        !           536:        get_alloc(&offset,grp[i]->sname,LEN_GSNAME,instream);
        !           537: 
        !           538: #if !defined(SCFG) && defined(SAVE_MEMORY)       /* Save memory */
        !           539:        if(!strcmp(grp[i]->lname,grp[i]->sname) && grp[i]->sname!=scfgnulstr) {
        !           540:                FREE(grp[i]->sname);
        !           541:                grp[i]->sname=grp[i]->lname; }
        !           542: #endif
        !           543: 
        !           544: #ifdef SCFG
        !           545:        get_str(grp[i]->ar,instream);
        !           546: #else
        !           547:        fread(str,1,LEN_ARSTR+1,instream);
        !           548:        offset+=LEN_ARSTR+1;
        !           549:        grp[i]->ar=arstr(0,str);
        !           550: #endif
        !           551:        for(j=0;j<48;j++)
        !           552:                get_int(n,instream);
        !           553:        }
        !           554: total_grps=i;
        !           555: 
        !           556: /**********************/
        !           557: /* Message Sub-boards */
        !           558: /**********************/
        !           559: 
        !           560: get_int(total_subs,instream);
        !           561: 
        !           562: if(total_subs) {
        !           563:        if((sub=(sub_t **)MALLOC(sizeof(sub_t *)*total_subs))==NULL)
        !           564:                allocerr(txt,offset,fname,sizeof(sub_t *)*total_subs); }
        !           565: else
        !           566:        sub=NULL;
        !           567: 
        !           568: #ifdef SBBS
        !           569: 
        !           570: if(total_subs) {
        !           571: 
        !           572:        if((sub_misc=(char *)MALLOC(sizeof(char)*total_subs))==NULL)
        !           573:                allocerr(txt,offset,fname,sizeof(char)*total_subs);
        !           574: 
        !           575:        if((sub_ptr=(ulong *)MALLOC(sizeof(ulong)*total_subs))==NULL)
        !           576:                allocerr(txt,offset,fname,sizeof(ulong)*total_subs);
        !           577: 
        !           578:        if((sub_last=(ulong *)MALLOC(sizeof(ulong)*total_subs))==NULL)
        !           579:                allocerr(txt,offset,fname,sizeof(ulong)*total_subs); }
        !           580: 
        !           581: #endif
        !           582: 
        !           583: for(i=0;i<total_subs;i++) {
        !           584:        if(feof(instream)) break;
        !           585:        if((sub[i]=(sub_t *)MALLOC(sizeof(sub_t)))==NULL)
        !           586:                allocerr(txt,offset,fname,sizeof(sub_t));
        !           587:        memset(sub[i],0,sizeof(sub_t));
        !           588: 
        !           589:        get_int(sub[i]->grp,instream);
        !           590:        get_alloc(&offset,sub[i]->lname,LEN_SLNAME,instream);
        !           591:        get_alloc(&offset,sub[i]->sname,LEN_SSNAME,instream);
        !           592: 
        !           593: #if !defined(SCFG) && defined(SAVE_MEMORY) /* Save memory */
        !           594:        if(!strcmp(sub[i]->lname,sub[i]->sname) && sub[i]->sname!=scfgnulstr) {
        !           595:                FREE(sub[i]->sname);
        !           596:                sub[i]->sname=sub[i]->lname; }
        !           597: #endif
        !           598: 
        !           599:        get_alloc(&offset,sub[i]->qwkname,10,instream);
        !           600: 
        !           601: #if !defined(SCFG) && defined(SAVE_MEMORY)     /* Save memory */
        !           602:        if(!strcmp(sub[i]->qwkname,sub[i]->sname) && sub[i]->qwkname!=scfgnulstr) {
        !           603:                FREE(sub[i]->qwkname);
        !           604:                sub[i]->qwkname=sub[i]->sname; }
        !           605: #endif
        !           606: 
        !           607:        get_str(sub[i]->code,instream);
        !           608: 
        !           609: #ifdef SCFG
        !           610:        get_str(sub[i]->data_dir,instream);
        !           611: #else
        !           612:        fread(str,LEN_DIR+1,1,instream);   /* substitute data dir */
        !           613:        offset+=LEN_DIR+1;
        !           614:        if(str[0]) {
        !           615:                prep_path(str);
        !           616:                if((sub[i]->data_dir=(char *)MALLOC(strlen(str)+1))==NULL)
        !           617:                        allocerr(txt,offset,fname,strlen(str)+1);
        !           618:                strcpy(sub[i]->data_dir,str); }
        !           619:        else
        !           620:                sub[i]->data_dir=data_dir_subs;
        !           621: #endif
        !           622: 
        !           623: 
        !           624: #ifdef SCFG
        !           625:        get_str(sub[i]->ar,instream);
        !           626:        get_str(sub[i]->read_ar,instream);
        !           627:        get_str(sub[i]->post_ar,instream);
        !           628:        get_str(sub[i]->op_ar,instream);
        !           629: #else
        !           630:        fread(str,1,LEN_ARSTR+1,instream);
        !           631:        offset+=LEN_ARSTR+1;
        !           632:        sub[i]->ar=arstr(0,str);
        !           633:        fread(str,1,LEN_ARSTR+1,instream);
        !           634:        offset+=LEN_ARSTR+1;
        !           635:        sub[i]->read_ar=arstr(0,str);
        !           636:        fread(str,1,LEN_ARSTR+1,instream);
        !           637:        offset+=LEN_ARSTR+1;
        !           638:        sub[i]->post_ar=arstr(0,str);
        !           639:        fread(str,1,LEN_ARSTR+1,instream);
        !           640:        offset+=LEN_ARSTR+1;
        !           641:        sub[i]->op_ar=arstr(0,str);
        !           642: #endif
        !           643:        get_int(sub[i]->misc,instream);
        !           644: 
        !           645: 
        !           646: #ifdef SCFG
        !           647:        get_str(sub[i]->tagline,instream);
        !           648: #else
        !           649:        fread(str,81,1,instream);       /* substitute tagline */
        !           650:        offset+=81;
        !           651:        if(str[0]) {
        !           652:                if((sub[i]->tagline=(char *)MALLOC(strlen(str)+1))==NULL)
        !           653:                        allocerr(txt,offset,fname,strlen(str)+1);
        !           654:                strcpy(sub[i]->tagline,str); }
        !           655:        else
        !           656:                sub[i]->tagline=qnet_tagline;
        !           657: #endif
        !           658: 
        !           659: #ifdef SCFG
        !           660:        get_str(sub[i]->origline,instream);
        !           661: #else
        !           662:        fread(str,1,51,instream);       /* substitute origin line */
        !           663:        offset+=51;
        !           664:        if(str[0]) {
        !           665:                if((sub[i]->origline=(char *)MALLOC(strlen(str)+1))==NULL)
        !           666:                        allocerr(txt,offset,fname,strlen(str)+1);
        !           667:                strcpy(sub[i]->origline,str); }
        !           668:        else
        !           669:                sub[i]->origline=origline;
        !           670: #endif
        !           671: 
        !           672: #ifdef SCFG
        !           673:        get_str(sub[i]->echomail_sem,instream);
        !           674: #else
        !           675:        fread(str,1,LEN_DIR+1,instream);   /* substitute echomail semaphore */
        !           676:        offset+=LEN_DIR+1;
        !           677:        if(str[0]) {
        !           678:                if((sub[i]->echomail_sem=(char *)MALLOC(strlen(str)+1))==NULL)
        !           679:                        allocerr(txt,offset,fname,strlen(str)+1);
        !           680:                strcpy(sub[i]->echomail_sem,str); }
        !           681:        else
        !           682:                sub[i]->echomail_sem=echomail_sem;
        !           683: #endif
        !           684:        fread(str,1,LEN_DIR+1,instream);   /* substitute EchoMail path */
        !           685:        offset+=LEN_DIR+1;
        !           686: #ifndef SBBS
        !           687:        backslash(str);
        !           688:        strcpy(sub[i]->echopath,str);
        !           689: #endif
        !           690:        get_int(sub[i]->faddr,instream);                        /* FidoNet address */
        !           691: 
        !           692:        get_int(sub[i]->maxmsgs,instream);
        !           693:        get_int(sub[i]->maxcrcs,instream);
        !           694:        get_int(sub[i]->maxage,instream);
        !           695:        get_int(sub[i]->ptridx,instream);
        !           696: #ifdef SBBS
        !           697:        for(j=0;j<i;j++)
        !           698:                if(sub[i]->ptridx==sub[j]->ptridx) {
        !           699:                        lprintf(txt.error,offset,fname);
        !           700:                        lprintf("Duplicate pointer index for subs #%d and #%d\r\n"
        !           701:                                ,i+1,j+1);
        !           702:                        bail(1); }
        !           703: #endif
        !           704: 
        !           705: #ifdef SCFG
        !           706:        get_str(sub[i]->mod_ar,instream);
        !           707: #else
        !           708:        fread(str,1,LEN_ARSTR+1,instream);
        !           709:        offset+=LEN_ARSTR+1;
        !           710:        sub[i]->mod_ar=arstr(0,str);
        !           711: #endif
        !           712:        get_int(sub[i]->qwkconf,instream);
        !           713:        get_int(c,instream);
        !           714:        for(j=0;j<26;j++)
        !           715:                get_int(n,instream);
        !           716:        }
        !           717: total_subs=i;
        !           718: 
        !           719: #ifdef SBBS
        !           720: for(i=l=0;i<total_grps;i++) {
        !           721:        for(j=k=0;j<total_subs;j++)
        !           722:                if(sub[j]->grp==i)
        !           723:                        k++;    /* k = number of subs per grp[i] */
        !           724:        if(k>l) l=k; }  /* l = the largest number of subs per grp */
        !           725: if(l)
        !           726:        for(i=0;i<total_grps;i++)
        !           727:                if((usrsub[i]=(uint *)MALLOC(sizeof(uint)*l))==NULL)
        !           728:                        allocerr(txt,offset,fname,sizeof(uint)*l);
        !           729: 
        !           730: if(sys_status&SS_INITIAL) {
        !           731:        fclose(instream);
        !           732:        lprintf(txt.readit,fname);
        !           733:        return; }
        !           734: #endif
        !           735: 
        !           736: /***********/
        !           737: /* FidoNet */
        !           738: /***********/
        !           739: 
        !           740: get_int(total_faddrs,instream);
        !           741: 
        !           742: if(total_faddrs) {
        !           743:        if((faddr=(faddr_t *)MALLOC(sizeof(faddr_t)*total_faddrs))==NULL)
        !           744:                allocerr(txt,offset,fname,sizeof(faddr_t)*total_faddrs); }
        !           745: else
        !           746:        faddr=NULL;
        !           747: 
        !           748: for(i=0;i<total_faddrs;i++)
        !           749:        get_int(faddr[i],instream);
        !           750: 
        !           751: get_str(origline,instream);
        !           752: get_str(netmail_sem,instream);
        !           753: get_str(echomail_sem,instream);
        !           754: get_str(netmail_dir,instream);
        !           755: get_str(echomail_dir,instream);
        !           756: get_str(fidofile_dir,instream);
        !           757: get_int(netmail_misc,instream);
        !           758: get_int(netmail_cost,instream);
        !           759: get_int(dflt_faddr,instream);
        !           760: for(i=0;i<28;i++)
        !           761:     get_int(n,instream);
        !           762: 
        !           763: 
        !           764: /**********/
        !           765: /* QWKnet */
        !           766: /**********/
        !           767: 
        !           768: get_str(qnet_tagline,instream);
        !           769: 
        !           770: get_int(total_qhubs,instream);
        !           771: 
        !           772: if(total_qhubs) {
        !           773:        if((qhub=(qhub_t **)MALLOC(sizeof(qhub_t *)*total_qhubs))==NULL)
        !           774:                allocerr(txt,offset,fname,sizeof(qhub_t*)*total_qhubs); }
        !           775: else
        !           776:        qhub=NULL;
        !           777: 
        !           778: for(i=0;i<total_qhubs;i++) {
        !           779:     if(feof(instream)) break;
        !           780:        if((qhub[i]=(qhub_t *)MALLOC(sizeof(qhub_t)))==NULL)
        !           781:         allocerr(txt,offset,fname,sizeof(qhub_t));
        !           782:     memset(qhub[i],0,sizeof(qhub_t));
        !           783: 
        !           784:        get_str(qhub[i]->id,instream);
        !           785:        get_int(qhub[i]->time,instream);
        !           786:        get_int(qhub[i]->freq,instream);
        !           787:        get_int(qhub[i]->days,instream);
        !           788:        get_int(qhub[i]->node,instream);
        !           789:        get_alloc(&offset,qhub[i]->call,LEN_CMD,instream);
        !           790:        get_alloc(&offset,qhub[i]->pack,LEN_CMD,instream);
        !           791:        get_alloc(&offset,qhub[i]->unpack,LEN_CMD,instream);
        !           792:        get_int(k,instream);
        !           793: 
        !           794:        if(k) {
        !           795:                if((qhub[i]->sub=(ushort *)MALLOC(sizeof(ushort)*k))==NULL)
        !           796:                        allocerr(txt,offset,fname,sizeof(uint)*k);
        !           797:                if((qhub[i]->conf=(ushort *)MALLOC(sizeof(ushort)*k))==NULL)
        !           798:                        allocerr(txt,offset,fname,sizeof(ushort)*k);
        !           799:                if((qhub[i]->mode=(uchar *)MALLOC(sizeof(uchar)*k))==NULL)
        !           800:                        allocerr(txt,offset,fname,sizeof(uchar)*k); }
        !           801: 
        !           802:        for(j=0;j<k;j++) {
        !           803:                if(feof(instream)) break;
        !           804:                get_int(qhub[i]->conf[qhub[i]->subs],instream);
        !           805:                get_int(qhub[i]->sub[qhub[i]->subs],instream);
        !           806:                get_int(qhub[i]->mode[qhub[i]->subs],instream);
        !           807:                if(qhub[i]->sub[qhub[i]->subs]<total_subs)
        !           808:             sub[qhub[i]->sub[qhub[i]->subs]]->misc|=SUB_QNET;
        !           809:                else
        !           810:                        continue;
        !           811:                if(qhub[i]->sub[qhub[i]->subs]!=INVALID_SUB)
        !           812:                        qhub[i]->subs++; }
        !           813:        for(j=0;j<32;j++)
        !           814:                get_int(n,instream); }
        !           815: 
        !           816: total_qhubs=i;
        !           817: 
        !           818: for(j=0;j<32;j++)
        !           819:        get_int(n,instream);
        !           820: 
        !           821: /************/
        !           822: /* PostLink */
        !           823: /************/
        !           824: 
        !           825: fread(str,11,1,instream);              /* Unused - used to be Site Name */
        !           826: offset+=11;
        !           827: get_int(sys_psnum,instream);   /* Site Number */
        !           828: get_int(total_phubs,instream);
        !           829: 
        !           830: if(total_phubs) {
        !           831:        if((phub=(phub_t **)MALLOC(sizeof(phub_t *)*total_phubs))==NULL)
        !           832:                allocerr(txt,offset,fname,sizeof(phub_t*)*total_phubs); }
        !           833: else
        !           834:        phub=NULL;
        !           835: 
        !           836: for(i=0;i<total_phubs;i++) {
        !           837:     if(feof(instream)) break;
        !           838:     if((phub[i]=(phub_t *)MALLOC(sizeof(phub_t)))==NULL)
        !           839:         allocerr(txt,offset,fname,sizeof(phub_t));
        !           840:        memset(phub[i],0,sizeof(phub_t));
        !           841: #ifdef SCFG
        !           842:        get_str(phub[i]->name,instream);
        !           843: #else
        !           844:        fread(str,11,1,instream);
        !           845:        offset+=11;
        !           846: #endif
        !           847:        get_int(phub[i]->time,instream);
        !           848:        get_int(phub[i]->freq,instream);
        !           849:        get_int(phub[i]->days,instream);
        !           850:        get_int(phub[i]->node,instream);
        !           851:        get_alloc(&offset,phub[i]->call,LEN_CMD,instream);
        !           852:        for(j=0;j<32;j++)
        !           853:                get_int(n,instream); }
        !           854: 
        !           855: total_phubs=i;
        !           856: 
        !           857: get_str(sys_psname,instream);  /* Site Name */
        !           858: 
        !           859: for(j=0;j<32;j++)
        !           860:     get_int(n,instream);
        !           861: 
        !           862: /* Internet */
        !           863: 
        !           864: get_str(sys_inetaddr,instream); /* Internet address */
        !           865: get_str(inetmail_sem,instream);
        !           866: get_int(inetmail_misc,instream);
        !           867: get_int(inetmail_cost,instream);
        !           868: 
        !           869: fclose(instream);
        !           870: lprintf(txt.readit,fname);
        !           871: }
        !           872: 
        !           873: #endif
        !           874: 

unix.superglobalmegacorp.com

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