7 const char *hidden_host_suffix
;
9 /* because recdb likes to log stuff.. */
10 void log_module(UNUSED_ARG(struct log_type
*lt
), UNUSED_ARG(enum log_severity ls
), const char *format
, ...)
14 vfprintf(stderr
, format
, va
);
19 /* and because saxdb is tied in to lots of stuff.. */
23 void *conf_get_data(UNUSED_ARG(const char *full_path
), UNUSED_ARG(enum recdb_type type
)) {
27 void conf_register_reload(UNUSED_ARG(conf_reload_func crf
)) {
30 void reg_exit_func(UNUSED_ARG(exit_func_t handler
)) {
33 void timeq_add(UNUSED_ARG(time_t when
), UNUSED_ARG(timeq_func func
), UNUSED_ARG(void *data
)) {
36 void timeq_del(UNUSED_ARG(time_t when
), UNUSED_ARG(timeq_func func
), UNUSED_ARG(void *data
), UNUSED_ARG(int mask
)) {
39 int send_message(UNUSED_ARG(struct userNode
*dest
), UNUSED_ARG(struct userNode
*src
), UNUSED_ARG(const char *message
), ...) {
43 struct module *module_register(UNUSED_ARG(const char *name
), UNUSED_ARG(enum log_type clog
), UNUSED_ARG(const char *helpfile_name
), UNUSED_ARG(expand_func_t expand_help
)) {
47 struct modcmd
*modcmd_register(UNUSED_ARG(struct module *module), UNUSED_ARG(const char *name
), UNUSED_ARG(modcmd_func_t func
), UNUSED_ARG(unsigned int min_argc
), UNUSED_ARG(unsigned int flags
), ...) {
51 void table_send(UNUSED_ARG(struct userNode
*from
), UNUSED_ARG(const char *to
), UNUSED_ARG(unsigned int size
), UNUSED_ARG(irc_send_func irc_send
), UNUSED_ARG(struct helpfile_table table
)) {
54 /* back to our regularly scheduled code: */
56 int check_record(const char *key
, void *data
, UNUSED_ARG(void *extra
))
58 struct record_data
*rd
= data
;
61 fprintf(stdout
, "Invalid database record type for key %s\n", key
);
64 case RECDB_STRING_LIST
:
67 return dict_foreach(rd
->d
.object
, check_record
, NULL
) ? 1 : 0;
72 int main(int argc
, char *argv
[])
77 if (argc
< 2 || argc
> 3) {
78 fprintf(stderr
, "%s usage: %s <dbfile> [outputfile]\n\n", argv
[0], argv
[0]);
79 fprintf(stderr
, "If [outputfile] is specified, dbfile is rewritten into outputfile after being\nparsed.\n\n");
80 fprintf(stderr
, "<dbfile> and/or [outputfile] may be given as '-' to use stdin and stdout,\nrespectively.\n");
85 if (!strcmp(argv
[1], "-")) {
86 infile
= "/dev/stdin";
90 if (!(db
= parse_database(infile
))) return 2;
91 fprintf(stdout
, "Database read okay.\n");
93 if (dict_foreach(db
, check_record
, 0)) return 3;
95 fprintf(stdout
, "Database checked okay.\n");
102 if (!strcmp(argv
[2], "-")) {
105 if (!(f
= fopen(argv
[2], "w+"))) {
106 fprintf(stderr
, "fopen: %s\n", strerror(errno
));
111 write_database(f
, db
);
113 fprintf(stdout
, "Database written okay.\n");