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