/* * decode-kkc - try to decode HONEY BEE (WX331K) *.kkc file * by uratan! 2010.4.21 * * version: 0007 * * usage: * % decode-kkc wx331k.kkc > xxx.txt * * tested under * ・WX331K / (firmware 2009.8.31) * ・京セラPHSユーティリティソフトウェア Version 2.5.0 * ・*.kkc ファイル: header: 0x00000088 / version: "9.1.0" */ #include #include /* * compile options */ /* * display length of the string */ #define DISP_STR_LEN 0 /* * dump skip()ed data */ #define DUMP_SKIPPED_DATA 0 /* * macros constants */ #define NO_DECODE NULL #if DISP_STR_LEN # define LEN "(len:%d) " #else /* DISP_STR_LEN */ # define LEN "" #endif /* DISP_STR_LEN */ /* * functions */ int main(int argc, char *argv[]); void my_exit(char *s, int r); int get_long(char *format, const char **dec_tab); void get_stri(char *format); void skip(char *tag, int len); void decode_misc(const char **table, int n); /* * variables */ FILE *fp; /* * constants */ const char *tab_prop_tel[]; const char *tab_prop_addr[]; const char *tab_prop_mail[]; const char *tab_prop_main[]; const char *tab_prop_blood[]; const char *tab_prop_horo[]; const char *tab_grp_name[]; /* * */ int main(int argc, char *argv[]) { int n, i; /* * examine the parameters */ if(argc < 2) { fprintf(stderr, "usage: %s *.kkc\n", argv[0]); exit(1); } fp = fopen(argv[1], "rb"); if(fp == NULL) { fprintf(stderr, "can't open file: %s\n", argv[1]); exit(1); } /* * file header section */ printf("============================================\n"); get_long("header: 0x%08x\n", NO_DECODE); get_stri(" version: " LEN); get_long(" TERMINATER: 0x%08x\n", NO_DECODE); /* * address book section */ printf("============================================\n"); n = get_long("number-of-addresses: %d\n", NO_DECODE); for(i=0; i