[srvx-commits] CVS: services/src Makefile.am,1.55,1.56 checkdb.c,1.8,1.9 saxdb.c,1.9,1.10 saxdb.h,1.
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-08-27 03:11:27
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv22509/src
Modified Files:
Makefile.am checkdb.c saxdb.c saxdb.h
Log Message:
fix checkdb utility
Index: Makefile.am
===================================================================
RCS file: /cvsroot/srvx/services/src/Makefile.am,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** Makefile.am 17 Aug 2002 14:31:15 -0000 1.55
--- Makefile.am 27 Aug 2002 03:11:24 -0000 1.56
***************
*** 44,47 ****
expnhelp_SOURCES = common.h compat.c compat.h dict-splay.c dict.h expnhelp.c log.h recdb.c recdb.h tools.c
! checkdb_SOURCES = checkdb.c common.h compat.c compat.h dict-splay.c dict.h log.h recdb.c recdb.h tools.c
globtest_SOURCES = common.h compat.c compat.h dict-splay.c dict.h globtest.c tools.c
--- 44,47 ----
expnhelp_SOURCES = common.h compat.c compat.h dict-splay.c dict.h expnhelp.c log.h recdb.c recdb.h tools.c
! checkdb_SOURCES = checkdb.c common.h compat.c compat.h dict-splay.c dict.h recdb.c recdb.h saxdb.c saxdb.h tools.c conf.h log.h modcmd.h saxdb.h timeq.h
globtest_SOURCES = common.h compat.c compat.h dict-splay.c dict.h globtest.c tools.c
Index: checkdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/checkdb.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** checkdb.c 5 Aug 2002 03:20:24 -0000 1.8
--- checkdb.c 27 Aug 2002 03:11:24 -0000 1.9
***************
*** 1,4 ****
#include "log.h"
! #include "recdb.h"
int bad = 0;
--- 1,7 ----
+ #include "conf.h"
#include "log.h"
! #include "modcmd.h"
! #include "saxdb.h"
! #include "timeq.h"
int bad = 0;
***************
*** 14,17 ****
--- 17,55 ----
bad = 1;
}
+
+ /* and because saxdb is tied in to lots of stuff.. */
+
+ time_t now;
+
+ void *conf_get_data(const char *full_path, enum recdb_type type) {
+ (void)full_path; (void)type; return NULL;
+ }
+
+ void conf_register_reload(conf_reload_func crf) {
+ (void)crf;
+ }
+
+ void timeq_add(time_t when, timeq_func func, void *data) {
+ (void)when; (void)func; (void)data;
+ }
+
+ void timeq_del(time_t when, timeq_func func, void *data, int mask) {
+ (void)when; (void)func; (void)data; (void)mask;
+ }
+
+
+ int send_message(struct userNode *dest, struct userNode *src, const char *message, ...) {
+ (void)dest; (void)src; (void)message; return 0;
+ }
+
+ struct module *module_register(const char *name, enum log_type clog, const char *helpfile_name, expand_func_t expand_help) {
+ (void)name; (void)clog; (void)helpfile_name; (void)expand_help; return NULL;
+ }
+
+ struct modcmd *modcmd_register(struct module *module, const char *name, modcmd_func_t func, unsigned int min_argc, unsigned int flags, ...) {
+ (void)module; (void)name; (void)func; (void)min_argc; (void)flags; return NULL;
+ }
+
+ /* back to our regularly scheduled code: */
int check_record(const char *key, void *data, void *extra)
Index: saxdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** saxdb.c 27 Aug 2002 02:08:59 -0000 1.9
--- saxdb.c 27 Aug 2002 03:11:24 -0000 1.10
***************
*** 417,418 ****
--- 417,458 ----
if (use_mondo) saxdb_read_db(mondo_db);
}
+
+ static void
+ write_database_helper(struct saxdb_context *ctx, struct dict *db) {
+ dict_iterator_t it;
+ struct record_data *rd;
+
+ for (it = dict_first(db); it; it = iter_next(it)) {
+ rd = iter_data(it);
+ switch (rd->type) {
+ case RECDB_INVALID: break;
+ case RECDB_QSTRING: saxdb_write_string(ctx, iter_key(it), rd->d.qstring); break;
+ case RECDB_STRING_LIST: saxdb_write_string_list(ctx, iter_key(it), rd->d.slist); break;
+ case RECDB_OBJECT:
+ saxdb_start_record(ctx, iter_key(it), 1);
+ write_database_helper(ctx, rd->d.object);
+ saxdb_end_record(ctx);
+ break;
+ }
+ }
+ }
+
+ int
+ write_database(FILE *out, struct dict *db) {
+ struct saxdb_context ctx;
+ int res;
+
+ ctx.output = out;
+ ctx.indent = 0;
+ int_list_init(&ctx.complex);
+ if (!(res = setjmp(ctx.jbuf))) {
+ write_database_helper(&ctx, db);
+ } else {
+ log(MAIN_LOG, LOG_ERROR, "Exception %d caught while writing to stream\n", res);
+ int_list_clean(&ctx.complex);
+ return 1;
+ }
+ assert(ctx.complex.used == 0);
+ int_list_clean(&ctx.complex);
+ return 0;
+ }
Index: saxdb.h
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** saxdb.h 17 Aug 2002 14:31:15 -0000 1.3
--- saxdb.h 27 Aug 2002 03:11:24 -0000 1.4
***************
*** 38,41 ****
--- 38,42 ----
void saxdb_write(const char *db_name);
void saxdb_write_all(void);
+ int write_database(FILE *out, struct dict *db);
/* Callbacks for SAXDB_WRITERs */
|