|
|
1.1 root 1: /* scfglib.h */
2:
3: /* Synchronet configuration library routine prototypes */
4:
5: /* $Id: scfglib.h,v 1.5 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: #ifndef _SCFGLIB_H
39: #define _SCFGLIB_H
40:
41: #define SAVE_MEMORY
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: #define FREE_AND_NULL(x) if(x!=NULL) { FREE(x); x=NULL; }
51:
52: typedef struct {
53: char *openerr,
54: *reading,
55: *readit,
56: *allocerr,
57: *error;
58: } read_cfg_text_t;
59:
60: #ifdef __cplusplus
61: extern "C" {
62: #endif
63:
64: char *get_alloc(long *offset, char *outstr, int maxlen, FILE *instream);
65: BOOL allocerr(read_cfg_text_t* txt, long offset, char *fname, uint size);
66: char *readline(long *offset, char *str, int maxlen, FILE *stream);
67:
68: BOOL read_node_cfg(scfg_t* cfg, read_cfg_text_t* txt);
69: BOOL read_main_cfg(scfg_t* cfg, read_cfg_text_t* txt);
70: BOOL read_xtrn_cfg(scfg_t* cfg, read_cfg_text_t* txt);
71: BOOL read_file_cfg(scfg_t* cfg, read_cfg_text_t* txt);
72: BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt);
73: BOOL read_chat_cfg(scfg_t* cfg, read_cfg_text_t* txt);
74: BOOL read_attr_cfg(scfg_t* cfg, read_cfg_text_t* txt);
75: void prep_dir(char* base, char* dir);
76: void prep_path(char* path);
77: void make_data_dirs(scfg_t* cfg);
78:
79: void free_node_cfg(scfg_t* cfg);
80: void free_main_cfg(scfg_t* cfg);
81: void free_xtrn_cfg(scfg_t* cfg);
82: void free_file_cfg(scfg_t* cfg);
83: void free_msgs_cfg(scfg_t* cfg);
84: void free_chat_cfg(scfg_t* cfg);
85:
86: long aftol(char *str); /* Converts flag string to long */
87: char *ltoaf(long l, char *str); /* Converts long to flag string */
88: char *faddrtoa(faddr_t addr); /* FidoNet address to ASCII text conversion */
89: char chardupe(char *str); /* Searches for duplicate chars in str */
90: uchar attrstr(char *str); /* Convert ATTR string into attribute int */
91:
92: #ifdef __cplusplus
93: }
94: #endif
95:
96: #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.