88 #define STR(x) vstring_str(x)
90 #ifdef LEGACY_DBMS_SUPPORT
99 static const char *pcf_ldap_suffixes[] = {
100 #include "pcf_ldap_suffixes.h"
106 static const char *pcf_mysql_suffixes[] = {
107 #include "pcf_mysql_suffixes.h"
113 static const char *pcf_pgsql_suffixes[] = {
114 #include "pcf_pgsql_suffixes.h"
120 static const char *pcf_sqlite_suffixes[] = {
121 #include "pcf_sqlite_suffixes.h"
127 static const char *pcf_memcache_suffixes[] = {
128 #include "pcf_memcache_suffixes.h"
137 const char **db_suffixes;
140 static const PCF_DBMS_INFO pcf_dbms_info[] = {
151 static void pcf_check_dbms_client(
const PCF_DBMS_INFO *dp,
const char *cf_file)
165 dict_spec =
concatenate(dp->db_type,
":", cf_file, (
char *) 0);
179 msg_warn(
"open \"%s\" configuration \"%s\": %m",
180 dp->db_type, cf_file);
185 msg_warn(
"open \"%s\" configuration \"%s\": not a regular file",
186 dp->db_type, cf_file);
193 msg_warn(
"read \"%s\" configuration \"%s\": %m",
194 dp->db_type, cf_file);
205 for (cpp = dp->db_suffixes; *cpp; cpp++)
210 msg_warn(
"%s: unused parameter: %s=%s", dict_spec, name, value);
217 static void pcf_register_dbms_helper(
char *str_value,
218 const char *(flag_parameter) (
const char *,
int,
PCF_MASTER_ENT *),
221 const PCF_DBMS_INFO *dp;
238 while ((prefix =
split_at(db_type,
':')) != 0
254 if (*prefix ==
'/') {
255 for (dp = pcf_dbms_info; dp->db_type != 0; dp++) {
256 if (strcmp(db_type, dp->db_type) == 0) {
257 pcf_check_dbms_client(dp, prefix);
271 if (*prefix !=
'.') {
283 pcf_register_dbms_helper(prefix, flag_parameter,
286 for (dp = pcf_dbms_info; dp->db_type != 0; dp++) {
287 if (strcmp(db_type, dp->db_type) == 0) {
288 for (cpp = dp->db_suffixes; *cpp; cpp++) {
291 "%s_%s", prefix, *cpp);
292 flag_parameter(
STR(candidate),
307 const char *(flag_parameter) (
const char *,
int,
PCF_MASTER_ENT *),
322 pcf_register_dbms_helper(bufp, flag_parameter, local_scope);
char * extpar(char **bp, const char *parens, int flags)
void dict_register(const char *dict_name, DICT *dict_info)
#define DICT_SEQ_FUN_FIRST
#define DICT_SEQ_FUN_NEXT
char * pcf_expand_parameter_value(VSTRING *, int, const char *, PCF_MASTER_ENT *)
char * mystrtokq(char **src, const char *sep, const char *parens)
#define PCF_PARAM_FLAG_DBMS
VSTREAM * vstream_fopen(const char *path, int flags, mode_t mode)
#define DICT_STAT_SUCCESS
int vstream_fclose(VSTREAM *stream)
DICT * dict_handle(const char *dict_name)
void msg_warn(const char *fmt,...)
VSTRING * vstring_alloc(ssize_t len)
void pcf_register_dbms_parameters(const char *, const char *(*)(const char *, int, PCF_MASTER_ENT *), PCF_MASTER_ENT *)
DICT * dict_ht_open(const char *name, int unused_open_flags, int dict_flags)
VSTRING * vstring_sprintf(VSTRING *vp, const char *format,...)
void dict_load_fp(const char *dict_name, VSTREAM *fp)
char * concatenate(const char *arg0,...)
#define DICT_TYPE_MEMCACHE
#define PCF_PARAM_FLAG_USER
char * split_at(char *string, int delimiter)
#define vstream_fileno(vp)
#define dict_del(dp, key)