1 // This is a test utility for the backend API. It simply opens and closes the databases.
2 // There is no need for end users to ever run this program. So don't. And don't ask.
4 // Copyright (c) 2023 by Art Cancro citadel.org
6 // This program is open source software. Use, duplication, or disclosure
7 // is subject to the terms of the GNU General Public License, version 3.
14 #include <sys/types.h>
15 #include <sys/socket.h>
24 #include <libcitadel.h>
26 #include "../server/sysdep.h"
27 #include "../server/citadel_defs.h"
28 #include "../server/server.h"
29 #include "../server/citadel_dirs.h"
30 #include "../server/database.h"
35 int main(int argc, char **argv) {
38 char *ctdldir = CTDLDIR;
40 // display the greeting
41 fprintf(stderr, "\033[44m\033[33m\033[1m \033[K\033[0m\n"
42 "\033[44m\033[33m\033[1m dbnothing utility for Citadel \033[K\033[0m\n"
43 "\033[44m\033[33m\033[1m Copyright (c) 2023 by citadel.org et al. \033[K\033[0m\n"
44 "\033[44m\033[33m\033[1m This program is open source software. Use, duplication, or disclosure \033[K\033[0m\n"
45 "\033[44m\033[33m\033[1m is subject to the terms of the GNU General Public license v3. \033[K\033[0m\n"
46 "\033[44m\033[33m\033[1m \033[K\033[0m\n");
50 while ((a = getopt(argc, argv, "h:y")) != EOF) {
56 fprintf(stderr, "%s: usage: %s -s citadel_dir [>dumpfile]\n", argv[0], argv[0]);
61 if (chdir(ctdldir) != 0) {
62 fprintf(stderr, "ctdlload: unable to change directory to [%s]: %m", ctdldir);
66 // backend modules use syslog -- redirect to stderr
67 openlog("dbnothing", LOG_PERROR , LOG_DAEMON);
69 // initialize the database backend
74 fprintf(stderr, "\ndbnothing: doing nothing\n\n");
77 cdb_close_databases();
79 fprintf(stderr, "dbnothing: \033[32m\033[1mfinished\033[0m\n");