Annotation of sbbs/sbbs2/scfglib2.c, revision 1.1.1.1

1.1       root        1: #line 1 "SCFGLIB2.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: #ifdef SCFG    /* SCFG allocate max length */
                      9:        #define readline_alloc(l,s,m,i) readline(l,s,m,i)
                     10: #else
                     11:        char *readline_alloc(long *offset, char *outstr, int maxline
                     12:                , FILE *instream);
                     13:        #define readline_alloc(l,s,m,i) s=readline_alloc(l,s,m,i)
                     14:        #define get_alloc(o,s,l,i) s=get_alloc(o,s,l,i)
                     15: #endif
                     16: 
                     17: 
                     18: #ifndef NO_FILE_CFG
                     19: 
                     20: /****************************************************************************/
                     21: /* Reads in LIBS.CNF and initializes the associated variables                          */
                     22: /****************************************************************************/
                     23: void read_file_cfg(read_cfg_text_t txt)
                     24: {
                     25:        char    str[256],fname[13],c,cmd[LEN_CMD+1];
                     26:        int     file;
                     27:        short   i,j,k,l,n;
                     28:        long    offset=0,t;
                     29:        FILE    *instream;
                     30: 
                     31: #ifndef SCFG
                     32: 
                     33: sprintf(data_dir_dirs,"%sDIRS\\",data_dir);
                     34: 
                     35: #endif
                     36: 
                     37: strcpy(fname,"FILE.CNF");
                     38: sprintf(str,"%s%s",ctrl_dir,fname);
                     39: if((instream=fnopen(&file,str,O_RDONLY))==NULL) {
                     40:        lprintf(txt.openerr,str);
                     41:        bail(1); }
                     42: 
                     43: lprintf(txt.reading,fname);
                     44: 
                     45: get_int(min_dspace,instream);
                     46: get_int(max_batup,instream);
                     47: 
                     48: #ifdef SBBS
                     49: if(max_batup) {
                     50:     if((batup_desc=(char **)MALLOC(sizeof(char *)*max_batup))==NULL)
                     51:         allocerr(txt,offset,fname,sizeof(char *)*max_batup);
                     52:     if((batup_name=(char **)MALLOC(sizeof(char *)*max_batup))==NULL)
                     53:         allocerr(txt,offset,fname,sizeof(char *)*max_batup);
                     54:     if((batup_misc=(char *)MALLOC(sizeof(char)*max_batup))==NULL)
                     55:         allocerr(txt,offset,fname,sizeof(char)*max_batup);
                     56:     if((batup_dir=(uint *)MALLOC(sizeof(uint)*max_batup))==NULL)
                     57:         allocerr(txt,offset,fname,sizeof(uint)*max_batup);
                     58:        if((batup_alt=(ushort *)MALLOC(sizeof(ushort)*max_batup))==NULL)
                     59:                allocerr(txt,offset,fname,sizeof(ushort)*max_batup);
                     60:     for(i=0;i<max_batup;i++) {
                     61:         if((batup_desc[i]=(char *)MALLOC(59))==NULL)
                     62:             allocerr(txt,offset,fname,59);
                     63:         if((batup_name[i]=(char *)MALLOC(13))==NULL)
                     64:             allocerr(txt,offset,fname,13); } }
                     65: #endif
                     66: get_int(max_batdn,instream);
                     67: 
                     68: #ifdef SBBS
                     69: if(max_batdn) {
                     70:     if((batdn_name=(char **)MALLOC(sizeof(char *)*max_batdn))==NULL)
                     71:         allocerr(txt,offset,fname,sizeof(char *)*max_batdn);
                     72:     if((batdn_dir=(uint *)MALLOC(sizeof(uint)*max_batdn))==NULL)
                     73:         allocerr(txt,offset,fname,sizeof(uint)*max_batdn);
                     74:     if((batdn_offset=(long *)MALLOC(sizeof(long)*max_batdn))==NULL)
                     75:         allocerr(txt,offset,fname,sizeof(long)*max_batdn);
                     76:     if((batdn_size=(ulong *)MALLOC(sizeof(ulong)*max_batdn))==NULL)
                     77:         allocerr(txt,offset,fname,sizeof(ulong)*max_batdn);
                     78:     if((batdn_cdt=(ulong *)MALLOC(sizeof(ulong)*max_batdn))==NULL)
                     79:         allocerr(txt,offset,fname,sizeof(ulong)*max_batdn);
                     80:        if((batdn_alt=(ushort *)MALLOC(sizeof(ushort)*max_batdn))==NULL)
                     81:                allocerr(txt,offset,fname,sizeof(ushort)*max_batdn);
                     82:     for(i=0;i<max_batdn;i++)
                     83:         if((batdn_name[i]=(char *)MALLOC(13))==NULL)
                     84:             allocerr(txt,offset,fname,13); }
                     85: #endif
                     86: get_int(max_userxfer,instream);
                     87: 
                     88: get_int(t,instream);   /* unused - was cdt_byte_value */
                     89: get_int(cdt_up_pct,instream);
                     90: get_int(cdt_dn_pct,instream);
                     91: get_int(t,instream);   /* unused - was temp_ext */
                     92: get_str(cmd,instream); /* unused - was temp_cmd */
                     93: get_int(leech_pct,instream);
                     94: get_int(leech_sec,instream);
                     95: 
                     96: for(i=0;i<32;i++)
                     97:        get_int(n,instream);
                     98: 
                     99: /**************************/
                    100: /* Extractable File Types */
                    101: /**************************/
                    102: 
                    103: get_int(total_fextrs,instream);
                    104: 
                    105: if(total_fextrs) {
                    106:        if((fextr=(fextr_t **)MALLOC(sizeof(fextr_t *)*total_fextrs))==NULL)
                    107:                allocerr(txt,offset,fname,sizeof(fextr_t*)*total_fextrs); }
                    108: else
                    109:        fextr=NULL;
                    110: 
                    111: for(i=0; i<total_fextrs; i++) {
                    112:        if(feof(instream))
                    113:                break;
                    114:        if((fextr[i]=(fextr_t *)MALLOC(sizeof(fextr_t)))==NULL)
                    115:         allocerr(txt,offset,fname,sizeof(fextr_t));
                    116:     memset(fextr[i],0,sizeof(fextr_t));
                    117:        get_str(fextr[i]->ext,instream);
                    118:        get_alloc(&offset,fextr[i]->cmd,LEN_CMD,instream);
                    119: #ifdef SCFG
                    120:        get_str(fextr[i]->ar,instream);
                    121: #else
                    122:        fread(str,LEN_ARSTR+1,1,instream);
                    123:        offset+=LEN_ARSTR+1;
                    124:        fextr[i]->ar=arstr(0,str);
                    125: #endif
                    126:        for(j=0;j<8;j++)
                    127:                get_int(n,instream);
                    128:        }
                    129: total_fextrs=i;
                    130: 
                    131: /***************************/
                    132: /* Compressable File Types */
                    133: /***************************/
                    134: 
                    135: get_int(total_fcomps,instream);
                    136: 
                    137: if(total_fcomps) {
                    138:        if((fcomp=(fcomp_t **)MALLOC(sizeof(fcomp_t *)*total_fcomps))==NULL)
                    139:                allocerr(txt,offset,fname,sizeof(fcomp_t*)*total_fcomps); }
                    140: else
                    141:        fcomp=NULL;
                    142: 
                    143: for(i=0; i<total_fcomps; i++) {
                    144:        if(feof(instream))
                    145:                break;
                    146:        if((fcomp[i]=(fcomp_t *)MALLOC(sizeof(fcomp_t)))==NULL)
                    147:                allocerr(txt,offset,fname,sizeof(fcomp_t));
                    148:        memset(fcomp[i],0,sizeof(fcomp_t));
                    149:        get_str(fcomp[i]->ext,instream);
                    150:        get_alloc(&offset,fcomp[i]->cmd,LEN_CMD,instream);
                    151: #ifdef SCFG
                    152:        get_str(fcomp[i]->ar,instream);
                    153: #else
                    154:        fread(str,LEN_ARSTR+1,1,instream);
                    155:        offset+=LEN_ARSTR+1;
                    156:        fcomp[i]->ar=arstr(0,str);
                    157: #endif
                    158:        for(j=0;j<8;j++)
                    159:                get_int(n,instream);
                    160:        }
                    161: total_fcomps=i;
                    162: 
                    163: /***********************/
                    164: /* Viewable File Types */
                    165: /***********************/
                    166: 
                    167: get_int(total_fviews,instream);
                    168: 
                    169: if(total_fviews) {
                    170:        if((fview=(fview_t **)MALLOC(sizeof(fview_t *)*total_fviews))==NULL)
                    171:                allocerr(txt,offset,fname,sizeof(fview_t*)*total_fviews); }
                    172: else
                    173:        fview=NULL;
                    174: 
                    175: for(i=0; i<total_fviews; i++) {
                    176:     if(feof(instream)) break;
                    177:        if((fview[i]=(fview_t *)MALLOC(sizeof(fview_t)))==NULL)
                    178:         allocerr(txt,offset,fname,sizeof(fview_t));
                    179:     memset(fview[i],0,sizeof(fview_t));
                    180:        get_str(fview[i]->ext,instream);
                    181:        get_alloc(&offset,fview[i]->cmd,LEN_CMD,instream);
                    182: #ifdef SCFG
                    183:        get_str(fview[i]->ar,instream);
                    184: #else
                    185:        fread(str,LEN_ARSTR+1,1,instream);
                    186:        offset+=LEN_ARSTR+1;
                    187:        fview[i]->ar=arstr(0,str);
                    188: #endif
                    189:        for(j=0;j<8;j++)
                    190:         get_int(n,instream);
                    191:     }
                    192: total_fviews=i;
                    193: 
                    194: /***********************/
                    195: /* Testable File Types */
                    196: /***********************/
                    197: 
                    198: get_int(total_ftests,instream);
                    199: 
                    200: if(total_ftests) {
                    201:        if((ftest=(ftest_t **)MALLOC(sizeof(ftest_t *)*total_ftests))==NULL)
                    202:                allocerr(txt,offset,fname,sizeof(ftest_t*)*total_ftests); }
                    203: else
                    204:        ftest=NULL;
                    205: 
                    206: for(i=0; i<total_ftests; i++) {
                    207:     if(feof(instream)) break;
                    208:     if((ftest[i]=(ftest_t *)MALLOC(sizeof(ftest_t)))==NULL)
                    209:         allocerr(txt,offset,fname,sizeof(ftest_t));
                    210:     memset(ftest[i],0,sizeof(ftest_t));
                    211:        get_str(ftest[i]->ext,instream);
                    212:        get_alloc(&offset,ftest[i]->cmd,LEN_CMD,instream);
                    213:        get_alloc(&offset,ftest[i]->workstr,40,instream);
                    214: #ifdef SCFG
                    215:        get_str(ftest[i]->ar,instream);
                    216: #else
                    217:        fread(str,LEN_ARSTR+1,1,instream);
                    218:        offset+=LEN_ARSTR+1;
                    219:        ftest[i]->ar=arstr(0,str);
                    220: #endif
                    221:        for(j=0;j<8;j++)
                    222:         get_int(n,instream);
                    223:     }
                    224: total_ftests=i;
                    225: 
                    226: /*******************/
                    227: /* Download events */
                    228: /*******************/
                    229: 
                    230: get_int(total_dlevents,instream);
                    231: 
                    232: if(total_dlevents) {
                    233:        if((dlevent=(dlevent_t **)MALLOC(sizeof(dlevent_t *)*total_dlevents))
                    234:                ==NULL)
                    235:                allocerr(txt,offset,fname,sizeof(dlevent_t*)*total_dlevents); }
                    236: else
                    237:        dlevent=NULL;
                    238: 
                    239: for(i=0; i<total_dlevents; i++) {
                    240:     if(feof(instream)) break;
                    241:        if((dlevent[i]=(dlevent_t *)MALLOC(sizeof(dlevent_t)))==NULL)
                    242:                allocerr(txt,offset,fname,sizeof(dlevent_t));
                    243:        memset(dlevent[i],0,sizeof(dlevent_t));
                    244:        get_str(dlevent[i]->ext,instream);
                    245:        get_alloc(&offset,dlevent[i]->cmd,LEN_CMD,instream);
                    246:        get_alloc(&offset,dlevent[i]->workstr,40,instream);
                    247: #ifdef SCFG
                    248:        get_str(dlevent[i]->ar,instream);
                    249: #else
                    250:        fread(str,LEN_ARSTR+1,1,instream);
                    251:        offset+=LEN_ARSTR+1;
                    252:        dlevent[i]->ar=arstr(0,str);
                    253: #endif
                    254:        for(j=0;j<8;j++)
                    255:         get_int(n,instream);
                    256:     }
                    257: total_dlevents=i;
                    258: 
                    259: 
                    260: /***************************/
                    261: /* File Transfer Protocols */
                    262: /***************************/
                    263: 
                    264: get_int(total_prots,instream);
                    265: 
                    266: if(total_prots) {
                    267:        if((prot=(prot_t **)MALLOC(sizeof(prot_t *)*total_prots))==NULL)
                    268:                allocerr(txt,offset,fname,sizeof(prot_t*)*total_prots); }
                    269: else
                    270:        prot=NULL;
                    271: 
                    272: for(i=0;i<total_prots;i++) {
                    273:     if(feof(instream)) break;
                    274:        if((prot[i]=(prot_t *)MALLOC(sizeof(prot_t)))==NULL)
                    275:         allocerr(txt,offset,fname,sizeof(prot_t));
                    276:     memset(prot[i],0,sizeof(prot_t));
                    277: 
                    278:        get_int(prot[i]->mnemonic,instream);
                    279:        get_alloc(&offset,prot[i]->name,25,instream);
                    280:        get_alloc(&offset,prot[i]->ulcmd,LEN_CMD,instream);
                    281:        get_alloc(&offset,prot[i]->dlcmd,LEN_CMD,instream);
                    282:        get_alloc(&offset,prot[i]->batulcmd,LEN_CMD,instream);
                    283:        get_alloc(&offset,prot[i]->batdlcmd,LEN_CMD,instream);
                    284:        get_alloc(&offset,prot[i]->blindcmd,LEN_CMD,instream);
                    285:        get_alloc(&offset,prot[i]->bicmd,LEN_CMD,instream);
                    286:        get_int(prot[i]->misc,instream);
                    287: #ifdef SCFG
                    288:        get_str(prot[i]->ar,instream);
                    289: #else
                    290:        fread(str,LEN_ARSTR+1,1,instream);
                    291:        offset+=LEN_ARSTR+1;
                    292:        prot[i]->ar=arstr(0,str);
                    293: #endif
                    294:        for(j=0;j<8;j++)
                    295:         get_int(n,instream);
                    296:        }
                    297: 
                    298: /************************/
                    299: /* Alternate File Paths */
                    300: /************************/
                    301: 
                    302: get_int(altpaths,instream);
                    303: 
                    304: if(altpaths) {
                    305:        if((altpath=(char **)MALLOC(sizeof(char *)*altpaths))==NULL)
                    306:                allocerr(txt,offset,fname,sizeof(char *)*altpaths); }
                    307: else
                    308:        altpath=NULL;
                    309: 
                    310: for(i=0;i<altpaths;i++) {
                    311:     if(feof(instream)) break;
                    312:        fread(str,LEN_DIR+1,1,instream);
                    313:        offset+=LEN_DIR+1;
                    314:     backslash(str);
                    315: #ifdef SCFG
                    316:     j=LEN_DIR+1;
                    317: #else
                    318:     j=strlen(str)+1;
                    319: #endif
                    320:        if((altpath[i]=(char *)MALLOC(j))==NULL)
                    321:         allocerr(txt,offset,fname,j);
                    322:        memset(altpath[i],0,j);
                    323:        strcpy(altpath[i],str);
                    324:        for(j=0;j<8;j++)
                    325:         get_int(n,instream);
                    326:        }
                    327: 
                    328: altpaths=i;
                    329: 
                    330: /******************/
                    331: /* File Libraries */
                    332: /******************/
                    333: 
                    334: get_int(total_libs,instream);
                    335: 
                    336: if(total_libs) {
                    337:        if((lib=(lib_t **)MALLOC(sizeof(lib_t *)*total_libs))==NULL)
                    338:                allocerr(txt,offset,fname,sizeof(lib_t *)*total_libs); }
                    339: else
                    340:        lib=NULL;
                    341: 
                    342: #ifdef SBBS
                    343: 
                    344: if(total_libs) {
                    345:        if((curdir=(uint *)MALLOC(sizeof(uint)*total_libs))==NULL)
                    346:                allocerr(txt,offset,fname,sizeof(uint)*total_libs);
                    347: 
                    348:        if((usrlib=(uint *)MALLOC(sizeof(uint)*total_libs))==NULL)
                    349:                allocerr(txt,offset,fname,sizeof(uint)*total_libs);
                    350: 
                    351:        if((usrdirs=(uint *)MALLOC(sizeof(uint)*total_libs))==NULL)
                    352:                allocerr(txt,offset,fname,sizeof(uint)*total_libs);
                    353: 
                    354:        if((usrdir=(uint **)MALLOC(sizeof(uint *)*total_libs))==NULL)
                    355:                allocerr(txt,offset,fname,sizeof(uint *)*total_libs); }
                    356: 
                    357: #endif
                    358: for(i=0;i<total_libs;i++) {
                    359:        if(feof(instream)) break;
                    360:        if((lib[i]=(lib_t *)MALLOC(sizeof(lib_t)))==NULL)
                    361:         allocerr(txt,offset,fname,sizeof(lib_t));
                    362:     memset(lib[i],0,sizeof(lib_t));
                    363:        lib[i]->offline_dir=INVALID_DIR;
                    364: 
                    365:        get_alloc(&offset,lib[i]->lname,LEN_GLNAME,instream);
                    366:        get_alloc(&offset,lib[i]->sname,LEN_GSNAME,instream);
                    367: 
                    368: #if !defined(SCFG) && defined(SAVE_MEMORY)       /* Save memory */
                    369:        if(!strcmp(lib[i]->lname,lib[i]->sname) && lib[i]->sname!=scfgnulstr) {
                    370:                FREE(lib[i]->sname);
                    371:                lib[i]->sname=lib[i]->lname; }
                    372: #endif
                    373: 
                    374: #ifdef SCFG
                    375:        get_str(lib[i]->ar,instream);
                    376: #else
                    377:        fread(str,1,LEN_ARSTR+1,instream);
                    378:        offset+=LEN_ARSTR+1;
                    379:        lib[i]->ar=arstr(0,str);
                    380: #endif
                    381:        for(j=0;j<48;j++)
                    382:                get_int(n,instream);
                    383:        }
                    384: total_libs=i;
                    385: 
                    386: /********************/
                    387: /* File Directories */
                    388: /********************/
                    389: 
                    390: sysop_dir=user_dir=upload_dir=INVALID_DIR;
                    391: get_int(total_dirs,instream);
                    392: 
                    393: if(total_dirs) {
                    394:        if((dir=(dir_t **)MALLOC(sizeof(dir_t *)*(total_dirs+1)))==NULL)
                    395:                allocerr(txt,offset,fname,sizeof(dir_t *)*(total_dirs+1)); }
                    396: else
                    397:        dir=NULL;
                    398: 
                    399: for(i=0;i<total_dirs;i++) {
                    400:        if(feof(instream)) break;
                    401:        if((dir[i]=(dir_t *)MALLOC(sizeof(dir_t)))==NULL)
                    402:         allocerr(txt,offset,fname,sizeof(dir_t));
                    403:        memset(dir[i],0,sizeof(dir_t));
                    404: 
                    405:        get_int(dir[i]->lib,instream);
                    406:        get_alloc(&offset,dir[i]->lname,LEN_SLNAME,instream);
                    407:        get_alloc(&offset,dir[i]->sname,LEN_SSNAME,instream);
                    408: 
                    409: #if !defined(SCFG) && defined(SAVE_MEMORY)       /* Save memory */
                    410:        if(!strcmp(dir[i]->lname,dir[i]->sname) && dir[i]->sname!=scfgnulstr) {
                    411:                FREE(dir[i]->sname);
                    412:                dir[i]->sname=dir[i]->lname; }
                    413: #endif
                    414: 
                    415:        if(!strcmpi(dir[i]->sname,"SYSOP"))                     /* Sysop upload directory */
                    416:                sysop_dir=i;
                    417:        else if(!strcmpi(dir[i]->sname,"USER"))         /* User to User xfer dir */
                    418:                user_dir=i;
                    419:        else if(!strcmpi(dir[i]->sname,"UPLOADS"))  /* Upload directory */
                    420:                upload_dir=i;
                    421:        else if(!strcmpi(dir[i]->sname,"OFFLINE"))      /* Offline files dir */
                    422:                lib[dir[i]->lib]->offline_dir=i;
                    423: 
                    424:        get_str(dir[i]->code,instream);
                    425: 
                    426: #ifdef SCFG
                    427:        get_str(dir[i]->data_dir,instream);
                    428: #else
                    429:        fread(str,LEN_DIR+1,1,instream);   /* substitute data dir */
                    430:        offset+=LEN_DIR+1;
                    431:        if(str[0]) {
                    432:                backslash(str);
                    433:                if((dir[i]->data_dir=(char *)MALLOC(strlen(str)+1))==NULL)
                    434:                        allocerr(txt,offset,fname,strlen(str)+1);
                    435:                strcpy(dir[i]->data_dir,str); }
                    436:        else
                    437:                dir[i]->data_dir=data_dir_dirs;
                    438: #endif
                    439: 
                    440: #ifdef SCFG
                    441:        get_str(dir[i]->ar,instream);
                    442:        get_str(dir[i]->ul_ar,instream);
                    443:        get_str(dir[i]->dl_ar,instream);
                    444:        get_str(dir[i]->op_ar,instream);
                    445: #else
                    446:        fread(str,1,LEN_ARSTR+1,instream);
                    447:        offset+=LEN_ARSTR+1;
                    448:        dir[i]->ar=arstr(0,str);
                    449:        fread(str,1,LEN_ARSTR+1,instream);
                    450:        offset+=LEN_ARSTR+1;
                    451:        dir[i]->ul_ar=arstr(0,str);
                    452:        fread(str,1,LEN_ARSTR+1,instream);
                    453:        offset+=LEN_ARSTR+1;
                    454:        dir[i]->dl_ar=arstr(0,str);
                    455:        fread(str,1,LEN_ARSTR+1,instream);
                    456:        offset+=LEN_ARSTR+1;
                    457:        dir[i]->op_ar=arstr(0,str);
                    458: #endif
                    459:        fread(str,1,LEN_DIR+1,instream);
                    460:        offset+=LEN_DIR+1;
                    461:        if(!str[0])                                /* no path specified */
                    462:                sprintf(str,"%sDIRS\\%s\\",data_dir,dir[i]->code);
                    463: 
                    464: #ifndef SCFG
                    465:        if((dir[i]->path=(char *)MALLOC(strlen(str)+1))==NULL)
                    466:                allocerr(txt,offset,fname,strlen(str)+1);
                    467: #endif
                    468:        strcpy(dir[i]->path,str);
                    469:        get_alloc(&offset,dir[i]->upload_sem,LEN_DIR,instream);
                    470:        get_int(dir[i]->maxfiles,instream);
                    471:        if(dir[i]->maxfiles>MAX_FILES)
                    472:                dir[i]->maxfiles=MAX_FILES;
                    473:        get_alloc(&offset,dir[i]->exts,40,instream);
                    474:        get_int(dir[i]->misc,instream);
                    475:        get_int(dir[i]->seqdev,instream);
                    476:        get_int(dir[i]->sort,instream);
                    477: #ifdef SCFG
                    478:        get_str(dir[i]->ex_ar,instream);
                    479: #else
                    480:        fread(str,1,LEN_ARSTR+1,instream);
                    481:        offset+=LEN_ARSTR+1;
                    482:        dir[i]->ex_ar=arstr(0,str);
                    483: #endif
                    484:        get_int(dir[i]->maxage,instream);
                    485:        get_int(dir[i]->up_pct,instream);
                    486:        get_int(dir[i]->dn_pct,instream);
                    487:        get_int(c,instream);
                    488:        for(j=0;j<24;j++)
                    489:                get_int(n,instream); }
                    490: 
                    491: total_dirs=i;
                    492: 
                    493: #ifndef NO_TEXT_CFG            /* This must be the last section in CFG file */
                    494: 
                    495: /**********************/
                    496: /* Text File Sections */
                    497: /**********************/
                    498: 
                    499: get_int(total_txtsecs,instream);
                    500: 
                    501: 
                    502: if(total_txtsecs) {
                    503:        if((txtsec=(txtsec_t **)MALLOC(sizeof(txtsec_t *)*total_txtsecs))==NULL)
                    504:                allocerr(txt,offset,fname,sizeof(txtsec_t *)*total_txtsecs); }
                    505: else
                    506:        txtsec=NULL;
                    507: 
                    508: for(i=0;i<total_txtsecs;i++) {
                    509:     if(feof(instream)) break;
                    510:     if((txtsec[i]=(txtsec_t *)MALLOC(sizeof(txtsec_t)))==NULL)
                    511:         allocerr(txt,offset,fname,sizeof(txtsec_t));
                    512:        memset(txtsec[i],0,sizeof(txtsec_t));
                    513: 
                    514:     get_alloc(&offset,txtsec[i]->name,40,instream);
                    515:     get_str(txtsec[i]->code,instream);
                    516: #ifdef SCFG
                    517:     get_str(txtsec[i]->ar,instream);
                    518: #else
                    519:     fread(str,LEN_ARSTR+1,1,instream);
                    520:     offset+=LEN_ARSTR+1;
                    521:        txtsec[i]->ar=arstr(0,str);
                    522: #endif
                    523:        for(j=0;j<8;j++)
                    524:                get_int(n,instream);
                    525:        }
                    526: total_txtsecs=i;
                    527: 
                    528: #endif
                    529: 
                    530: fclose(instream);
                    531: lprintf(txt.readit,fname);
                    532: #ifdef SBBS
                    533: for(i=l=0;i<total_libs;i++) {
                    534:        for(j=k=0;j<total_dirs;j++)
                    535:                if(dir[j]->lib==i)
                    536:                        k++;
                    537:        if(k>l) l=k; }  /* l = largest number of dirs in a lib */
                    538: for(i=0;i<total_libs;i++)
                    539:        if(l && (usrdir[i]=(uint *)MALLOC(sizeof(uint)*l))==NULL)
                    540:                allocerr(txt,offset,fname,sizeof(uint)*l);
                    541: #endif
                    542: }
                    543: 
                    544: #endif
                    545: 
                    546: 
                    547: #ifndef NO_XTRN_CFG
                    548: 
                    549: /****************************************************************************/
                    550: /* Reads in XTRN.CNF and initializes the associated variables                          */
                    551: /****************************************************************************/
                    552: void read_xtrn_cfg(read_cfg_text_t txt)
                    553: {
                    554:        char    str[256],fname[13],*p,c;
                    555:        int     file;
                    556:        short   i,j,n;
                    557:        long    offset=0;
                    558:        FILE    *instream;
                    559: 
                    560: strcpy(fname,"XTRN.CNF");
                    561: sprintf(str,"%s%s",ctrl_dir,fname);
                    562: if((instream=fnopen(&file,str,O_RDONLY))==NULL) {
                    563:        lprintf(txt.openerr,str);
                    564:        bail(1); }
                    565: 
                    566: lprintf(txt.reading,fname);
                    567: 
                    568: /*************/
                    569: /* Swap list */
                    570: /*************/
                    571: 
                    572: get_int(total_swaps,instream);
                    573: 
                    574: if(total_swaps) {
                    575:        if((swap=(swap_t **)MALLOC(sizeof(swap_t *)*total_swaps))==NULL)
                    576:                allocerr(txt,offset,fname,sizeof(swap_t *)*total_swaps); }
                    577: else
                    578:        swap=NULL;
                    579: 
                    580: for(i=0;i<total_swaps;i++) {
                    581:        if(feof(instream)) break;
                    582:        if((swap[i]=(swap_t *)MALLOC(sizeof(swap_t)))==NULL)
                    583:                allocerr(txt,offset,fname,sizeof(swap_t));
                    584:        get_alloc(&offset,swap[i]->cmd,LEN_CMD,instream); }
                    585: total_swaps=i;
                    586: 
                    587: /********************/
                    588: /* External Editors */
                    589: /********************/
                    590: 
                    591: get_int(total_xedits,instream);
                    592: 
                    593: if(total_xedits) {
                    594:        if((xedit=(xedit_t **)MALLOC(sizeof(xedit_t *)*total_xedits))==NULL)
                    595:                allocerr(txt,offset,fname,sizeof(xedit_t *)*total_xedits); }
                    596: else
                    597:        xedit=NULL;
                    598: 
                    599: for(i=0;i<total_xedits;i++) {
                    600:        if(feof(instream)) break;
                    601:        if((xedit[i]=(xedit_t *)MALLOC(sizeof(xedit_t)))==NULL)
                    602:                allocerr(txt,offset,fname,sizeof(xedit_t));
                    603:        memset(xedit[i],0,sizeof(xedit_t));
                    604: 
                    605:        get_alloc(&offset,xedit[i]->name,40,instream);
                    606:        get_str(xedit[i]->code,instream);
                    607:        get_alloc(&offset,xedit[i]->lcmd,LEN_CMD,instream);
                    608:        get_alloc(&offset,xedit[i]->rcmd,LEN_CMD,instream);
                    609: 
                    610: #if !defined(SCFG) && defined(SAVE_MEMORY)       /* Save memory */
                    611:        if(!strcmp(xedit[i]->lcmd,xedit[i]->rcmd) && xedit[i]->rcmd!=scfgnulstr) {
                    612:                FREE(xedit[i]->rcmd);
                    613:                xedit[i]->rcmd=xedit[i]->lcmd; }
                    614: #endif
                    615: 
                    616:        get_int(xedit[i]->misc,instream);
                    617: #ifdef SCFG
                    618:        get_str(xedit[i]->ar,instream);
                    619: #else
                    620:        fread(str,LEN_ARSTR+1,1,instream);
                    621:        offset+=LEN_ARSTR+1;
                    622:        xedit[i]->ar=arstr(0,str);
                    623: #endif
                    624:        get_int(xedit[i]->type,instream);
                    625:        get_int(c,instream);
                    626:        for(j=0;j<7;j++)
                    627:                get_int(n,instream);
                    628:        }
                    629: total_xedits=i;
                    630: 
                    631: 
                    632: /*****************************/
                    633: /* External Program Sections */
                    634: /*****************************/
                    635: 
                    636: get_int(total_xtrnsecs,instream);
                    637: 
                    638: if(total_xtrnsecs) {
                    639:        if((xtrnsec=(xtrnsec_t **)MALLOC(sizeof(xtrnsec_t *)*total_xtrnsecs))
                    640:                ==NULL)
                    641:                allocerr(txt,offset,fname,sizeof(xtrnsec_t *)*total_xtrnsecs); }
                    642: else
                    643:        xtrnsec=NULL;
                    644: 
                    645: for(i=0;i<total_xtrnsecs;i++) {
                    646:        if(feof(instream)) break;
                    647:        if((xtrnsec[i]=(xtrnsec_t *)MALLOC(sizeof(xtrnsec_t)))==NULL)
                    648:                allocerr(txt,offset,fname,sizeof(xtrnsec_t));
                    649:        memset(xtrnsec[i],0,sizeof(xtrnsec_t));
                    650: 
                    651:        get_alloc(&offset,xtrnsec[i]->name,40,instream);
                    652:        get_str(xtrnsec[i]->code,instream);
                    653: #ifdef SCFG
                    654:        get_str(xtrnsec[i]->ar,instream);
                    655: #else
                    656:        fread(str,LEN_ARSTR+1,1,instream);
                    657:        offset+=LEN_ARSTR+1;
                    658:        xtrnsec[i]->ar=arstr(0,str);
                    659: #endif
                    660:        for(j=0;j<8;j++)
                    661:         get_int(n,instream);
                    662:        }
                    663: total_xtrnsecs=i;
                    664: 
                    665: 
                    666: /*********************/
                    667: /* External Programs */
                    668: /*********************/
                    669: 
                    670: get_int(total_xtrns,instream);
                    671: 
                    672: if(total_xtrns) {
                    673:        if((xtrn=(xtrn_t **)MALLOC(sizeof(xtrn_t *)*total_xtrns))==NULL)
                    674:                allocerr(txt,offset,fname,sizeof(xtrn_t *)*total_xtrns); }
                    675: else
                    676:        xtrn=NULL;
                    677: 
                    678: for(i=0;i<total_xtrns;i++) {
                    679:        if(feof(instream)) break;
                    680:        if((xtrn[i]=(xtrn_t *)MALLOC(sizeof(xtrn_t)))==NULL)
                    681:                allocerr(txt,offset,fname,sizeof(xtrn_t));
                    682:        memset(xtrn[i],0,sizeof(xtrn_t));
                    683: 
                    684:        get_int(xtrn[i]->sec,instream);
                    685:        get_alloc(&offset,xtrn[i]->name,40,instream);
                    686:        get_str(xtrn[i]->code,instream);
                    687: #ifdef SCFG
                    688:        get_str(xtrn[i]->ar,instream);
                    689:        get_str(xtrn[i]->run_ar,instream);
                    690: #else
                    691:        fread(str,LEN_ARSTR+1,1,instream);
                    692:        offset+=LEN_ARSTR+1;
                    693:        xtrn[i]->ar=arstr(0,str);
                    694:        fread(str,LEN_ARSTR+1,1,instream);
                    695:        offset+=LEN_ARSTR+1;
                    696:        xtrn[i]->run_ar=arstr(0,str);
                    697: #endif
                    698:        get_int(xtrn[i]->type,instream);
                    699:        get_int(xtrn[i]->misc,instream);
                    700:        get_int(xtrn[i]->event,instream);
                    701:        get_int(xtrn[i]->cost,instream);
                    702:        get_alloc(&offset,xtrn[i]->cmd,LEN_CMD,instream);
                    703:        get_alloc(&offset,xtrn[i]->clean,LEN_CMD,instream);
                    704:        fread(str,LEN_DIR+1,1,instream);
                    705:        offset+=LEN_DIR+1;
                    706:        if(strcmp(str+1,":\\") && str[strlen(str)-1]=='\\') // C:\ is valid
                    707:                str[strlen(str)-1]=0;           // C:\SBBS\XTRN\GAME\ is not
                    708: #ifdef SBBS
                    709:        if(!str[0])                       /* Minimum path of '.' */
                    710:                strcpy(str,".");
                    711:        if((xtrn[i]->path=(char *)MALLOC(strlen(str)+1))==NULL)
                    712:                allocerr(txt,offset,fname,strlen(str)+1);
                    713: #endif
                    714:        strcpy(xtrn[i]->path,str);
                    715:        get_int(xtrn[i]->textra,instream);
                    716:        get_int(xtrn[i]->maxtime,instream);
                    717:        for(j=0;j<7;j++)
                    718:         get_int(n,instream);
                    719:        }
                    720: total_xtrns=i;
                    721: 
                    722: 
                    723: /****************/
                    724: /* Timed Events */
                    725: /****************/
                    726: 
                    727: get_int(total_events,instream);
                    728: 
                    729: if(total_events) {
                    730:        if((event=(event_t **)MALLOC(sizeof(event_t *)*total_events))==NULL)
                    731:                allocerr(txt,offset,fname,sizeof(event_t *)*total_events); }
                    732: else
                    733:        event=NULL;
                    734: 
                    735: for(i=0;i<total_events;i++) {
                    736:        if(feof(instream)) break;
                    737:        if((event[i]=(event_t *)MALLOC(sizeof(event_t)))==NULL)
                    738:                allocerr(txt,offset,fname,sizeof(event_t));
                    739:        memset(event[i],0,sizeof(event_t));
                    740: 
                    741:        get_str(event[i]->code,instream);
                    742:        get_alloc(&offset,event[i]->cmd,LEN_CMD,instream);
                    743:        get_int(event[i]->days,instream);
                    744:        get_int(event[i]->time,instream);
                    745:        get_int(event[i]->node,instream);
                    746:        get_int(event[i]->misc,instream);
                    747:        get_alloc(&offset,event[i]->dir,LEN_DIR,instream);
                    748:        if(event[i]->dir[0]                                                                     // blank is valid
                    749:                && strcmp(event[i]->dir+1,":\\")                    // C:\ is valid
                    750:                && event[i]->dir[strlen(event[i]->dir)-1]=='\\')    // C:\DIR\ !valid
                    751:                event[i]->dir[strlen(event[i]->dir)-1]=0;                       // Remove \
                    752:        for(j=0;j<8;j++)
                    753:         get_int(n,instream);
                    754:        }
                    755: total_events=i;
                    756: 
                    757: #if defined(SCFG) || defined(__OS2__)
                    758: 
                    759: /********************/
                    760: /* DOS Program list */
                    761: /********************/
                    762: 
                    763: get_int(total_os2pgms,instream);
                    764: 
                    765: if(total_os2pgms) {
                    766:        if((os2pgm=(os2pgm_t **)MALLOC(sizeof(os2pgm_t *)*total_os2pgms))==NULL)
                    767:                allocerr(txt,offset,fname,sizeof(os2pgm_t *)*total_os2pgms); }
                    768: else
                    769:        os2pgm=NULL;
                    770: 
                    771: for(i=0;i<total_os2pgms;i++) {
                    772:        if(feof(instream)) break;
                    773:        if((os2pgm[i]=(os2pgm_t *)MALLOC(sizeof(os2pgm_t)))==NULL)
                    774:                allocerr(txt,offset,fname,sizeof(os2pgm_t));
                    775:        get_alloc(&offset,os2pgm[i]->name,12,instream);
                    776:        os2pgm[i]->misc=0; }
                    777: total_os2pgms=i;
                    778: for(i=0;i<total_os2pgms;i++) {
                    779:     if(feof(instream)) break;
                    780:        get_int(os2pgm[i]->misc,instream); }
                    781: 
                    782: #endif // Don't add anything non-OS2 specific after this (without moding ^^ )
                    783: 
                    784: 
                    785: fclose(instream);
                    786: lprintf(txt.readit,fname);
                    787: }
                    788: 
                    789: #endif
                    790: 
                    791: 
                    792: #ifndef NO_CHAT_CFG
                    793: 
                    794: /****************************************************************************/
                    795: /* Reads in CHAT.CNF and initializes the associated variables                          */
                    796: /****************************************************************************/
                    797: void read_chat_cfg(read_cfg_text_t txt)
                    798: {
                    799:        char    str[256],fname[13],*p;
                    800:        int     file;
                    801:        short   i,j,n;
                    802:        long    offset=0;
                    803:        FILE    *instream;
                    804: 
                    805: strcpy(fname,"CHAT.CNF");
                    806: sprintf(str,"%s%s",ctrl_dir,fname);
                    807: if((instream=fnopen(&file,str,O_RDONLY))==NULL) {
                    808:        lprintf(txt.openerr,str);
                    809:        bail(1); }
                    810: 
                    811: lprintf(txt.reading,fname);
                    812: 
                    813: /*********/
                    814: /* Gurus */
                    815: /*********/
                    816: 
                    817: get_int(total_gurus,instream);
                    818: 
                    819: if(total_gurus) {
                    820:     if((guru=(guru_t **)MALLOC(sizeof(guru_t *)*total_gurus))==NULL)
                    821:         allocerr(txt,offset,fname,sizeof(guru_t *)*total_gurus); }
                    822: else
                    823:     guru=NULL;
                    824: 
                    825: for(i=0;i<total_gurus;i++) {
                    826:     if(feof(instream)) break;
                    827:     if((guru[i]=(guru_t *)MALLOC(sizeof(guru_t)))==NULL)
                    828:         allocerr(txt,offset,fname,sizeof(guru_t));
                    829:     memset(guru[i],0,sizeof(guru_t));
                    830: 
                    831:     get_alloc(&offset,guru[i]->name,25,instream);
                    832:     get_str(guru[i]->code,instream);
                    833: 
                    834: #ifdef SCFG
                    835:     get_str(guru[i]->ar,instream);
                    836: #else
                    837:     fread(str,LEN_ARSTR+1,1,instream);
                    838:     offset+=LEN_ARSTR+1;
                    839:        guru[i]->ar=arstr(0,str);
                    840: #endif
                    841:     for(j=0;j<8;j++)
                    842:                get_int(n,instream);
                    843:        }
                    844: total_chans=i;
                    845: 
                    846: 
                    847: /********************/
                    848: /* Chat Action Sets */
                    849: /********************/
                    850: 
                    851: get_int(total_actsets,instream);
                    852: 
                    853: if(total_actsets) {
                    854:        if((actset=(actset_t **)MALLOC(sizeof(actset_t *)*total_actsets))==NULL)
                    855:                allocerr(txt,offset,fname,sizeof(actset_t *)*total_actsets); }
                    856: else
                    857:        actset=NULL;
                    858: 
                    859: for(i=0;i<total_actsets;i++) {
                    860:        if(feof(instream)) break;
                    861:        if((actset[i]=(actset_t *)MALLOC(sizeof(actset_t)))==NULL)
                    862:                allocerr(txt,offset,fname,sizeof(actset_t));
                    863:        get_alloc(&offset,actset[i]->name,25,instream);
                    864:        }
                    865: total_actsets=i;
                    866: 
                    867: 
                    868: /****************/
                    869: /* Chat Actions */
                    870: /****************/
                    871: 
                    872: get_int(total_chatacts,instream);
                    873: 
                    874: if(total_chatacts) {
                    875:        if((chatact=(chatact_t **)MALLOC(sizeof(chatact_t *)*total_chatacts))
                    876:                ==NULL)
                    877:                allocerr(txt,offset,fname,sizeof(chatact_t *)*total_chatacts); }
                    878: else
                    879:        chatact=NULL;
                    880: 
                    881: for(i=0;i<total_chatacts;i++) {
                    882:        if(feof(instream)) break;
                    883:        if((chatact[i]=(chatact_t *)MALLOC(sizeof(chatact_t)))==NULL)
                    884:                allocerr(txt,offset,fname,sizeof(chatact_t));
                    885:        memset(chatact[i],0,sizeof(chatact_t));
                    886: 
                    887:        get_int(chatact[i]->actset,instream);
                    888:        get_alloc(&offset,chatact[i]->cmd,LEN_CHATACTCMD,instream);
                    889:        get_alloc(&offset,chatact[i]->out,LEN_CHATACTOUT,instream);
                    890:        for(j=0;j<8;j++)
                    891:                get_int(n,instream);
                    892:        }
                    893: 
                    894: total_chatacts=i;
                    895: 
                    896: 
                    897: /***************************/
                    898: /* Multinode Chat Channels */
                    899: /***************************/
                    900: 
                    901: get_int(total_chans,instream);
                    902: 
                    903: if(total_chans) {
                    904:        if((chan=(chan_t **)MALLOC(sizeof(chan_t *)*total_chans))==NULL)
                    905:                allocerr(txt,offset,fname,sizeof(chan_t *)*total_chans); }
                    906: else
                    907:        chan=NULL;
                    908: 
                    909: for(i=0;i<total_chans;i++) {
                    910:        if(feof(instream)) break;
                    911:        if((chan[i]=(chan_t *)MALLOC(sizeof(chan_t)))==NULL)
                    912:                allocerr(txt,offset,fname,sizeof(chan_t));
                    913:        memset(chan[i],0,sizeof(chan_t));
                    914: 
                    915:        get_int(chan[i]->actset,instream);
                    916:        get_alloc(&offset,chan[i]->name,25,instream);
                    917: 
                    918:        get_str(chan[i]->code,instream);
                    919: 
                    920: #ifdef SCFG
                    921:        get_str(chan[i]->ar,instream);
                    922: #else
                    923:        fread(str,LEN_ARSTR+1,1,instream);
                    924:        offset+=LEN_ARSTR+1;
                    925:        chan[i]->ar=arstr(0,str);
                    926: #endif
                    927:        get_int(chan[i]->cost,instream);
                    928:        get_int(chan[i]->guru,instream);
                    929:        get_int(chan[i]->misc,instream);
                    930:        for(j=0;j<8;j++)
                    931:                get_int(n,instream); }
                    932: total_chans=i;
                    933: 
                    934: 
                    935: /**************/
                    936: /* Chat Pages */
                    937: /**************/
                    938: 
                    939: get_int(total_pages,instream);
                    940: 
                    941: if(total_pages) {
                    942:     if((page=(page_t **)MALLOC(sizeof(page_t *)*total_pages))==NULL)
                    943:         allocerr(txt,offset,fname,sizeof(page_t *)*total_pages); }
                    944: else
                    945:     page=NULL;
                    946: 
                    947: for(i=0;i<total_pages;i++) {
                    948:     if(feof(instream)) break;
                    949:     if((page[i]=(page_t *)MALLOC(sizeof(page_t)))==NULL)
                    950:         allocerr(txt,offset,fname,sizeof(page_t));
                    951:     memset(page[i],0,sizeof(page_t));
                    952: 
                    953:     get_alloc(&offset,page[i]->cmd,LEN_CMD,instream);
                    954: 
                    955: #ifdef SCFG
                    956:     get_str(page[i]->ar,instream);
                    957: #else
                    958:     fread(str,LEN_ARSTR+1,1,instream);
                    959:     offset+=LEN_ARSTR+1;
                    960:        page[i]->ar=arstr(0,str);
                    961: #endif
                    962:     get_int(page[i]->misc,instream);
                    963:     for(j=0;j<8;j++)
                    964:         get_int(n,instream);
                    965:     }
                    966: total_pages=i;
                    967: 
                    968: 
                    969: fclose(instream);
                    970: lprintf(txt.readit,fname);
                    971: }
                    972: 
                    973: #endif
                    974: 
                    975: /****************************************************************************/
                    976: /* Read one line of up two 256 characters from the file pointed to by       */
                    977: /* 'stream' and put upto 'maxlen' number of character into 'outstr' and     */
                    978: /* truncate spaces off end of 'outstr'.                                     */
                    979: /****************************************************************************/
                    980: char *readline(long *offset, char *outstr, int maxlen, FILE *instream)
                    981: {
                    982:        char str[257];
                    983: 
                    984: if(fgets(str,256,instream)==NULL)
                    985:        return(NULL);
                    986: sprintf(outstr,"%.*s",maxlen,str);
                    987: truncsp(outstr);
                    988: (*offset)+=maxlen;
                    989: return(outstr);
                    990: }
                    991: 
                    992: #undef readline_alloc
                    993: 
                    994: char *readline_alloc(long *offset, char *outstr, int maxline, FILE *instream)
                    995: {
                    996:        char str[257];
                    997: 
                    998: readline(offset,str,maxline,instream);
                    999: if((outstr=(char *)MALLOC(strlen(str)+1))==NULL)
                   1000:        return(NULL);
                   1001: strcpy(outstr,str);
                   1002: return(outstr);
                   1003: }
                   1004: 
                   1005: /****************************************************************************/
                   1006: /* Turns char string of flags into a long                                                                      */
                   1007: /****************************************************************************/
                   1008: long aftol(char *str)
                   1009: {
                   1010:        char c=0;
                   1011:        ulong l=0UL;
                   1012: 
                   1013: strupr(str);
                   1014: while(str[c]) {
                   1015:        if(str[c]>='A' && str[c]<='Z')
                   1016:                l|=FLAG(str[c]);
                   1017:        c++; }
                   1018: return(l);
                   1019: }
                   1020: 
                   1021: /*****************************************************************************/
                   1022: /* Converts a long into an ASCII Flag string (A-Z) that represents bits 0-25 */
                   1023: /*****************************************************************************/
                   1024: char *ltoaf(long l,char *str)
                   1025: {
                   1026:        char c=0;
                   1027: 
                   1028: while(c<26) {
                   1029:        if(l&(long)(1L<<c))
                   1030:                str[c]='A'+c;
                   1031:        else str[c]=SP;
                   1032:        c++; }
                   1033: str[c]=0;
                   1034: return(str);
                   1035: }
                   1036: 
                   1037: /****************************************************************************/
                   1038: /* Returns the actual attribute code from a string of ATTR characters       */
                   1039: /****************************************************************************/
                   1040: int attrstr(char *str)
                   1041: {
                   1042:        ulong l=0;
                   1043:        short atr;
                   1044: 
                   1045: atr=LIGHTGRAY;
                   1046: while(str[l]) {
                   1047:        switch(str[l]) {
                   1048:                case 'H':       /* High intensity */
                   1049:                        atr|=HIGH;
                   1050:                        break;
                   1051:                case 'I':       /* Blink */
                   1052:                        atr|=BLINK;
                   1053:                        break;
                   1054:                case 'K':       /* Black */
                   1055:                        atr=(atr&0xf8)|BLACK;
                   1056:                        break;
                   1057:                case 'W':       /* White */
                   1058:                        atr=(atr&0xf8)|LIGHTGRAY;
                   1059:                        break;
                   1060:                case '0':       /* Black Background */
                   1061:                        atr=(atr&0x8f)|(BLACK<<4);
                   1062:                        break;
                   1063:                case '7':       /* White Background */
                   1064:                        atr=(atr&0x8f)|(LIGHTGRAY<<4);
                   1065:                        break;
                   1066:                case 'R':
                   1067:                        atr=(atr&0xf8)|RED;
                   1068:                        break;
                   1069:                case 'G':
                   1070:                        atr=(atr&0xf8)|GREEN;
                   1071:                        break;
                   1072:                case 'Y':   /* Yellow */
                   1073:                        atr=(atr&0xf8)|BROWN;
                   1074:                        break;
                   1075:                case 'B':
                   1076:                        atr=(atr&0xf8)|BLUE;
                   1077:                        break;
                   1078:                case 'M':
                   1079:                        atr=(atr&0xf8)|MAGENTA;
                   1080:                        break;
                   1081:                case 'C':
                   1082:                        atr=(atr&0xf8)|CYAN;
                   1083:                        break;
                   1084:                case '1':       /* Red Background */
                   1085:                        atr=(atr&0x8f)|(RED<<4);
                   1086:                        break;
                   1087:                case '2':       /* Green Background */
                   1088:                        atr=(atr&0x8f)|(GREEN<<4);
                   1089:                        break;
                   1090:                case '3':       /* Yellow Background */
                   1091:                        atr=(atr&0x8f)|(BROWN<<4);
                   1092:                        break;
                   1093:                case '4':       /* Blue Background */
                   1094:                        atr=(atr&0x8f)|(BLUE<<4);
                   1095:                        break;
                   1096:                case '5':       /* Magenta Background */
                   1097:                        atr=(atr&0x8f)|(MAGENTA<<4);
                   1098:                        break;
                   1099:                case '6':       /* Cyan Background */
                   1100:                        atr=(atr&0x8f)|(CYAN<<4);
                   1101:                        break; }
                   1102:        l++; }
                   1103: return(atr);
                   1104: }
                   1105: 
                   1106: 

unix.superglobalmegacorp.com

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