69 apr_pool_t *pool, *gc_pool;
70 int i, first_arg_index;
73 if (APR_SUCCESS != (status = apr_initialize())) {
74 DEBUG_ERR(
"error calling apr_initialize: %s", apr_strerror(status, errbuf, 128));
78 if (APR_SUCCESS != (status = apr_pool_create(&pool, NULL))) {
79 DEBUG_ERR(
"error calling apr_pool_create: %s", apr_strerror(status, errbuf, 128));
84 conf = ft_config_create(pool);
85 if (APR_SUCCESS != (status = ft_config_parse_args(conf, argc, argv, &first_arg_index))) {
92 if (APR_SUCCESS != (status = apr_pool_create(&gc_pool, pool))) {
93 DEBUG_ERR(
"error calling apr_pool_create: %s", apr_strerror(status, errbuf, 128));
97 for (i = first_arg_index; i < argc; i++) {
98 const char *current_arg = argv[i];
99 char *resolved_path = (
char *) current_arg;
102 if (is_option_set(conf->mask, OPTION_JSON)) {
104 status = apr_filepath_merge(&resolved_path, NULL, current_arg, APR_FILEPATH_TRUENAME, gc_pool);
105 if (APR_SUCCESS != status) {
106 DEBUG_ERR(
"Error resolving absolute path for argument %s: %s.", current_arg,
107 apr_strerror(status, errbuf, 128));
113 if (APR_SUCCESS != (status = ft_traverse_path(conf, resolved_path))) {
114 DEBUG_ERR(
"error calling ft_traverse_path: %s", apr_strerror(status, errbuf, 128));
121 if (is_option_set(conf->mask, OPTION_PUZZL)) {
123 if (is_option_set(conf->mask, OPTION_JSON)) {
124 fprintf(stderr,
"Error: JSON output is currently not supported in image comparison mode (-I).\n");
131 DEBUG_ERR(
"error calling ft_image_twin_report: %s", apr_strerror(status, errbuf, 128));
138 if (APR_SUCCESS != (status = ft_process_files(conf))) {
139 DEBUG_ERR(
"error calling ft_process_files: %s", apr_strerror(status, errbuf, 128));
145 if (is_option_set(conf->mask, OPTION_JSON)) {
147 DEBUG_ERR(
"error calling ft_report_json: %s", apr_strerror(status, errbuf, 128));
155 DEBUG_ERR(
"error calling ft_report_duplicates: %s", apr_strerror(status, errbuf, 128));
165 fprintf(stderr,
"Please submit at least two files...\n");