|
|
1.1 root 1: /* scfglib.h */
2:
3: /* Synchronet configuration library routine prototypes */
4:
5: /* $Id: scfglib.h,v 1.19 2004/09/08 03:39:15 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 2004 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: #ifndef _SCFGLIB_H
39: #define _SCFGLIB_H
40:
41: #include "scfgdefs.h" /* scfg_t */
42:
43: #define get_int(var,stream) { if(!fread(&var,1,sizeof(var),stream)) \
44: memset(&var,0,sizeof(var)); \
45: offset+=sizeof(var); }
46: #define get_str(var,stream) { if(!fread(var,1,sizeof(var),stream)) \
47: memset(var,0,sizeof(var)); \
48: offset+=sizeof(var); }
49:
50: #ifdef __cplusplus
51: extern "C" {
52: #endif
53:
54: extern const char* scfgnulstr;
55:
56: #if defined(SCFG) /* Don't compile AR strings for SCFG */
57: #define ARSTR(str,cfg) NULL
58: #define FREE_AR(x)
59: #else
60: extern const uchar* nular;
61: #define ARSTR(str,cfg) arstr(NULL,str,cfg)
62: /* allocated with arstr() */
63: #define FREE_AR(x) if(x!=NULL && x!=nular) { FREE(x); x=NULL; }
64: #endif
65:
66: char* get_alloc(long *offset, char *outstr, int maxlen, FILE *instream);
67: BOOL allocerr(FILE*, char* error, long offset, char *fname, uint size);
68: char* readline(long *offset, char *str, int maxlen, FILE *stream);
69:
70: BOOL read_node_cfg(scfg_t* cfg, char* error);
71: BOOL read_main_cfg(scfg_t* cfg, char* error);
72: BOOL read_xtrn_cfg(scfg_t* cfg, char* error);
73: BOOL read_file_cfg(scfg_t* cfg, char* error);
74: BOOL read_msgs_cfg(scfg_t* cfg, char* error);
75: BOOL read_chat_cfg(scfg_t* cfg, char* error);
76: BOOL read_attr_cfg(scfg_t* cfg, char* error);
77: char* prep_path(char* path);
78: void make_data_dirs(scfg_t* cfg);
79:
80: void free_node_cfg(scfg_t* cfg);
81: void free_main_cfg(scfg_t* cfg);
82: void free_xtrn_cfg(scfg_t* cfg);
83: void free_file_cfg(scfg_t* cfg);
84: void free_msgs_cfg(scfg_t* cfg);
85: void free_chat_cfg(scfg_t* cfg);
86:
87: long aftol(char *str); /* Converts flag string to long */
88: char* ltoaf(long l, char *str); /* Converts long to flag string */
89: uchar attrstr(char *str); /* Convert ATTR string into attribute int */
90:
91: #ifdef __cplusplus
92: }
93: #endif
94:
95: #endif /* Don't add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.