Coda Distributed File System
codaconf.h
Go to the documentation of this file.
1/* BLURB lgpl
2
3 Coda File System
4 Release 6
5
6 Copyright (c) 1987-2003 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU Library General Public Licence Version 2, as
11shown in the file LICENSE. The technical and financial contributors to
12Coda are listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19#ifndef _CODACONF_H_
20#define _CODACONF_H_
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/* Useful globals,
27 * codaconf_quiet, make conf_init shut up about not finding the configuration
28 * file. */
29extern int codaconf_quiet;
30
31/* conf_init reads (or merges) the name=value tuples from the conffile. If a
32 * name is seen multiple times, only the last value is remembered. Empty lines
33 * and lines starting with '#' are ignored. */
34int codaconf_init_one(const char *conffile);
35
36/* conf_lookup returns the value associated with name, or NULL on error. */
37const char *codaconf_lookup(const char *name, const char *defaultvalue);
38
39/* conf_free releases all resources allocated for the configuration data */
40void codaconf_free(void);
41
42/* helpers */
43
44/* codaconf_file searches all directories specified by the environment variable
45 * CODACONFPATH for 'confname'.
46 * codaconf_init uses codaconf_file to find a configuration file and then calls
47 * conf_init on this file.
48 *
49 * If the CODACONFPATH is not present the search defaults to,
50 * @sysconfdir@:/usr/local/etc/coda:/etc/coda
51 */
52int codaconf_init(const char *confname);
53char *codaconf_file(const char *confname);
54
55#include "coda_string.h"
56
57#define CODACONF_STR(var, key, defval) \
58 if (var == NULL || *var == '\0') { \
59 var = codaconf_lookup(key, defval); \
60 }
61#define CODACONF_INT(var, key, defval) \
62 { \
63 char t[256]; \
64 snprintf(t, 255, "%d", defval); \
65 t[255] = '\0'; \
66 if (var == 0) { \
67 var = atoi(codaconf_lookup(key, t)); \
68 } \
69 }
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif /* _CODACONF_H_ */
int codaconf_init(const char *confname)
Definition: codaconf.c:281
char * codaconf_file(const char *confname)
Definition: codaconf.c:241
int codaconf_init_one(const char *conffile)
Definition: codaconf.c:191
int codaconf_quiet
Definition: codaconf.c:43
void codaconf_free(void)
Definition: codaconf.c:302
const char * codaconf_lookup(const char *name, const char *defaultvalue)
Definition: codaconf.c:292
name
Definition: pwdtopdbtool.py:40