From: Art Cancro Date: Fri, 14 Apr 2023 15:36:19 +0000 (-0400) Subject: IBM i , aka System/38 , really is dead , no matter how much they deny it. X-Git-Tag: v976~34 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=ecfaa2cc6d9f2364e57b1f0665b907f53a0fff9c;p=citadel.git IBM i , aka System/38 , really is dead , no matter how much they deny it. --- diff --git a/citadel/utils/ctdl3264.c b/citadel/utils/ctdl3264.c index 17462c43f..9703d4722 100644 --- a/citadel/utils/ctdl3264.c +++ b/citadel/utils/ctdl3264.c @@ -119,13 +119,12 @@ void convert_msgmain(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT abort(); } - printf("\033[32m\033[1mMessage: %ld\033[0m\n", out_msgnum); // If the msgnum is negative, we are looking at METADATA if (in_msgnum < 0) { struct MetaData_32 *meta32 = (struct MetaData_32 *)in_data->data; - //printf("metadata: msgnum=%d , refcount=%d , content_type=\"%s\" , rfc822len=%d\n", meta32->meta_msgnum, meta32->meta_refcount, meta32->meta_content_type, meta32->meta_rfc822_length); + printf("\033[32m\033[1mMetadata: msgnum=%d , refcount=%d , content_type=\"%s\" , rfc822len=%d\033[0m\n", meta32->meta_msgnum, meta32->meta_refcount, meta32->meta_content_type, meta32->meta_rfc822_length); out_key->size = sizeof(long); out_key->data = realloc(out_key->data, out_key->size); @@ -151,6 +150,7 @@ void convert_msgmain(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT out_data->size = in_data->size; out_data->data = realloc(out_data->data, out_data->size); memcpy(out_data->data, in_data->data, out_data->size); + printf("\033[32m\033[1mMessage: %ld\033[0m\n", out_msgnum); } // If the msgnum is 0 it's probably not a valid record. @@ -342,11 +342,34 @@ void convert_dir(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *ou out_data->data = realloc(out_data->data, out_data->size); memcpy(out_data->data, in_data->data, in_data->size); - // excuse my friend + // please excuse my friend, he isn't null terminated printf("\033[32m\033[1mDirectory entry: %s -> %s\033[0m\n", (char *)out_key->data, (char *)out_data->data); } +// convert function for a use table record +void convert_usetable(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) { + + // the key is a string + out_key->size = in_key->size; + out_key->data = realloc(out_key->data, out_key->size); + memcpy(out_key->data, in_key->data, in_key->size); + + // the data is a "struct UseTable" + struct UseTable_32 *use32 = (struct UseTable_32 *)in_data->data; + out_data->size = sizeof(struct UseTable); + out_data->data = realloc(out_data->data, out_data->size); + struct UseTable *use64 = (struct UseTable *)out_data->data; + + // convert the data + strcpy(use64->ut_msgid, use32->ut_msgid); + use64->ut_timestamp = (time_t) use32->ut_timestamp; + + // FIXME compress this record before sending it to the new database. we are getting 100x space savings in some places! +} + + + void (*convert_functions[])(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *out_data) = { convert_msgmain, // CDB_MSGMAIN convert_users, // CDB_USERS @@ -355,7 +378,7 @@ void (*convert_functions[])(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_k convert_msglists, // CDB_MSGLISTS convert_visits, // CDB_VISIT convert_dir, // CDB_DIRECTORY - null_function, // CDB_USETABLE + convert_usetable, // CDB_USETABLE null_function, // CDB_BIGMSGS null_function, // CDB_FULLTEXT null_function, // CDB_EUIDINDEX diff --git a/citadel/utils/ctdl3264_prep.sh b/citadel/utils/ctdl3264_prep.sh index 80ec0a233..8a1cffc9d 100755 --- a/citadel/utils/ctdl3264_prep.sh +++ b/citadel/utils/ctdl3264_prep.sh @@ -35,5 +35,6 @@ convert_struct() { convert_struct "visit_index" convert_struct "MetaData" convert_struct "CtdlCompressHeader" + convert_struct "UseTable" ) >utils/ctdl3264_structs.h