Removed some stray comments
authorArt Cancro <ajc@citadel.org>
Tue, 11 Jul 2023 19:21:07 +0000 (10:21 -0900)
committerArt Cancro <ajc@citadel.org>
Tue, 11 Jul 2023 19:21:07 +0000 (10:21 -0900)
citadel/utils/ctdldump.c

index 51ac3d848765379f170fca6784a615acf50a5f49..962081c5d6d636b5a5482b362f93cb5a050d6d66 100644 (file)
@@ -152,7 +152,12 @@ void export_msgmain(int which_cdb, DBT *in_key, DBT *in_data) {
        // If the msgnum is negative, we are looking at METADATA
        if (in_msgnum < 0) {
                struct MetaData *meta = (struct MetaData *)in_data->data;
-               printf("msgmeta|%ld|%d|%s|%ld\n", meta->meta_msgnum, meta->meta_refcount, meta->meta_content_type, meta->meta_rfc822_length);
+               printf("msgmeta|%ld|%d|%s|%ld\n",
+                       meta->meta_msgnum,
+                       meta->meta_refcount,
+                       meta->meta_content_type,
+                       meta->meta_rfc822_length
+               );
        }
 
        // If the msgnum is positive, we are looking at a MESSAGE
@@ -170,20 +175,20 @@ void export_user(int which_cdb, DBT *in_key, DBT *in_data) {
        struct ctdluser *user = (struct ctdluser *)in_data->data;
 
        printf("user|%d|%d|%s|%u|%d|%ld|%ld|%d|%s|%ld|%ld|%s|%ld|%ld\n",
-               user->version,                  // Citadel version which created this record
-               user->uid,                      // Associate with a unix account?
-               user->password,                 // password
-               user->flags,                    // See US_ flags
-               user->axlevel,                  // Access level
-               user->usernum,                  // User number (never recycled)
-               user->lastcall,                 // Date/time of most recent login
-               user->USuserpurge,              // Purge time (in days) for user
-               user->fullname,                 // Display name (primary identifier)
-               user->msgnum_bio,               // msgnum of user's profile (bio)
-               user->msgnum_pic,               // msgnum of user's avatar (photo)
-               hexout(user->emailaddrs, strlen(user->emailaddrs)),     // Internet email addresses
-               user->msgnum_inboxrules,        // msgnum of user's inbox filtering rules
-               user->lastproc_inboxrules       // msgnum of last message filtered
+               user->version,
+               user->uid,
+               user->password,
+               user->flags,
+               user->axlevel,
+               user->usernum,
+               user->lastcall,
+               user->USuserpurge,
+               user->fullname,
+               user->msgnum_bio,
+               user->msgnum_pic,
+               hexout(user->emailaddrs, strlen(user->emailaddrs)),
+               user->msgnum_inboxrules,
+               user->lastproc_inboxrules
        );
 }
 
@@ -321,8 +326,10 @@ void export_bigmsgs(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT
 
        // printf("\033[32m\033[1mBigmsg %ld , length %d\033[0m\n", out_msgnum, out_data->size);
 }
+#endif
 
 
+#if 0
 // export function for EUID Index records
 void export_euidindex(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) {
 
@@ -359,9 +366,12 @@ void export_euidindex(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DB
        memcpy(out_data->data+sizeof(out_msgnum), &out_roomnum, sizeof(out_roomnum));
        strcpy(out_data->data+sizeof(out_msgnum)+sizeof(out_roomnum), euid);
 }
+#endif
 
 
-// convert users-by-number records
+#if 0
+// export users-by-number records
+// (This is a secondary index -- should we just regenerate the data after import?)
 void export_usersbynumber(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) {
 
        // key is a long
@@ -387,8 +397,10 @@ void export_usersbynumber(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key
 
        // printf("usersbynumber: %ld --> %s\n", out_usernum, (char *)out_data->data);
 }
+#endif
 
 
+#if 0
 // export function for a config record
 void export_config(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) {
 
@@ -409,12 +421,12 @@ void export_config(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *
        // please excuse my friend, he isn't null terminated
        // printf("\033[32m\033[1mConfig entry: %s -> %s\033[0m\n", (char *)out_key->data, (char *)out_data->data+strlen(out_data->data)+1);
 }
-
 #endif
 
+
 // For obsolete databases, zero all the output
 void zero_function(int which_cdb, DBT *in_key, DBT *in_data) {
-       //printf("Table %02x, keylen=%d, datalen=%d\n", which_cdb, in_key->size, in_data->size);
+       // do nothing
 }
 
 
@@ -492,7 +504,7 @@ void export_table(int which_cdb, DB_ENV *src_dbenv) {
                        // Do we need to decompress?
                        static int32_t magic = COMPRESS_MAGIC;
                        compressed = 0;
-                       if ( (in_data.size >= sizeof(struct CtdlCompressHeader)) && (!memcmp(in_data.data, &magic, sizeof(magic))) ) {
+                       if ((in_data.size >= sizeof(struct CtdlCompressHeader)) && (!memcmp(in_data.data, &magic, sizeof(magic)))) {
        
                                // yes, we need to decompress
                                compressed = 1;
@@ -502,7 +514,9 @@ void export_table(int which_cdb, DB_ENV *src_dbenv) {
                                uncomp_data.data = realloc(uncomp_data.data, uncomp_data.size);
                                destLen = (uLongf)comp.uncompressed_len;
        
-                               ret = uncompress((Bytef *)uncomp_data.data, (uLongf *)&destLen, (const Bytef *)in_data.data+sizeof(struct CtdlCompressHeader), (uLong)comp.compressed_len);
+                               ret = uncompress((Bytef *)uncomp_data.data, (uLongf *)&destLen,
+                                               (const Bytef *)in_data.data+sizeof(struct CtdlCompressHeader),
+                                               (uLong)comp.compressed_len);
                                if (ret != Z_OK) {
                                        fprintf(stderr, "db: uncompress() error %d\n", ret);
                                        exit(CTDLEXIT_DB);
@@ -558,7 +572,7 @@ int main(int argc, char **argv) {
 
        // Warn the user
        fprintf(stderr, "------------------------------------------------------------------------\n");
-       fprintf(stderr, "This utility must be run while the server is OFFLINE.                   \n");
+       fprintf(stderr, "This utility must be run while the server is NOT RUNNING.               \n");
        fprintf(stderr, "We \033[1mguarantee\033[0m data corruption if you do not                              \n");
        fprintf(stderr, "observe this warning!  The source [-s] directory should contain a copy  \n");
        fprintf(stderr, "of the database from your source system.  The dump [-d] directory       \n");