2 File autogenerated by gengetopt version 2.22
3 generated with the following command:
4 /usr/local/bin/gengetopt --output-dir=/home/tbaudier/vv/vv_static/vv/vv_bin/tools --arg-struct-name=args_info_clitkProfileImage --func-name=cmdline_parser_clitkProfileImage --file-name=clitkProfileImage_ggo --unamed-opts --conf-parser --include-getopt
6 The developers of gengetopt consider the fixed text that goes in all
7 gengetopt output files to be in the public domain:
8 we make no copyright claims on it.
11 /* If we use autoconf. */
21 #include "clitkProfileImage_ggo.h"
23 const char *args_info_clitkProfileImage_purpose = "Save the profile between 2 points of the input image in the output text file";
25 const char *args_info_clitkProfileImage_usage = "Usage: clitkProfileImage [OPTIONS]... [FILES]...";
27 const char *args_info_clitkProfileImage_description = "";
29 const char *args_info_clitkProfileImage_help[] = {
30 " -h, --help Print help and exit",
31 " -V, --version Print version and exit",
32 " --config=STRING Config file",
33 " -v, --verbose Verbose (default=off)",
34 " --imagetypes Display allowed image types (default=off)",
35 " -i, --input=STRING Input image filename",
36 " -o, --output=STRING Output texte filename",
37 " -f, --point1=DOUBLE First point (mm)",
38 " -s, --point2=DOUBLE Second point (mm)",
46 } cmdline_parser_clitkProfileImage_arg_type;
49 void clear_given (struct args_info_clitkProfileImage *args_info);
51 void clear_args (struct args_info_clitkProfileImage *args_info);
54 cmdline_parser_clitkProfileImage_internal (int argc, char * const *argv, struct args_info_clitkProfileImage *args_info,
55 struct cmdline_parser_clitkProfileImage_params *params, const char *additional_error);
58 cmdline_parser_clitkProfileImage_required2 (struct args_info_clitkProfileImage *args_info, const char *prog_name, const char *additional_error);
62 struct line_list * next;
65 static struct line_list *cmd_line_list = 0;
66 static struct line_list *cmd_line_list_tmp = 0;
71 /* free the list of a previous call */
74 while (cmd_line_list) {
75 cmd_line_list_tmp = cmd_line_list;
76 cmd_line_list = cmd_line_list->next;
77 free (cmd_line_list_tmp->string_arg);
78 free (cmd_line_list_tmp);
85 gengetopt_strdup (const char *s);
88 void clear_given (struct args_info_clitkProfileImage *args_info)
90 args_info->help_given = 0 ;
91 args_info->version_given = 0 ;
92 args_info->config_given = 0 ;
93 args_info->verbose_given = 0 ;
94 args_info->imagetypes_given = 0 ;
95 args_info->input_given = 0 ;
96 args_info->output_given = 0 ;
97 args_info->point1_given = 0 ;
98 args_info->point2_given = 0 ;
102 void clear_args (struct args_info_clitkProfileImage *args_info)
104 args_info->config_arg = NULL;
105 args_info->config_orig = NULL;
106 args_info->verbose_flag = 0;
107 args_info->imagetypes_flag = 0;
108 args_info->input_arg = NULL;
109 args_info->input_orig = NULL;
110 args_info->output_arg = NULL;
111 args_info->output_orig = NULL;
112 args_info->point1_arg = NULL;
113 args_info->point1_orig = NULL;
114 args_info->point2_arg = NULL;
115 args_info->point2_orig = NULL;
120 void init_args_info(struct args_info_clitkProfileImage *args_info)
124 args_info->help_help = args_info_clitkProfileImage_help[0] ;
125 args_info->version_help = args_info_clitkProfileImage_help[1] ;
126 args_info->config_help = args_info_clitkProfileImage_help[2] ;
127 args_info->verbose_help = args_info_clitkProfileImage_help[3] ;
128 args_info->imagetypes_help = args_info_clitkProfileImage_help[4] ;
129 args_info->input_help = args_info_clitkProfileImage_help[5] ;
130 args_info->output_help = args_info_clitkProfileImage_help[6] ;
131 args_info->point1_help = args_info_clitkProfileImage_help[7] ;
132 args_info->point1_min = -1;
133 args_info->point1_max = 4;
134 args_info->point2_help = args_info_clitkProfileImage_help[8] ;
135 args_info->point2_min = -1;
136 args_info->point2_max = 4;
141 cmdline_parser_clitkProfileImage_print_version (void)
143 printf ("%s %s\n", CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, CMDLINE_PARSER_CLITKPROFILEIMAGE_VERSION);
146 static void print_help_common(void) {
147 cmdline_parser_clitkProfileImage_print_version ();
149 if (strlen(args_info_clitkProfileImage_purpose) > 0)
150 printf("\n%s\n", args_info_clitkProfileImage_purpose);
152 if (strlen(args_info_clitkProfileImage_usage) > 0)
153 printf("\n%s\n", args_info_clitkProfileImage_usage);
157 if (strlen(args_info_clitkProfileImage_description) > 0)
158 printf("%s\n", args_info_clitkProfileImage_description);
162 cmdline_parser_clitkProfileImage_print_help (void)
166 while (args_info_clitkProfileImage_help[i])
167 printf("%s\n", args_info_clitkProfileImage_help[i++]);
171 cmdline_parser_clitkProfileImage_init (struct args_info_clitkProfileImage *args_info)
173 clear_given (args_info);
174 clear_args (args_info);
175 init_args_info (args_info);
177 args_info->inputs = NULL;
178 args_info->inputs_num = 0;
182 cmdline_parser_clitkProfileImage_params_init(struct cmdline_parser_clitkProfileImage_params *params)
186 params->override = 0;
187 params->initialize = 1;
188 params->check_required = 1;
189 params->check_ambiguity = 0;
190 params->print_errors = 1;
194 struct cmdline_parser_clitkProfileImage_params *
195 cmdline_parser_clitkProfileImage_params_create(void)
197 struct cmdline_parser_clitkProfileImage_params *params =
198 (struct cmdline_parser_clitkProfileImage_params *)malloc(sizeof(struct cmdline_parser_clitkProfileImage_params));
199 cmdline_parser_clitkProfileImage_params_init(params);
204 free_string_field (char **s)
213 /** @brief generic value variable */
214 union generic_value {
219 /** @brief holds temporary values for multiple options */
222 union generic_value arg;
224 struct generic_list *next;
228 * @brief add a node at the head of the list
230 static void add_node(struct generic_list **list) {
231 struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list));
232 new_node->next = *list;
234 new_node->arg.string_arg = NULL;
235 new_node->orig = NULL;
239 free_multiple_field(unsigned int len, void **arg, char ***orig)
243 for (i = 0; i < len; ++i)
245 free_string_field(&((*orig)[i]));
257 cmdline_parser_clitkProfileImage_release (struct args_info_clitkProfileImage *args_info)
260 free_string_field (&(args_info->config_arg));
261 free_string_field (&(args_info->config_orig));
262 free_string_field (&(args_info->input_arg));
263 free_string_field (&(args_info->input_orig));
264 free_string_field (&(args_info->output_arg));
265 free_string_field (&(args_info->output_orig));
266 free_multiple_field (args_info->point1_given, (void **)&(args_info->point1_arg), &(args_info->point1_orig));
267 free_multiple_field (args_info->point2_given, (void **)&(args_info->point2_arg), &(args_info->point2_orig));
270 for (i = 0; i < args_info->inputs_num; ++i)
271 free (args_info->inputs [i]);
273 if (args_info->inputs_num)
274 free (args_info->inputs);
276 clear_given (args_info);
281 write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
284 fprintf(outfile, "%s=\"%s\"\n", opt, arg);
286 fprintf(outfile, "%s\n", opt);
291 write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, char *values[])
295 for (i = 0; i < len; ++i)
296 write_into_file(outfile, opt, (arg ? arg[i] : 0), values);
300 cmdline_parser_clitkProfileImage_dump(FILE *outfile, struct args_info_clitkProfileImage *args_info)
306 fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE);
310 if (args_info->help_given)
311 write_into_file(outfile, "help", 0, 0 );
312 if (args_info->version_given)
313 write_into_file(outfile, "version", 0, 0 );
314 if (args_info->config_given)
315 write_into_file(outfile, "config", args_info->config_orig, 0);
316 if (args_info->verbose_given)
317 write_into_file(outfile, "verbose", 0, 0 );
318 if (args_info->imagetypes_given)
319 write_into_file(outfile, "imagetypes", 0, 0 );
320 if (args_info->input_given)
321 write_into_file(outfile, "input", args_info->input_orig, 0);
322 if (args_info->output_given)
323 write_into_file(outfile, "output", args_info->output_orig, 0);
324 write_multiple_into_file(outfile, args_info->point1_given, "point1", args_info->point1_orig, 0);
325 write_multiple_into_file(outfile, args_info->point2_given, "point2", args_info->point2_orig, 0);
333 cmdline_parser_clitkProfileImage_file_save(const char *filename, struct args_info_clitkProfileImage *args_info)
338 outfile = fopen(filename, "w");
342 fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, filename);
346 i = cmdline_parser_clitkProfileImage_dump(outfile, args_info);
353 cmdline_parser_clitkProfileImage_free (struct args_info_clitkProfileImage *args_info)
355 cmdline_parser_clitkProfileImage_release (args_info);
358 /** @brief replacement of strdup, which is not standard */
360 gengetopt_strdup (const char *s)
366 result = (char*)malloc(strlen(s) + 1);
367 if (result == (char*)0)
374 get_multiple_arg_token(const char *arg)
377 size_t len, num_of_escape, i, j;
382 tok = strchr (arg, ',');
385 /* make sure it is not escaped */
388 if (*(tok-1) == '\\')
390 /* find the next one */
391 tok = strchr (tok+1, ',');
399 len = (size_t)(tok - arg + 1);
401 len = strlen (arg) + 1;
403 len -= num_of_escape;
405 ret = (char *) malloc (len);
409 while (arg[i] && (j < len-1))
411 if (arg[i] == '\\' &&
425 get_multiple_arg_token_next(const char *arg)
432 tok = strchr (arg, ',');
434 /* make sure it is not escaped */
437 if (*(tok-1) == '\\')
439 /* find the next one */
440 tok = strchr (tok+1, ',');
446 if (! tok || strlen(tok) == 1)
453 check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, int min, int max, const char *option_desc);
456 check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, int min, int max, const char *option_desc)
460 if (option_given && ! (min < 0 && max < 0))
462 if (min >= 0 && max >= 0)
466 /* specific occurrences */
467 if (option_given != min)
469 fprintf (stderr, "%s: %s option occurrences must be %d\n",
470 prog_name, option_desc, min);
474 else if (option_given < min
475 || option_given > max)
477 /* range occurrences */
478 fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n",
479 prog_name, option_desc, min, max);
486 if (option_given < min)
488 fprintf (stderr, "%s: %s option occurrences must be at least %d\n",
489 prog_name, option_desc, min);
496 if (option_given > max)
498 fprintf (stderr, "%s: %s option occurrences must be at most %d\n",
499 prog_name, option_desc, max);
508 cmdline_parser_clitkProfileImage (int argc, char * const *argv, struct args_info_clitkProfileImage *args_info)
510 return cmdline_parser_clitkProfileImage2 (argc, argv, args_info, 0, 1, 1);
514 cmdline_parser_clitkProfileImage_ext (int argc, char * const *argv, struct args_info_clitkProfileImage *args_info,
515 struct cmdline_parser_clitkProfileImage_params *params)
518 result = cmdline_parser_clitkProfileImage_internal (argc, argv, args_info, params, NULL);
520 if (result == EXIT_FAILURE)
522 cmdline_parser_clitkProfileImage_free (args_info);
530 cmdline_parser_clitkProfileImage2 (int argc, char * const *argv, struct args_info_clitkProfileImage *args_info, int override, int initialize, int check_required)
533 struct cmdline_parser_clitkProfileImage_params params;
535 params.override = override;
536 params.initialize = initialize;
537 params.check_required = check_required;
538 params.check_ambiguity = 0;
539 params.print_errors = 1;
541 result = cmdline_parser_clitkProfileImage_internal (argc, argv, args_info, ¶ms, NULL);
543 if (result == EXIT_FAILURE)
545 cmdline_parser_clitkProfileImage_free (args_info);
553 cmdline_parser_clitkProfileImage_required (struct args_info_clitkProfileImage *args_info, const char *prog_name)
555 int result = EXIT_SUCCESS;
557 if (cmdline_parser_clitkProfileImage_required2(args_info, prog_name, NULL) > 0)
558 result = EXIT_FAILURE;
560 if (result == EXIT_FAILURE)
562 cmdline_parser_clitkProfileImage_free (args_info);
570 cmdline_parser_clitkProfileImage_required2 (struct args_info_clitkProfileImage *args_info, const char *prog_name, const char *additional_error)
574 /* checks for required options */
575 if (! args_info->input_given)
577 fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
581 if (! args_info->output_given)
583 fprintf (stderr, "%s: '--output' ('-o') option required%s\n", prog_name, (additional_error ? additional_error : ""));
587 if (! args_info->point1_given)
589 fprintf (stderr, "%s: '--point1' ('-f') option required%s\n", prog_name, (additional_error ? additional_error : ""));
593 if (check_multiple_option_occurrences(prog_name, args_info->point1_given, args_info->point1_min, args_info->point1_max, "'--point1' ('-f')"))
596 if (! args_info->point2_given)
598 fprintf (stderr, "%s: '--point2' ('-s') option required%s\n", prog_name, (additional_error ? additional_error : ""));
602 if (check_multiple_option_occurrences(prog_name, args_info->point2_given, args_info->point2_min, args_info->point2_max, "'--point2' ('-s')"))
606 /* checks for dependences among options */
612 * Extracted from the glibc source tree, version 2.3.6
614 * Licensed under the GPL as per the whole glibc source tree.
616 * This file was modified so that getopt_long can be called
617 * many times without risking previous memory to be spoiled.
619 * Modified by Andre Noll and Lorenzo Bettini for use in
620 * GNU gengetopt generated files.
625 * we must include anything we need since this file is not thought to be
626 * inserted in a file already using getopt.h
634 /* has_arg can't be an enum because some compilers complain about
635 type mismatches in all the code that assumes it is an int. */
641 /* For communication from `getopt' to the caller.
642 When `getopt' finds an option that takes an argument,
643 the argument value is returned here.
644 Also, when `ordering' is RETURN_IN_ORDER,
645 each non-option ARGV-element is returned here. */
649 /* Index in ARGV of the next element to be scanned.
650 This is used for communication to and from the caller
651 and for communication between successive calls to `getopt'.
653 On entry to `getopt', zero means this is the first call; initialize.
655 When `getopt' returns -1, this is the index of the first of the
656 non-option elements that the caller should itself scan.
658 Otherwise, `optind' communicates from one call to the next
659 how much of ARGV has been scanned so far. */
663 /* Callers store zero here to inhibit the error message `getopt' prints
664 for unrecognized options. */
668 /* Set to an option character which was unrecognized. */
672 /* This version of `getopt' appears to the caller like standard Unix `getopt'
673 but it behaves differently for the user, since it allows the user
674 to intersperse the options with the other arguments.
676 As `getopt' works, it permutes the elements of ARGV so that,
677 when it is done, all the options precede everything else. Thus
678 all application programs are extended to handle flexible argument order.
681 If the field `flag' is not NULL, it points to a variable that is set
682 to the value given in the field `val' when the option is found, but
683 left unchanged if the option is not found.
685 To have a long-named option do something other than set an `int' to
686 a compiled-in constant, such as set a value from `custom_optarg', set the
687 option's `flag' field to zero and its `val' field to a nonzero
688 value (the equivalent single-letter option character, if there is
689 one). For long options that have a zero `flag' field, `getopt'
690 returns the contents of the `val' field. */
692 /* Names for the values of the `has_arg' field of `struct option'. */
694 #define no_argument 0
697 #ifndef required_argument
698 #define required_argument 1
701 #ifndef optional_argument
702 #define optional_argument 2
705 struct custom_getopt_data {
707 * These have exactly the same meaning as the corresponding global variables,
708 * except that they are used for the reentrant versions of getopt.
715 /* True if the internal members have been initialized. */
719 * The next char to be scanned in the option-element in which the last option
720 * character we returned was found. This allows us to pick up the scan where
721 * we left off. If this is zero, or a null string, it means resume the scan by
722 * advancing to the next ARGV-element.
727 * Describe the part of ARGV that contains non-options that have been skipped.
728 * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
729 * the index after the last of them.
736 * the variables optarg, optind, opterr and optopt are renamed with
737 * the custom_ prefix so that they don't interfere with getopt ones.
739 * Moreover they're static so they are visible only from within the
740 * file where this very file will be included.
744 * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an
745 * option that takes an argument, the argument value is returned here.
747 static char *custom_optarg;
750 * Index in ARGV of the next element to be scanned. This is used for
751 * communication to and from the caller and for communication between
752 * successive calls to `custom_getopt'.
754 * On entry to `custom_getopt', 1 means this is the first call; initialize.
756 * When `custom_getopt' returns -1, this is the index of the first of the non-option
757 * elements that the caller should itself scan.
759 * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV
760 * has been scanned so far.
762 * 1003.2 says this must be 1 before any call.
764 static int custom_optind = 1;
767 * Callers store zero here to inhibit the error message for unrecognized
770 static int custom_opterr = 1;
773 * Set to an option character which was unrecognized. This must be initialized
774 * on some systems to avoid linking in the system's own getopt implementation.
776 static int custom_optopt = '?';
779 * Exchange two adjacent subsequences of ARGV. One subsequence is elements
780 * [first_nonopt,last_nonopt) which contains all the non-options that have been
781 * skipped so far. The other is elements [last_nonopt,custom_optind), which contains
782 * all the options processed since those non-options were skipped.
783 * `first_nonopt' and `last_nonopt' are relocated so that they describe the new
784 * indices of the non-options in ARGV after they are moved.
786 static void exchange(char **argv, struct custom_getopt_data *d)
788 int bottom = d->first_nonopt;
789 int middle = d->last_nonopt;
790 int top = d->custom_optind;
794 * Exchange the shorter segment with the far end of the longer segment.
795 * That puts the shorter segment into the right place. It leaves the
796 * longer segment in the right place overall, but it consists of two
797 * parts that need to be swapped next.
799 while (top > middle && middle > bottom) {
800 if (top - middle > middle - bottom) {
801 /* Bottom segment is the short one. */
802 int len = middle - bottom;
805 /* Swap it with the top part of the top segment. */
806 for (i = 0; i < len; i++) {
807 tem = argv[bottom + i];
809 argv[top - (middle - bottom) + i];
810 argv[top - (middle - bottom) + i] = tem;
812 /* Exclude the moved bottom segment from further swapping. */
815 /* Top segment is the short one. */
816 int len = top - middle;
819 /* Swap it with the bottom part of the bottom segment. */
820 for (i = 0; i < len; i++) {
821 tem = argv[bottom + i];
822 argv[bottom + i] = argv[middle + i];
823 argv[middle + i] = tem;
825 /* Exclude the moved top segment from further swapping. */
829 /* Update records for the slots the non-options now occupy. */
830 d->first_nonopt += (d->custom_optind - d->last_nonopt);
831 d->last_nonopt = d->custom_optind;
834 /* Initialize the internal data when the first call is made. */
835 static void custom_getopt_initialize(struct custom_getopt_data *d)
838 * Start processing options with ARGV-element 1 (since ARGV-element 0
839 * is the program name); the sequence of previously skipped non-option
840 * ARGV-elements is empty.
842 d->first_nonopt = d->last_nonopt = d->custom_optind;
847 #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
849 /* return: zero: continue, nonzero: return given value to user */
850 static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
851 struct custom_getopt_data *d)
854 * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
855 * moved back by the user (who may also have changed the arguments).
857 if (d->last_nonopt > d->custom_optind)
858 d->last_nonopt = d->custom_optind;
859 if (d->first_nonopt > d->custom_optind)
860 d->first_nonopt = d->custom_optind;
862 * If we have just processed some options following some
863 * non-options, exchange them so that the options come first.
865 if (d->first_nonopt != d->last_nonopt &&
866 d->last_nonopt != d->custom_optind)
867 exchange((char **) argv, d);
868 else if (d->last_nonopt != d->custom_optind)
869 d->first_nonopt = d->custom_optind;
871 * Skip any additional non-options and extend the range of
872 * non-options previously skipped.
874 while (d->custom_optind < argc && NONOPTION_P)
876 d->last_nonopt = d->custom_optind;
878 * The special ARGV-element `--' means premature end of options. Skip
879 * it like a null option, then exchange with previous non-options as if
880 * it were an option, then skip everything else like a non-option.
882 if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
884 if (d->first_nonopt != d->last_nonopt
885 && d->last_nonopt != d->custom_optind)
886 exchange((char **) argv, d);
887 else if (d->first_nonopt == d->last_nonopt)
888 d->first_nonopt = d->custom_optind;
889 d->last_nonopt = argc;
890 d->custom_optind = argc;
893 * If we have done all the ARGV-elements, stop the scan and back over
894 * any non-options that we skipped and permuted.
896 if (d->custom_optind == argc) {
898 * Set the next-arg-index to point at the non-options that we
899 * previously skipped, so the caller will digest them.
901 if (d->first_nonopt != d->last_nonopt)
902 d->custom_optind = d->first_nonopt;
906 * If we have come to a non-option and did not permute it, either stop
907 * the scan or describe it to the caller and pass it by.
910 d->custom_optarg = argv[d->custom_optind++];
914 * We have found another option-ARGV-element. Skip the initial
917 d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
922 * Check whether the ARGV-element is a long option.
924 * If there's a long option "fubar" and the ARGV-element is "-fu", consider
925 * that an abbreviation of the long option, just like "--fu", and not "-f" with
928 * This distinction seems to be the most useful approach.
931 static int check_long_opt(int argc, char *const *argv, const char *optstring,
932 const struct option *longopts, int *longind,
933 int print_errors, struct custom_getopt_data *d)
936 const struct option *p;
937 const struct option *pfound = NULL;
943 for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
946 /* Test all long options for either exact match or abbreviated matches */
947 for (p = longopts, option_index = 0; p->name; p++, option_index++)
948 if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
949 if ((unsigned int) (nameend - d->nextchar)
950 == (unsigned int) strlen(p->name)) {
951 /* Exact match found. */
953 indfound = option_index;
956 } else if (pfound == NULL) {
957 /* First nonexact match found. */
959 indfound = option_index;
960 } else if (pfound->has_arg != p->has_arg
961 || pfound->flag != p->flag
962 || pfound->val != p->val)
963 /* Second or later nonexact match found. */
966 if (ambig && !exact) {
969 "%s: option `%s' is ambiguous\n",
970 argv[0], argv[d->custom_optind]);
972 d->nextchar += strlen(d->nextchar);
974 d->custom_optopt = 0;
978 option_index = indfound;
981 if (pfound->has_arg != no_argument)
982 d->custom_optarg = nameend + 1;
985 if (argv[d->custom_optind - 1][1] == '-') {
987 fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
988 argv[0], pfound->name);
990 /* +option or -option */
991 fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
992 argv[0], argv[d->custom_optind - 1][0], pfound->name);
996 d->nextchar += strlen(d->nextchar);
997 d->custom_optopt = pfound->val;
1000 } else if (pfound->has_arg == required_argument) {
1001 if (d->custom_optind < argc)
1002 d->custom_optarg = argv[d->custom_optind++];
1006 "%s: option `%s' requires an argument\n",
1008 argv[d->custom_optind - 1]);
1010 d->nextchar += strlen(d->nextchar);
1011 d->custom_optopt = pfound->val;
1012 return optstring[0] == ':' ? ':' : '?';
1015 d->nextchar += strlen(d->nextchar);
1016 if (longind != NULL)
1017 *longind = option_index;
1019 *(pfound->flag) = pfound->val;
1025 * Can't find it as a long option. If this is not getopt_long_only, or
1026 * the option starts with '--' or is not a valid short option, then
1027 * it's an error. Otherwise interpret it as a short option.
1030 if (argv[d->custom_optind][1] == '-') {
1033 "%s: unrecognized option `--%s'\n",
1034 argv[0], d->nextchar);
1036 /* +option or -option */
1038 "%s: unrecognized option `%c%s'\n",
1039 argv[0], argv[d->custom_optind][0],
1043 d->nextchar = (char *) "";
1045 d->custom_optopt = 0;
1049 static int check_short_opt(int argc, char *const *argv, const char *optstring,
1050 int print_errors, struct custom_getopt_data *d)
1052 char c = *d->nextchar++;
1053 char *temp = strchr(optstring, c);
1055 /* Increment `custom_optind' when we start to process its last character. */
1056 if (*d->nextchar == '\0')
1058 if (!temp || c == ':') {
1060 fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
1062 d->custom_optopt = c;
1065 if (temp[1] == ':') {
1066 if (temp[2] == ':') {
1067 /* This is an option that accepts an argument optionally. */
1068 if (*d->nextchar != '\0') {
1069 d->custom_optarg = d->nextchar;
1072 d->custom_optarg = NULL;
1075 /* This is an option that requires an argument. */
1076 if (*d->nextchar != '\0') {
1077 d->custom_optarg = d->nextchar;
1079 * If we end this ARGV-element by taking the
1080 * rest as an arg, we must advance to the next
1084 } else if (d->custom_optind == argc) {
1087 "%s: option requires an argument -- %c\n",
1090 d->custom_optopt = c;
1091 if (optstring[0] == ':')
1097 * We already incremented `custom_optind' once;
1098 * increment it again when taking next ARGV-elt
1101 d->custom_optarg = argv[d->custom_optind++];
1109 * Scan elements of ARGV for option characters given in OPTSTRING.
1111 * If an element of ARGV starts with '-', and is not exactly "-" or "--",
1112 * then it is an option element. The characters of this element
1113 * (aside from the initial '-') are option characters. If `getopt'
1114 * is called repeatedly, it returns successively each of the option characters
1115 * from each of the option elements.
1117 * If `getopt' finds another option character, it returns that character,
1118 * updating `custom_optind' and `nextchar' so that the next call to `getopt' can
1119 * resume the scan with the following option character or ARGV-element.
1121 * If there are no more option characters, `getopt' returns -1.
1122 * Then `custom_optind' is the index in ARGV of the first ARGV-element
1123 * that is not an option. (The ARGV-elements have been permuted
1124 * so that those that are not options now come last.)
1126 * OPTSTRING is a string containing the legitimate option characters.
1127 * If an option character is seen that is not listed in OPTSTRING,
1128 * return '?' after printing an error message. If you set `custom_opterr' to
1129 * zero, the error message is suppressed but we still return '?'.
1131 * If a char in OPTSTRING is followed by a colon, that means it wants an arg,
1132 * so the following text in the same ARGV-element, or the text of the following
1133 * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that
1134 * wants an optional arg; if there is text in the current ARGV-element,
1135 * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero.
1137 * If OPTSTRING starts with `-' or `+', it requests different methods of
1138 * handling the non-option ARGV-elements.
1139 * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
1141 * Long-named options begin with `--' instead of `-'.
1142 * Their names may be abbreviated as long as the abbreviation is unique
1143 * or is an exact match for some defined option. If they have an
1144 * argument, it follows the option name in the same ARGV-element, separated
1145 * from the option name by a `=', or else the in next ARGV-element.
1146 * When `getopt' finds a long-named option, it returns 0 if that option's
1147 * `flag' field is nonzero, the value of the option's `val' field
1148 * if the `flag' field is zero.
1150 * The elements of ARGV aren't really const, because we permute them.
1151 * But we pretend they're const in the prototype to be compatible
1152 * with other systems.
1154 * LONGOPTS is a vector of `struct option' terminated by an
1155 * element containing a name which is zero.
1157 * LONGIND returns the index in LONGOPT of the long-named option found.
1158 * It is only valid when a long-named option has been found by the most
1161 * Return the option character from OPTS just read. Return -1 when there are
1162 * no more options. For unrecognized options, or options missing arguments,
1163 * `custom_optopt' is set to the option letter, and '?' is returned.
1165 * The OPTS string is a list of characters which are recognized option letters,
1166 * optionally followed by colons, specifying that that letter takes an
1167 * argument, to be placed in `custom_optarg'.
1169 * If a letter in OPTS is followed by two colons, its argument is optional.
1170 * This behavior is specific to the GNU `getopt'.
1172 * The argument `--' causes premature termination of argument scanning,
1173 * explicitly telling `getopt' that there are no more options. If OPTS begins
1174 * with `--', then non-option arguments are treated as arguments to the option
1175 * '\0'. This behavior is specific to the GNU `getopt'.
1178 static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
1179 const struct option *longopts, int *longind,
1180 struct custom_getopt_data *d)
1182 int ret, print_errors = d->custom_opterr;
1184 if (optstring[0] == ':')
1188 d->custom_optarg = NULL;
1191 * This is a big difference with GNU getopt, since optind == 0
1192 * means initialization while here 1 means first call.
1194 if (d->custom_optind == 0 || !d->initialized) {
1195 if (d->custom_optind == 0)
1196 d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
1197 custom_getopt_initialize(d);
1199 if (d->nextchar == NULL || *d->nextchar == '\0') {
1200 ret = shuffle_argv(argc, argv, longopts, d);
1204 if (longopts && (argv[d->custom_optind][1] == '-' ))
1205 return check_long_opt(argc, argv, optstring, longopts,
1206 longind, print_errors, d);
1207 return check_short_opt(argc, argv, optstring, print_errors, d);
1210 static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
1211 const struct option *longopts, int *longind)
1214 /* Keep a global copy of all internal members of d */
1215 static struct custom_getopt_data d;
1217 d.custom_optind = custom_optind;
1218 d.custom_opterr = custom_opterr;
1219 result = getopt_internal_r(argc, argv, optstring, longopts,
1221 custom_optind = d.custom_optind;
1222 custom_optarg = d.custom_optarg;
1223 custom_optopt = d.custom_optopt;
1227 static int custom_getopt_long (int argc, char *const *argv, const char *options,
1228 const struct option *long_options, int *opt_index)
1230 return custom_getopt_internal(argc, argv, options, long_options,
1235 static char *package_name = 0;
1238 * @brief updates an option
1239 * @param field the generic pointer to the field to update
1240 * @param orig_field the pointer to the orig field
1241 * @param field_given the pointer to the number of occurrence of this option
1242 * @param prev_given the pointer to the number of occurrence already seen
1243 * @param value the argument for this option (if null no arg was specified)
1244 * @param possible_values the possible values for this option (if specified)
1245 * @param default_value the default value (in case the option only accepts fixed values)
1246 * @param arg_type the type of this option
1247 * @param check_ambiguity @see cmdline_parser_clitkProfileImage_params.check_ambiguity
1248 * @param override @see cmdline_parser_clitkProfileImage_params.override
1249 * @param no_free whether to free a possible previous value
1250 * @param multiple_option whether this is a multiple option
1251 * @param long_opt the corresponding long option
1252 * @param short_opt the corresponding short option (or '-' if none)
1253 * @param additional_error possible further error specification
1256 int update_arg(void *field, char **orig_field,
1257 unsigned int *field_given, unsigned int *prev_given,
1258 char *value, char *possible_values[], const char *default_value,
1259 cmdline_parser_clitkProfileImage_arg_type arg_type,
1260 int check_ambiguity, int override,
1261 int no_free, int multiple_option,
1262 const char *long_opt, char short_opt,
1263 const char *additional_error)
1265 char *stop_char = 0;
1266 const char *val = value;
1268 char **string_field;
1273 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
1275 if (short_opt != '-')
1276 fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
1277 package_name, long_opt, short_opt,
1278 (additional_error ? additional_error : ""));
1280 fprintf (stderr, "%s: `--%s' option given more than once%s\n",
1281 package_name, long_opt,
1282 (additional_error ? additional_error : ""));
1283 return 1; /* failure */
1287 if (field_given && *field_given && ! override)
1293 if (possible_values)
1294 val = possible_values[found];
1298 *((int *)field) = !*((int *)field);
1301 if (val) *((double *)field) = strtod (val, &stop_char);
1305 string_field = (char **)field;
1306 if (!no_free && *string_field)
1307 free (*string_field); /* free previous string */
1308 *string_field = gengetopt_strdup (val);
1315 /* check numeric conversion */
1318 if (val && !(stop_char && *stop_char == '\0')) {
1319 fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
1320 return 1; /* failure */
1327 /* store the original value */
1333 if (value && orig_field) {
1335 *orig_field = value;
1338 free (*orig_field); /* free previous string */
1339 *orig_field = gengetopt_strdup (value);
1348 * @brief store information about a multiple option in a temporary list
1349 * @param list where to (temporarily) store multiple options
1352 int update_multiple_arg_temp(struct generic_list **list,
1353 unsigned int *prev_given, const char *val,
1354 char *possible_values[], const char *default_value,
1355 cmdline_parser_clitkProfileImage_arg_type arg_type,
1356 const char *long_opt, char short_opt,
1357 const char *additional_error)
1359 char *multi_token, *multi_next; /* store single arguments */
1361 if (arg_type == ARG_NO) {
1366 multi_token = get_multiple_arg_token(val);
1367 multi_next = get_multiple_arg_token_next (val);
1372 if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0,
1373 prev_given, multi_token, possible_values, default_value,
1374 arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) {
1375 if (multi_token) free(multi_token);
1376 return 1; /* failure */
1381 multi_token = get_multiple_arg_token(multi_next);
1382 multi_next = get_multiple_arg_token_next (multi_next);
1392 * @brief free the passed list (including possible string argument)
1395 void free_list(struct generic_list *list, short string_arg)
1398 struct generic_list *tmp;
1402 if (string_arg && list->arg.string_arg)
1403 free (list->arg.string_arg);
1413 * @brief updates a multiple option starting from the passed list
1416 void update_multiple_arg(void *field, char ***orig_field,
1417 unsigned int field_given, unsigned int prev_given, union generic_value *default_value,
1418 cmdline_parser_clitkProfileImage_arg_type arg_type,
1419 struct generic_list *list)
1422 struct generic_list *tmp;
1424 if (prev_given && list) {
1425 *orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *));
1429 *((double **)field) = (double *)realloc (*((double **)field), (field_given + prev_given) * sizeof (double)); break;
1431 *((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break;
1436 for (i = (prev_given - 1); i >= 0; --i)
1442 (*((double **)field))[i + field_given] = tmp->arg.double_arg; break;
1444 (*((char ***)field))[i + field_given] = tmp->arg.string_arg; break;
1448 (*orig_field) [i + field_given] = list->orig;
1452 } else { /* set the default value */
1453 if (default_value && ! field_given) {
1456 if (! *((double **)field)) {
1457 *((double **)field) = (double *)malloc (sizeof (double));
1458 (*((double **)field))[0] = default_value->double_arg;
1462 if (! *((char ***)field)) {
1463 *((char ***)field) = (char **)malloc (sizeof (char *));
1464 (*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg);
1469 if (!(*orig_field)) {
1470 *orig_field = (char **) malloc (sizeof (char *));
1471 (*orig_field)[0] = NULL;
1478 cmdline_parser_clitkProfileImage_internal (int argc, char * const *argv, struct args_info_clitkProfileImage *args_info,
1479 struct cmdline_parser_clitkProfileImage_params *params, const char *additional_error)
1481 int c; /* Character of the parsed option. */
1483 struct generic_list * point1_list = NULL;
1484 struct generic_list * point2_list = NULL;
1486 struct args_info_clitkProfileImage local_args_info;
1491 int check_ambiguity;
1493 package_name = argv[0];
1495 override = params->override;
1496 initialize = params->initialize;
1497 check_required = params->check_required;
1498 check_ambiguity = params->check_ambiguity;
1501 cmdline_parser_clitkProfileImage_init (args_info);
1503 cmdline_parser_clitkProfileImage_init (&local_args_info);
1507 opterr = params->print_errors;
1512 int option_index = 0;
1514 static struct option long_options[] = {
1515 { "help", 0, NULL, 'h' },
1516 { "version", 0, NULL, 'V' },
1517 { "config", 1, NULL, 0 },
1518 { "verbose", 0, NULL, 'v' },
1519 { "imagetypes", 0, NULL, 0 },
1520 { "input", 1, NULL, 'i' },
1521 { "output", 1, NULL, 'o' },
1522 { "point1", 1, NULL, 'f' },
1523 { "point2", 1, NULL, 's' },
1524 { NULL, 0, NULL, 0 }
1527 custom_optarg = optarg;
1528 custom_optind = optind;
1529 custom_opterr = opterr;
1530 custom_optopt = optopt;
1532 c = custom_getopt_long (argc, argv, "hVvi:o:f:s:", long_options, &option_index);
1534 optarg = custom_optarg;
1535 optind = custom_optind;
1536 opterr = custom_opterr;
1537 optopt = custom_optopt;
1539 if (c == -1) break; /* Exit from `while (1)' loop. */
1543 case 'h': /* Print help and exit. */
1544 cmdline_parser_clitkProfileImage_print_help ();
1545 cmdline_parser_clitkProfileImage_free (&local_args_info);
1546 exit (EXIT_SUCCESS);
1548 case 'V': /* Print version and exit. */
1549 cmdline_parser_clitkProfileImage_print_version ();
1550 cmdline_parser_clitkProfileImage_free (&local_args_info);
1551 exit (EXIT_SUCCESS);
1553 case 'v': /* Verbose. */
1556 if (update_arg((void *)&(args_info->verbose_flag), 0, &(args_info->verbose_given),
1557 &(local_args_info.verbose_given), optarg, 0, 0, ARG_FLAG,
1558 check_ambiguity, override, 1, 0, "verbose", 'v',
1563 case 'i': /* Input image filename. */
1566 if (update_arg( (void *)&(args_info->input_arg),
1567 &(args_info->input_orig), &(args_info->input_given),
1568 &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
1569 check_ambiguity, override, 0, 0,
1575 case 'o': /* Output texte filename. */
1578 if (update_arg( (void *)&(args_info->output_arg),
1579 &(args_info->output_orig), &(args_info->output_given),
1580 &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
1581 check_ambiguity, override, 0, 0,
1587 case 'f': /* First point (mm). */
1589 if (update_multiple_arg_temp(&point1_list,
1590 &(local_args_info.point1_given), optarg, 0, 0, ARG_DOUBLE,
1596 case 's': /* Second point (mm). */
1598 if (update_multiple_arg_temp(&point2_list,
1599 &(local_args_info.point2_given), optarg, 0, 0, ARG_DOUBLE,
1606 case 0: /* Long option with no short option */
1608 if (strcmp (long_options[option_index].name, "config") == 0)
1612 if (update_arg( (void *)&(args_info->config_arg),
1613 &(args_info->config_orig), &(args_info->config_given),
1614 &(local_args_info.config_given), optarg, 0, 0, ARG_STRING,
1615 check_ambiguity, override, 0, 0,
1621 /* Display allowed image types. */
1622 else if (strcmp (long_options[option_index].name, "imagetypes") == 0)
1626 if (update_arg((void *)&(args_info->imagetypes_flag), 0, &(args_info->imagetypes_given),
1627 &(local_args_info.imagetypes_given), optarg, 0, 0, ARG_FLAG,
1628 check_ambiguity, override, 1, 0, "imagetypes", '-',
1635 case '?': /* Invalid option. */
1636 /* `getopt_long' already printed an error message. */
1639 default: /* bug: option not considered. */
1640 fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, c, (additional_error ? additional_error : ""));
1646 update_multiple_arg((void *)&(args_info->point1_arg),
1647 &(args_info->point1_orig), args_info->point1_given,
1648 local_args_info.point1_given, 0 ,
1649 ARG_DOUBLE, point1_list);
1650 update_multiple_arg((void *)&(args_info->point2_arg),
1651 &(args_info->point2_orig), args_info->point2_given,
1652 local_args_info.point2_given, 0 ,
1653 ARG_DOUBLE, point2_list);
1655 args_info->point1_given += local_args_info.point1_given;
1656 local_args_info.point1_given = 0;
1657 args_info->point2_given += local_args_info.point2_given;
1658 local_args_info.point2_given = 0;
1662 error += cmdline_parser_clitkProfileImage_required2 (args_info, argv[0], additional_error);
1665 cmdline_parser_clitkProfileImage_release (&local_args_info);
1668 return (EXIT_FAILURE);
1673 int found_prog_name = 0;
1674 /* whether program name, i.e., argv[0], is in the remaining args
1675 (this may happen with some implementations of getopt,
1676 but surely not with the one included by gengetopt) */
1679 args_info->inputs_num = argc - optind - found_prog_name;
1681 (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1682 while (optind < argc)
1683 args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ;
1689 free_list (point1_list, 0 );
1690 free_list (point2_list, 0 );
1692 cmdline_parser_clitkProfileImage_release (&local_args_info);
1693 return (EXIT_FAILURE);
1696 #ifndef CONFIG_FILE_LINE_SIZE
1697 #define CONFIG_FILE_LINE_SIZE 2048
1699 #define ADDITIONAL_ERROR " in configuration file "
1701 #define CONFIG_FILE_LINE_BUFFER_SIZE (CONFIG_FILE_LINE_SIZE+3)
1702 /* 3 is for "--" and "=" */
1705 _cmdline_parser_clitkProfileImage_configfile (char * const filename, int *my_argc)
1708 char my_argv[CONFIG_FILE_LINE_BUFFER_SIZE+1];
1709 char linebuf[CONFIG_FILE_LINE_SIZE];
1711 int result = 0, equal;
1714 size_t len, next_token;
1717 if ((file = fopen(filename, "r")) == NULL)
1719 fprintf (stderr, "%s: Error opening configuration file '%s'\n",
1720 CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, filename);
1721 return EXIT_FAILURE;
1724 while ((fgets(linebuf, CONFIG_FILE_LINE_SIZE, file)) != NULL)
1728 len = strlen(linebuf);
1729 if (len > (CONFIG_FILE_LINE_BUFFER_SIZE-1))
1731 fprintf (stderr, "%s:%s:%d: Line too long in configuration file\n",
1732 CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, filename, line_num);
1733 result = EXIT_FAILURE;
1737 /* find first non-whitespace character in the line */
1738 next_token = strspn (linebuf, " \t\r\n");
1739 str_index = linebuf + next_token;
1741 if ( str_index[0] == '\0' || str_index[0] == '#')
1742 continue; /* empty line or comment line is skipped */
1746 /* truncate fopt at the end of the first non-valid character */
1747 next_token = strcspn (fopt, " \t\r\n=");
1749 if (fopt[next_token] == '\0') /* the line is over */
1756 /* remember if equal sign is present */
1757 equal = (fopt[next_token] == '=');
1758 fopt[next_token++] = '\0';
1760 /* advance pointers to the next token after the end of fopt */
1761 next_token += strspn (fopt + next_token, " \t\r\n");
1763 /* check for the presence of equal sign, and if so, skip it */
1765 if ((equal = (fopt[next_token] == '=')))
1768 next_token += strspn (fopt + next_token, " \t\r\n");
1770 str_index += next_token;
1774 if ( farg[0] == '\"' || farg[0] == '\'' )
1775 { /* quoted argument */
1776 str_index = strchr (++farg, str_index[0] ); /* skip opening quote */
1781 "%s:%s:%d: unterminated string in configuration file\n",
1782 CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, filename, line_num);
1783 result = EXIT_FAILURE;
1788 { /* read up the remaining part up to a delimiter */
1789 next_token = strcspn (farg, " \t\r\n#\'\"");
1790 str_index += next_token;
1793 /* truncate farg at the delimiter and store it for further check */
1794 delimiter = *str_index, *str_index++ = '\0';
1796 /* everything but comment is illegal at the end of line */
1797 if (delimiter != '\0' && delimiter != '#')
1799 str_index += strspn(str_index, " \t\r\n");
1800 if (*str_index != '\0' && *str_index != '#')
1804 "%s:%s:%d: malformed string in configuration file\n",
1805 CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, filename, line_num);
1806 result = EXIT_FAILURE;
1812 if (!strcmp(fopt,"include")) {
1813 if (farg && *farg) {
1814 result = _cmdline_parser_clitkProfileImage_configfile(farg, my_argc);
1816 fprintf(stderr, "%s:%s:%d: include requires a filename argument.\n",
1817 CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE, filename, line_num);
1822 strcat (my_argv, len > 1 ? "--" : "-");
1823 strcat (my_argv, fopt);
1824 if (len > 1 && ((farg && *farg) || equal))
1825 strcat (my_argv, "=");
1827 strcat (my_argv, farg);
1830 cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));
1831 cmd_line_list_tmp->next = cmd_line_list;
1832 cmd_line_list = cmd_line_list_tmp;
1833 cmd_line_list->string_arg = gengetopt_strdup(my_argv);
1842 cmdline_parser_clitkProfileImage_configfile (char * const filename,
1843 struct args_info_clitkProfileImage *args_info,
1844 int override, int initialize, int check_required)
1846 struct cmdline_parser_clitkProfileImage_params params;
1848 params.override = override;
1849 params.initialize = initialize;
1850 params.check_required = check_required;
1851 params.check_ambiguity = 0;
1852 params.print_errors = 1;
1854 return cmdline_parser_clitkProfileImage_config_file (filename, args_info, ¶ms);
1858 cmdline_parser_clitkProfileImage_config_file (char * const filename,
1859 struct args_info_clitkProfileImage *args_info,
1860 struct cmdline_parser_clitkProfileImage_params *params)
1865 char *additional_error;
1867 /* store the program name */
1868 cmd_line_list_tmp = (struct line_list *) malloc (sizeof (struct line_list));
1869 cmd_line_list_tmp->next = cmd_line_list;
1870 cmd_line_list = cmd_line_list_tmp;
1871 cmd_line_list->string_arg = gengetopt_strdup (CMDLINE_PARSER_CLITKPROFILEIMAGE_PACKAGE);
1873 result = _cmdline_parser_clitkProfileImage_configfile(filename, &my_argc);
1875 if (result != EXIT_FAILURE) {
1876 my_argv_arg = (char **) malloc((my_argc+1) * sizeof(char *));
1877 cmd_line_list_tmp = cmd_line_list;
1879 for (i = my_argc - 1; i >= 0; --i) {
1880 my_argv_arg[i] = cmd_line_list_tmp->string_arg;
1881 cmd_line_list_tmp = cmd_line_list_tmp->next;
1884 my_argv_arg[my_argc] = 0;
1886 additional_error = (char *)malloc(strlen(filename) + strlen(ADDITIONAL_ERROR) + 1);
1887 strcpy (additional_error, ADDITIONAL_ERROR);
1888 strcat (additional_error, filename);
1890 cmdline_parser_clitkProfileImage_internal (my_argc, my_argv_arg, args_info,
1894 free (additional_error);
1899 if (result == EXIT_FAILURE)
1901 cmdline_parser_clitkProfileImage_free (args_info);
1902 exit (EXIT_FAILURE);