memset(&lconfig, 0, sizeof(struct legacy_config));
cfp = fopen(file_citadel_config, "rb");
if (cfp != NULL) {
- if (CtdlGetConfigLong("c_config_created_or_migrated") <= 0) {
+ if (CtdlGetConfigLong("c_config_created_or_migrated") > 0) {
fprintf(stderr, "Citadel Server found BOTH legacy and new configurations present.\n");
fprintf(stderr, "Exiting to prevent data corruption.\n");
exit(CTDLEXIT_CONFIG);
int key_len = strlen(key);
int value_len = strlen(value);
+ /* FIXME we are noisy logging for now */
+ syslog(LOG_DEBUG, "\033[31mSET CONFIG: '%s' = '%s'\033[0m", key, value);
+
/* Save it in memory */
Put(ctdlconfig, key, key_len, strdup(value), NULL);
/* First look in memory */
if (GetHash(ctdlconfig, key, key_len, (void *)&value))
{
+ if (strcmp(key, "c_min_workers")) syslog(LOG_DEBUG, "\033[32mGET CONFIG: '%s' = '%s'\033[0m", key, value);
return value;
}
cdb = cdb_fetch(CDB_CONFIG, key, key_len);
if (cdb == NULL) { /* nope, not there either. */
+ syslog(LOG_DEBUG, "\033[32mGET CONFIG: '%s' = NULL\033[0m", key);
return(NULL);
}
value = strdup(cdb->ptr + key_len + 1); /* The key was stored there too; skip past it */
cdb_free(cdb);
Put(ctdlconfig, key, key_len, value, NULL);
+ syslog(LOG_DEBUG, "\033[32mGET CONFIG: '%s' = '%s'\033[0m", key, value);
return value;
}
+/*
+ * Fetch a system config value - integer
+ */
+int CtdlGetConfigInt(char *key)
+{
+ char *s = CtdlGetConfigStr(key);
+ if (s) return atoi(s);
+ return 0;
+}
+
+
+/*
+ * Fetch a system config value - long integer
+ */
+long CtdlGetConfigLong(char *key)
+{
+ char *s = CtdlGetConfigStr(key);
+ if (s) return atol(s);
+ return 0;
+}
conf = NULL;
}
else {
- msg = CtdlFetchMessage(msgnum, 1);
+ msg = CtdlFetchMessage(msgnum, 1, 1);
if (msg != NULL) {
conf = strdup(msg->cm_fields[eMesageText]);
CM_Free(msg);