]> code.citadel.org Git - citadel.git/commitdiff
`ctdl3264` is back and it's DRY
authorArt Cancro <ajc@citadel.org>
Thu, 30 Mar 2023 15:23:03 +0000 (11:23 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 30 Mar 2023 15:23:03 +0000 (11:23 -0400)
citadel/Makefile
citadel/utils/ctdl3264.c

index 7243f6b1d10836cb8f697cf56a7a9e5cd2df3f6c..2227083538b9fab0b50deadbafd983f1f1be2280 100644 (file)
@@ -11,7 +11,7 @@
 # config.mk is generated by ./configure
 include config.mk
 
-all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd
+all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd ctdl3264
 all: $(all)
 
 citserver: server/*.c server/modules/*/*.c config.mk server/*.h
@@ -40,10 +40,10 @@ chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
 
 # The `ctdl3264` utility is being kept on hold for now, as it may be resurrected someday.
 # Add `ctdl3264` to the `all` target if we do that.
-#ctdl3264: utils/ctdl3264.c utils/*.h server/*.h utils/ctdl3264_structs.h
-#      cc ${CFLAGS} ${LDFLAGS} utils/ctdl3264.c -lcitadel -lz -ldb -o ctdl3264
-#utils/ctdl3264_structs.h: server/server.h utils/ctdl3264_prep.sh
-#      utils/ctdl3264_prep.sh
+ctdl3264: utils/ctdl3264.c utils/*.h server/*.h utils/ctdl3264_structs.h
+       cc ${CFLAGS} ${LDFLAGS} utils/ctdl3264.c -lcitadel -lz -ldb -o ctdl3264
+utils/ctdl3264_structs.h: server/server.h utils/ctdl3264_prep.sh
+       utils/ctdl3264_prep.sh
 
 config.mk: configure
        ./configure
index 39c1f55fa7610cefb4f1e1d5b8d695ec7a138562..8161ab725db083f6c617d75550383dd547f31af4 100644 (file)
@@ -165,6 +165,37 @@ void close_databases(void) {
        }
 }
 
+
+void null_function(void) {
+       printf("FIXME null_function() called which means we have more work to do!\n");
+}
+
+
+void (*convert_functions[])(void) = {
+       null_function,          // CDB_MSGMAIN
+       null_function,          // CDB_USERS
+       null_function,          // CDB_ROOMS
+       null_function,          // CDB_FLOORTAB
+       null_function,          // CDB_MSGLISTS
+       null_function,          // CDB_VISIT
+       null_function,          // CDB_DIRECTORY
+       null_function,          // CDB_USETABLE
+       null_function,          // CDB_BIGMSGS
+       null_function,          // CDB_FULLTEXT
+       null_function,          // CDB_EUIDINDEX
+       null_function,          // CDB_USERSBYNUMBER
+       null_function,          // CDB_EXTAUTH
+       null_function           // CDB_CONFIG
+};
+
+
+void convert_table(int which_cdb) {
+       printf("Converting table %d\n", which_cdb);
+       convert_functions[which_cdb]();
+
+}
+
+
 int main(int argc, char **argv) {
        char ctdldir[PATH_MAX]=CTDLDIR;
 
@@ -189,6 +220,9 @@ int main(int argc, char **argv) {
        }
 
        open_databases();
+       for (int i = 0; i < MAXCDB; ++i) {
+               convert_table(i);
+       }
        close_databases();
 
        exit(0);