fixed useragent
[syren.git] / src / sylib / syren_cfg.h
blob80b9653126c9f650023655874bce4fbe15f91ff4
1 /*
2 Syren -- a lightweight downloader for Linux/BSD/MacOSX
3 inspired by Axel Copyright 2001-2002 Wilmer van der Gaast
4 version 0.0.6 (atomic alien)
5 coded by Ketmar // Vampire Avalon
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License with
18 the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL;
19 if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 Suite 330, Boston, MA 02111-1307 USA
23 Syren config engine
25 #ifndef _SYREN_CFG_H
26 #define _SYREN_CFG_H
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #ifndef SY_DNT
33 # define SY_DNT
34 #endif
36 #include "syren_common.h"
37 #include "syren_str.h"
38 #include "syren_msg.h"
41 #define SY_CI_ERROR -1
42 #define SY_CI_STRING 0
43 #define SY_CI_INT 1 /* only positive */
44 #define SY_CI_BOOL 2
47 typedef struct {
48 TSyKVList *opts;
49 } TSyCfg;
53 TSyCfg *SyCfgNew (void);
54 void SyCfgFree (TSyCfg *cfg);
55 void SyCfgClear (TSyCfg *cfg);
57 TSyResult SyCfgAddStrKey (TSyCfg *cfg, const char *kname, const char *kdescr, char **var);
58 TSyResult SyCfgAddBoolKey (TSyCfg *cfg, const char *kname, const char *kdescr, TSyBool *var);
59 TSyResult SyCfgAddIntKey (TSyCfg *cfg, const char *kname, const char *kdescr, int *var);
61 int SyCfgGetKeyType (const TSyCfg *cfg, const char *kname);
63 /* converts any key value to string */
64 char *SyCfgGetKeyValue (const TSyCfg *cfg, const char *kname);
65 /* converts string to any key value */
66 TSyResult SyCfgSetKeyValue (TSyCfg *cfg, const char *kname, const char *value);
68 TSyResult SyCfgSet (TSyCfg *cfg, const char *optline);
69 TSyResult SyCfgLoad (TSyCfg *cfg, const char *filename, const TSyPrintStr *pfn);
70 TSyResult SyCfgSave (const TSyCfg *cfg, const char *filename, const TSyPrintStr *pfn);
72 TSyResult SyCfgLoadFile (TSyCfg *cfg, FILE *fl, const TSyPrintStr *pfn);
73 TSyResult SyCfgSaveFile (const TSyCfg *cfg, FILE *fl, const TSyPrintStr *pfn);
76 #ifdef __cplusplus
78 #endif
80 #endif