00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <string.h>
00023 #include <muse.h>
00024
00025
00048
00049
00052 #define PRINT_USAGE(rc) \
00053 fprintf(stderr, "Usage: %s FILENAME TAG\n", argv[0]); \
00054 cpl_end(); return (rc);
00055
00056 int main(int argc, char **argv)
00057 {
00058 cpl_init(CPL_INIT_DEFAULT);
00059 muse_processing_recipeinfo(NULL);
00060
00061 if (argc <= 2) {
00062
00063 PRINT_USAGE(1);
00064 }
00065
00066
00067 char *iname = NULL,
00068 *tag = NULL;
00069 int i;
00070 for (i = 1; i < argc; i++) {
00071 if (strncmp(argv[i], "-", 1) == 0) {
00072 PRINT_USAGE(9);
00073 } else {
00074 if (iname && tag) {
00075 break;
00076 }
00077 if (!iname) {
00078 iname = argv[i];
00079 } else {
00080 tag = argv[i];
00081 }
00082 }
00083 }
00084
00085 cpl_errorstate state = cpl_errorstate_get();
00086
00087 cpl_frameset *fset = cpl_frameset_new();
00088 cpl_frame *frame = cpl_frame_new();
00089 cpl_frame_set_filename(frame, iname);
00090 cpl_frame_set_tag(frame, tag);
00091 cpl_frame_set_type(frame, CPL_FRAME_TYPE_TABLE);
00092 cpl_frame_set_group(frame, CPL_FRAME_GROUP_PRODUCT);
00093 cpl_frame_set_level(frame, CPL_FRAME_LEVEL_FINAL);
00094 printf("Working on \"%s\" (tag %s).\n", iname, tag);
00095 #if 0
00096 printf("frame!\n");
00097 cpl_frame_dump(frame, stdout);
00098 fflush(stdout);
00099 #endif
00100 cpl_frameset_insert(fset, frame);
00101 #if 0
00102 printf("fset unsigned!\n");
00103 cpl_frameset_dump(fset, stdout);
00104 fflush(stdout);
00105 #endif
00106 cpl_dfs_sign_products(fset, CPL_DFS_SIGNATURE_DATAMD5 | CPL_DFS_SIGNATURE_CHECKSUM);
00107 #if 0
00108 printf("fset signed!\n");
00109 cpl_frameset_dump(fset, stdout);
00110 fflush(stdout);
00111 #endif
00112 cpl_frameset_delete(fset);
00113
00114 int rc = 0;
00115 if (!cpl_errorstate_is_equal(state)) {
00116 cpl_errorstate_dump(state, CPL_FALSE, muse_cplerrorstate_dump_some);
00117 rc = 50;
00118 }
00119 #if 0
00120 cpl_memory_dump();
00121 #endif
00122 cpl_end();
00123 return rc;
00124 }
00125