1 #define _XOPEN_SOURCE 500
11 int main(int argc
, char **argv
) {
12 struct isds_ctx
*ctx
= NULL
;
14 struct isds_document document
;
17 struct tm
*date
= NULL
;
19 setlocale(LC_ALL
, "");
22 fprintf(stderr
, "Usage: program FILE DESCRIPTION\n");
28 printf("isds_init() failed: %s\n", isds_strerror(err
));
32 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
34 ctx
= isds_ctx_create();
36 printf("isds_ctx_create() failed");
39 err
= isds_set_timeout(ctx
, 10000);
41 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
46 memset(&document
, 0, sizeof(document
));
47 if (mmap_file(argv
[1], &fd
, &document
.data
, &document
.data_length
)) {
48 fprintf(stderr
, "Could not map file with document");
53 document
.dmFileDescr
= argv
[2];
56 /* Submit document for conversion */
57 printf("Submitting document for authorized conversion: "
58 "content=%s, description=%s\n", argv
[1], argv
[2]);
59 err
= czp_convert_document(ctx
, &document
, &id
, &date
);
61 printf("czp_convert_document() failed: %s: %s\n",
62 isds_strerror(err
), isds_long_message(ctx
));
64 printf("czp_convert_document() succeeded:\n");
65 printf("\tidentifier = %s\n", id
);
66 printf("\tsubmit date = ");
72 munmap_file(fd
, document
.data
, document
.data_length
);
76 err
= czp_close_connection(ctx
);
78 printf("czp_close_connetion() failed: %s\n", isds_strerror(err
));
82 err
= isds_ctx_free(&ctx
);
84 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
90 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));