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) 2024 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[1m"
42 "╔════════════════════════════════════════════════════════════════════════╗\n"
43 "║ dbnothing utility for Citadel ║\n"
44 "║ Copyright (c) 2023-2024 by citadel.org et al. ║\n"
45 "║ This program is open source software. Use, duplication, or disclosure ║\n"
46 "║ is subject to the terms of the GNU General Public license v3. ║\n"
47 "╚════════════════════════════════════════════════════════════════════════╝\033[0m\n"
52 while ((a = getopt(argc, argv, "h:y")) != EOF) {
58 fprintf(stderr, "%s: usage: %s -s citadel_dir [>dumpfile]\n", argv[0], argv[0]);
63 if (chdir(ctdldir) != 0) {
64 fprintf(stderr, "ctdlload: unable to change directory to [%s]: %m", ctdldir);
68 // backend modules use syslog -- redirect to stderr
69 openlog("dbnothing", LOG_PERROR , LOG_DAEMON);
71 // initialize the database backend
76 fprintf(stderr, "\ndbnothing: doing nothing\n\n");
79 cdb_close_databases();
81 fprintf(stderr, "dbnothing: \033[32m\033[1mfinished\033[0m\n");