Add missing binaty and statis library
[jabaws.git] / binaries / src / ViennaRNA / Progs / RNAeval_cmdl.c
1 /*
2   File autogenerated by gengetopt version 2.22.5
3   generated with the following command:
4   gengetopt -i RNAeval.ggo --file-name=RNAeval_cmdl --include-getopt --default-optional --func-name=RNAeval_cmdline_parser --arg-struct-name=RNAeval_args_info
5
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.
9 */
10
11 /* If we use autoconf.  */
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19
20 #ifndef FIX_UNUSED
21 #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 #endif
23
24
25 #include "RNAeval_cmdl.h"
26
27 const char *RNAeval_args_info_purpose = "calculate energy of RNA sequences with given secondary structure";
28
29 const char *RNAeval_args_info_usage = "Usage: RNAeval [OPTIONS]...";
30
31 const char *RNAeval_args_info_description = "Evaluates the free energy of an RNA molecule in fixed secondary structure. \nSequences and structures are read alternately from stdin. The energy in \nKcal/Mol is written to stdout.\nThe program will continue to read new sequences and structures until a line \nconsisting of the single character \"@\" or an end of file condition is \nencountered.\nIf the input sequence or structure contains the separator character \"&\" the \nprogram calculates the energy of the co-folding of two RNA strands, where the \n\"&\" marks the boundary between the two strands.\n";
32
33 const char *RNAeval_args_info_detailed_help[] = {
34   "  -h, --help                 Print help and exit",
35   "      --detailed-help        Print help, including all details and hidden \n                               options, and exit",
36   "  -V, --version              Print version and exit",
37   "\nGeneral Options:",
38   "  Below are command line options which alter the general behavior of this \n  program\n",
39   "      --noconv               Do not automatically substitude nucleotide \"T\" \n                               with \"U\"\n\n                                 (default=off)",
40   "  -v, --verbose              Print out energy contribution of each loop in the \n                               structure.\n\n                                 (default=off)",
41   "\nModel Details:",
42   "  -T, --temp=DOUBLE          Rescale energy parameters to a temperature of temp \n                               C. Default is 37C.\n\n",
43   "  -4, --noTetra              Do not include special tabulated stabilizing \n                               energies for tri-, tetra- and hexaloop hairpins. \n                               Mostly for testing.\n\n                                 (default=off)",
44   "  -d, --dangles=INT          How to treat \"dangling end\" energies for bases \n                               adjacent to helices in free ends and multi-loops\n                                 (default=`2')",
45   "  \n  With -d1 only unpaired bases can participate in at most one dangling end, \n  this unsupported for the partition function folding.\n\n  With -d2 this check is ignored, dangling energies will be added for the bases \n  adjacent to a helix on both sides in any case; this is the default for \n  partition function folding (-p).\n  The option -d0 ignores dangling ends altogether (mostly for debugging).\n  With -d3 mfe folding will allow coaxial stacking of adjacent helices in \n  multi-loops. At the moment the implementation will not allow coaxial stacking \n  of the two interior pairs in a loop of degree 3.\n",
46   "  -e, --energyModel=INT      Rarely used option to fold sequences from the \n                               artificial ABCD... alphabet, where A pairs B, \n                               C-D etc.  Use the energy parameters for GC (-e \n                               1) or AU (-e 2) pairs.\n\n",
47   "  -P, --paramFile=paramfile  Read energy parameters from paramfile, instead of \n                               using the default parameter set.\n",
48   "  A sample parameter file should accompany your distribution.\n  See the RNAlib documentation for details on the file format.\n\n",
49   "  -c, --circ                 Assume a circular (instead of linear) RNA \n                               molecule.\n\n                                 (default=off)",
50   "  -g, --gquad                Incoorporate G-Quadruplex formation into the \n                               structure prediction algorithm\n                                 (default=off)",
51   "      --logML                Recalculate energies of structures using a \n                               logarithmic energy function for multi-loops \n                               before output.\n                                 (default=off)",
52   "  This option does not effect structure generation, only the energies that are \n  printed out. Since logML lowers energies somewhat, some structures may be \n  missing.\n\n",
53   "\nIf in doubt our program is right, nature is at fault.\nComments should be sent to rna@tbi.univie.ac.at.\n",
54     0
55 };
56
57 static void
58 init_help_array(void)
59 {
60   RNAeval_args_info_help[0] = RNAeval_args_info_detailed_help[0];
61   RNAeval_args_info_help[1] = RNAeval_args_info_detailed_help[1];
62   RNAeval_args_info_help[2] = RNAeval_args_info_detailed_help[2];
63   RNAeval_args_info_help[3] = RNAeval_args_info_detailed_help[3];
64   RNAeval_args_info_help[4] = RNAeval_args_info_detailed_help[4];
65   RNAeval_args_info_help[5] = RNAeval_args_info_detailed_help[5];
66   RNAeval_args_info_help[6] = RNAeval_args_info_detailed_help[6];
67   RNAeval_args_info_help[7] = RNAeval_args_info_detailed_help[7];
68   RNAeval_args_info_help[8] = RNAeval_args_info_detailed_help[8];
69   RNAeval_args_info_help[9] = RNAeval_args_info_detailed_help[9];
70   RNAeval_args_info_help[10] = RNAeval_args_info_detailed_help[10];
71   RNAeval_args_info_help[11] = RNAeval_args_info_detailed_help[12];
72   RNAeval_args_info_help[12] = RNAeval_args_info_detailed_help[13];
73   RNAeval_args_info_help[13] = RNAeval_args_info_detailed_help[15];
74   RNAeval_args_info_help[14] = RNAeval_args_info_detailed_help[16];
75   RNAeval_args_info_help[15] = RNAeval_args_info_detailed_help[17];
76   RNAeval_args_info_help[16] = RNAeval_args_info_detailed_help[19];
77   RNAeval_args_info_help[17] = 0; 
78   
79 }
80
81 const char *RNAeval_args_info_help[18];
82
83 typedef enum {ARG_NO
84   , ARG_FLAG
85   , ARG_STRING
86   , ARG_INT
87   , ARG_DOUBLE
88 } RNAeval_cmdline_parser_arg_type;
89
90 static
91 void clear_given (struct RNAeval_args_info *args_info);
92 static
93 void clear_args (struct RNAeval_args_info *args_info);
94
95 static int
96 RNAeval_cmdline_parser_internal (int argc, char **argv, struct RNAeval_args_info *args_info,
97                         struct RNAeval_cmdline_parser_params *params, const char *additional_error);
98
99
100 static char *
101 gengetopt_strdup (const char *s);
102
103 static
104 void clear_given (struct RNAeval_args_info *args_info)
105 {
106   args_info->help_given = 0 ;
107   args_info->detailed_help_given = 0 ;
108   args_info->version_given = 0 ;
109   args_info->noconv_given = 0 ;
110   args_info->verbose_given = 0 ;
111   args_info->temp_given = 0 ;
112   args_info->noTetra_given = 0 ;
113   args_info->dangles_given = 0 ;
114   args_info->energyModel_given = 0 ;
115   args_info->paramFile_given = 0 ;
116   args_info->circ_given = 0 ;
117   args_info->gquad_given = 0 ;
118   args_info->logML_given = 0 ;
119 }
120
121 static
122 void clear_args (struct RNAeval_args_info *args_info)
123 {
124   FIX_UNUSED (args_info);
125   args_info->noconv_flag = 0;
126   args_info->verbose_flag = 0;
127   args_info->temp_orig = NULL;
128   args_info->noTetra_flag = 0;
129   args_info->dangles_arg = 2;
130   args_info->dangles_orig = NULL;
131   args_info->energyModel_orig = NULL;
132   args_info->paramFile_arg = NULL;
133   args_info->paramFile_orig = NULL;
134   args_info->circ_flag = 0;
135   args_info->gquad_flag = 0;
136   args_info->logML_flag = 0;
137   
138 }
139
140 static
141 void init_args_info(struct RNAeval_args_info *args_info)
142 {
143
144   init_help_array(); 
145   args_info->help_help = RNAeval_args_info_detailed_help[0] ;
146   args_info->detailed_help_help = RNAeval_args_info_detailed_help[1] ;
147   args_info->version_help = RNAeval_args_info_detailed_help[2] ;
148   args_info->noconv_help = RNAeval_args_info_detailed_help[5] ;
149   args_info->verbose_help = RNAeval_args_info_detailed_help[6] ;
150   args_info->temp_help = RNAeval_args_info_detailed_help[8] ;
151   args_info->noTetra_help = RNAeval_args_info_detailed_help[9] ;
152   args_info->dangles_help = RNAeval_args_info_detailed_help[10] ;
153   args_info->energyModel_help = RNAeval_args_info_detailed_help[12] ;
154   args_info->paramFile_help = RNAeval_args_info_detailed_help[13] ;
155   args_info->circ_help = RNAeval_args_info_detailed_help[15] ;
156   args_info->gquad_help = RNAeval_args_info_detailed_help[16] ;
157   args_info->logML_help = RNAeval_args_info_detailed_help[17] ;
158   
159 }
160
161 void
162 RNAeval_cmdline_parser_print_version (void)
163 {
164   printf ("%s %s\n",
165      (strlen(RNAEVAL_CMDLINE_PARSER_PACKAGE_NAME) ? RNAEVAL_CMDLINE_PARSER_PACKAGE_NAME : RNAEVAL_CMDLINE_PARSER_PACKAGE),
166      RNAEVAL_CMDLINE_PARSER_VERSION);
167 }
168
169 static void print_help_common(void) {
170   RNAeval_cmdline_parser_print_version ();
171
172   if (strlen(RNAeval_args_info_purpose) > 0)
173     printf("\n%s\n", RNAeval_args_info_purpose);
174
175   if (strlen(RNAeval_args_info_usage) > 0)
176     printf("\n%s\n", RNAeval_args_info_usage);
177
178   printf("\n");
179
180   if (strlen(RNAeval_args_info_description) > 0)
181     printf("%s\n\n", RNAeval_args_info_description);
182 }
183
184 void
185 RNAeval_cmdline_parser_print_help (void)
186 {
187   int i = 0;
188   print_help_common();
189   while (RNAeval_args_info_help[i])
190     printf("%s\n", RNAeval_args_info_help[i++]);
191 }
192
193 void
194 RNAeval_cmdline_parser_print_detailed_help (void)
195 {
196   int i = 0;
197   print_help_common();
198   while (RNAeval_args_info_detailed_help[i])
199     printf("%s\n", RNAeval_args_info_detailed_help[i++]);
200 }
201
202 void
203 RNAeval_cmdline_parser_init (struct RNAeval_args_info *args_info)
204 {
205   clear_given (args_info);
206   clear_args (args_info);
207   init_args_info (args_info);
208 }
209
210 void
211 RNAeval_cmdline_parser_params_init(struct RNAeval_cmdline_parser_params *params)
212 {
213   if (params)
214     { 
215       params->override = 0;
216       params->initialize = 1;
217       params->check_required = 1;
218       params->check_ambiguity = 0;
219       params->print_errors = 1;
220     }
221 }
222
223 struct RNAeval_cmdline_parser_params *
224 RNAeval_cmdline_parser_params_create(void)
225 {
226   struct RNAeval_cmdline_parser_params *params = 
227     (struct RNAeval_cmdline_parser_params *)malloc(sizeof(struct RNAeval_cmdline_parser_params));
228   RNAeval_cmdline_parser_params_init(params);  
229   return params;
230 }
231
232 static void
233 free_string_field (char **s)
234 {
235   if (*s)
236     {
237       free (*s);
238       *s = 0;
239     }
240 }
241
242
243 static void
244 RNAeval_cmdline_parser_release (struct RNAeval_args_info *args_info)
245 {
246
247   free_string_field (&(args_info->temp_orig));
248   free_string_field (&(args_info->dangles_orig));
249   free_string_field (&(args_info->energyModel_orig));
250   free_string_field (&(args_info->paramFile_arg));
251   free_string_field (&(args_info->paramFile_orig));
252   
253   
254
255   clear_given (args_info);
256 }
257
258
259 static void
260 write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
261 {
262   FIX_UNUSED (values);
263   if (arg) {
264     fprintf(outfile, "%s=\"%s\"\n", opt, arg);
265   } else {
266     fprintf(outfile, "%s\n", opt);
267   }
268 }
269
270
271 int
272 RNAeval_cmdline_parser_dump(FILE *outfile, struct RNAeval_args_info *args_info)
273 {
274   int i = 0;
275
276   if (!outfile)
277     {
278       fprintf (stderr, "%s: cannot dump options to stream\n", RNAEVAL_CMDLINE_PARSER_PACKAGE);
279       return EXIT_FAILURE;
280     }
281
282   if (args_info->help_given)
283     write_into_file(outfile, "help", 0, 0 );
284   if (args_info->detailed_help_given)
285     write_into_file(outfile, "detailed-help", 0, 0 );
286   if (args_info->version_given)
287     write_into_file(outfile, "version", 0, 0 );
288   if (args_info->noconv_given)
289     write_into_file(outfile, "noconv", 0, 0 );
290   if (args_info->verbose_given)
291     write_into_file(outfile, "verbose", 0, 0 );
292   if (args_info->temp_given)
293     write_into_file(outfile, "temp", args_info->temp_orig, 0);
294   if (args_info->noTetra_given)
295     write_into_file(outfile, "noTetra", 0, 0 );
296   if (args_info->dangles_given)
297     write_into_file(outfile, "dangles", args_info->dangles_orig, 0);
298   if (args_info->energyModel_given)
299     write_into_file(outfile, "energyModel", args_info->energyModel_orig, 0);
300   if (args_info->paramFile_given)
301     write_into_file(outfile, "paramFile", args_info->paramFile_orig, 0);
302   if (args_info->circ_given)
303     write_into_file(outfile, "circ", 0, 0 );
304   if (args_info->gquad_given)
305     write_into_file(outfile, "gquad", 0, 0 );
306   if (args_info->logML_given)
307     write_into_file(outfile, "logML", 0, 0 );
308   
309
310   i = EXIT_SUCCESS;
311   return i;
312 }
313
314 int
315 RNAeval_cmdline_parser_file_save(const char *filename, struct RNAeval_args_info *args_info)
316 {
317   FILE *outfile;
318   int i = 0;
319
320   outfile = fopen(filename, "w");
321
322   if (!outfile)
323     {
324       fprintf (stderr, "%s: cannot open file for writing: %s\n", RNAEVAL_CMDLINE_PARSER_PACKAGE, filename);
325       return EXIT_FAILURE;
326     }
327
328   i = RNAeval_cmdline_parser_dump(outfile, args_info);
329   fclose (outfile);
330
331   return i;
332 }
333
334 void
335 RNAeval_cmdline_parser_free (struct RNAeval_args_info *args_info)
336 {
337   RNAeval_cmdline_parser_release (args_info);
338 }
339
340 /** @brief replacement of strdup, which is not standard */
341 char *
342 gengetopt_strdup (const char *s)
343 {
344   char *result = 0;
345   if (!s)
346     return result;
347
348   result = (char*)malloc(strlen(s) + 1);
349   if (result == (char*)0)
350     return (char*)0;
351   strcpy(result, s);
352   return result;
353 }
354
355 int
356 RNAeval_cmdline_parser (int argc, char **argv, struct RNAeval_args_info *args_info)
357 {
358   return RNAeval_cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
359 }
360
361 int
362 RNAeval_cmdline_parser_ext (int argc, char **argv, struct RNAeval_args_info *args_info,
363                    struct RNAeval_cmdline_parser_params *params)
364 {
365   int result;
366   result = RNAeval_cmdline_parser_internal (argc, argv, args_info, params, 0);
367
368   if (result == EXIT_FAILURE)
369     {
370       RNAeval_cmdline_parser_free (args_info);
371       exit (EXIT_FAILURE);
372     }
373   
374   return result;
375 }
376
377 int
378 RNAeval_cmdline_parser2 (int argc, char **argv, struct RNAeval_args_info *args_info, int override, int initialize, int check_required)
379 {
380   int result;
381   struct RNAeval_cmdline_parser_params params;
382   
383   params.override = override;
384   params.initialize = initialize;
385   params.check_required = check_required;
386   params.check_ambiguity = 0;
387   params.print_errors = 1;
388
389   result = RNAeval_cmdline_parser_internal (argc, argv, args_info, &params, 0);
390
391   if (result == EXIT_FAILURE)
392     {
393       RNAeval_cmdline_parser_free (args_info);
394       exit (EXIT_FAILURE);
395     }
396   
397   return result;
398 }
399
400 int
401 RNAeval_cmdline_parser_required (struct RNAeval_args_info *args_info, const char *prog_name)
402 {
403   FIX_UNUSED (args_info);
404   FIX_UNUSED (prog_name);
405   return EXIT_SUCCESS;
406 }
407
408 /*
409  * Extracted from the glibc source tree, version 2.3.6
410  *
411  * Licensed under the GPL as per the whole glibc source tree.
412  *
413  * This file was modified so that getopt_long can be called
414  * many times without risking previous memory to be spoiled.
415  *
416  * Modified by Andre Noll and Lorenzo Bettini for use in
417  * GNU gengetopt generated files.
418  *
419  */
420
421 /* 
422  * we must include anything we need since this file is not thought to be
423  * inserted in a file already using getopt.h
424  *
425  * Lorenzo
426  */
427
428 struct option
429 {
430   const char *name;
431   /* has_arg can't be an enum because some compilers complain about
432      type mismatches in all the code that assumes it is an int.  */
433   int has_arg;
434   int *flag;
435   int val;
436 };
437
438 /* This version of `getopt' appears to the caller like standard Unix `getopt'
439    but it behaves differently for the user, since it allows the user
440    to intersperse the options with the other arguments.
441
442    As `getopt' works, it permutes the elements of ARGV so that,
443    when it is done, all the options precede everything else.  Thus
444    all application programs are extended to handle flexible argument order.
445 */
446 /*
447    If the field `flag' is not NULL, it points to a variable that is set
448    to the value given in the field `val' when the option is found, but
449    left unchanged if the option is not found.
450
451    To have a long-named option do something other than set an `int' to
452    a compiled-in constant, such as set a value from `custom_optarg', set the
453    option's `flag' field to zero and its `val' field to a nonzero
454    value (the equivalent single-letter option character, if there is
455    one).  For long options that have a zero `flag' field, `getopt'
456    returns the contents of the `val' field.  */
457
458 /* Names for the values of the `has_arg' field of `struct option'.  */
459 #ifndef no_argument
460 #define no_argument             0
461 #endif
462
463 #ifndef required_argument
464 #define required_argument       1
465 #endif
466
467 #ifndef optional_argument
468 #define optional_argument       2
469 #endif
470
471 struct custom_getopt_data {
472         /*
473          * These have exactly the same meaning as the corresponding global variables,
474          * except that they are used for the reentrant versions of getopt.
475          */
476         int custom_optind;
477         int custom_opterr;
478         int custom_optopt;
479         char *custom_optarg;
480
481         /* True if the internal members have been initialized.  */
482         int initialized;
483
484         /*
485          * The next char to be scanned in the option-element in which the last option
486          * character we returned was found.  This allows us to pick up the scan where
487          * we left off.  If this is zero, or a null string, it means resume the scan by
488          * advancing to the next ARGV-element.
489          */
490         char *nextchar;
491
492         /*
493          * Describe the part of ARGV that contains non-options that have been skipped.
494          * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
495          * the index after the last of them.
496          */
497         int first_nonopt;
498         int last_nonopt;
499 };
500
501 /*
502  * the variables optarg, optind, opterr and optopt are renamed with
503  * the custom_ prefix so that they don't interfere with getopt ones.
504  *
505  * Moreover they're static so they are visible only from within the
506  * file where this very file will be included.
507  */
508
509 /*
510  * For communication from `custom_getopt' to the caller.  When `custom_getopt' finds an
511  * option that takes an argument, the argument value is returned here.
512  */
513 static char *custom_optarg;
514
515 /*
516  * Index in ARGV of the next element to be scanned.  This is used for
517  * communication to and from the caller and for communication between
518  * successive calls to `custom_getopt'.
519  *
520  * On entry to `custom_getopt', 1 means this is the first call; initialize.
521  *
522  * When `custom_getopt' returns -1, this is the index of the first of the non-option
523  * elements that the caller should itself scan.
524  *
525  * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV
526  * has been scanned so far.
527  *
528  * 1003.2 says this must be 1 before any call.
529  */
530 static int custom_optind = 1;
531
532 /*
533  * Callers store zero here to inhibit the error message for unrecognized
534  * options.
535  */
536 static int custom_opterr = 1;
537
538 /*
539  * Set to an option character which was unrecognized.  This must be initialized
540  * on some systems to avoid linking in the system's own getopt implementation.
541  */
542 static int custom_optopt = '?';
543
544 /*
545  * Exchange two adjacent subsequences of ARGV.  One subsequence is elements
546  * [first_nonopt,last_nonopt) which contains all the non-options that have been
547  * skipped so far.  The other is elements [last_nonopt,custom_optind), which contains
548  * all the options processed since those non-options were skipped.
549  * `first_nonopt' and `last_nonopt' are relocated so that they describe the new
550  * indices of the non-options in ARGV after they are moved.
551  */
552 static void exchange(char **argv, struct custom_getopt_data *d)
553 {
554         int bottom = d->first_nonopt;
555         int middle = d->last_nonopt;
556         int top = d->custom_optind;
557         char *tem;
558
559         /*
560          * Exchange the shorter segment with the far end of the longer segment.
561          * That puts the shorter segment into the right place.  It leaves the
562          * longer segment in the right place overall, but it consists of two
563          * parts that need to be swapped next.
564          */
565         while (top > middle && middle > bottom) {
566                 if (top - middle > middle - bottom) {
567                         /* Bottom segment is the short one.  */
568                         int len = middle - bottom;
569                         int i;
570
571                         /* Swap it with the top part of the top segment.  */
572                         for (i = 0; i < len; i++) {
573                                 tem = argv[bottom + i];
574                                 argv[bottom + i] =
575                                         argv[top - (middle - bottom) + i];
576                                 argv[top - (middle - bottom) + i] = tem;
577                         }
578                         /* Exclude the moved bottom segment from further swapping.  */
579                         top -= len;
580                 } else {
581                         /* Top segment is the short one.  */
582                         int len = top - middle;
583                         int i;
584
585                         /* Swap it with the bottom part of the bottom segment.  */
586                         for (i = 0; i < len; i++) {
587                                 tem = argv[bottom + i];
588                                 argv[bottom + i] = argv[middle + i];
589                                 argv[middle + i] = tem;
590                         }
591                         /* Exclude the moved top segment from further swapping.  */
592                         bottom += len;
593                 }
594         }
595         /* Update records for the slots the non-options now occupy.  */
596         d->first_nonopt += (d->custom_optind - d->last_nonopt);
597         d->last_nonopt = d->custom_optind;
598 }
599
600 /* Initialize the internal data when the first call is made.  */
601 static void custom_getopt_initialize(struct custom_getopt_data *d)
602 {
603         /*
604          * Start processing options with ARGV-element 1 (since ARGV-element 0
605          * is the program name); the sequence of previously skipped non-option
606          * ARGV-elements is empty.
607          */
608         d->first_nonopt = d->last_nonopt = d->custom_optind;
609         d->nextchar = NULL;
610         d->initialized = 1;
611 }
612
613 #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
614
615 /* return: zero: continue, nonzero: return given value to user */
616 static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
617         struct custom_getopt_data *d)
618 {
619         /*
620          * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
621          * moved back by the user (who may also have changed the arguments).
622          */
623         if (d->last_nonopt > d->custom_optind)
624                 d->last_nonopt = d->custom_optind;
625         if (d->first_nonopt > d->custom_optind)
626                 d->first_nonopt = d->custom_optind;
627         /*
628          * If we have just processed some options following some
629          * non-options, exchange them so that the options come first.
630          */
631         if (d->first_nonopt != d->last_nonopt &&
632                         d->last_nonopt != d->custom_optind)
633                 exchange((char **) argv, d);
634         else if (d->last_nonopt != d->custom_optind)
635                 d->first_nonopt = d->custom_optind;
636         /*
637          * Skip any additional non-options and extend the range of
638          * non-options previously skipped.
639          */
640         while (d->custom_optind < argc && NONOPTION_P)
641                 d->custom_optind++;
642         d->last_nonopt = d->custom_optind;
643         /*
644          * The special ARGV-element `--' means premature end of options.  Skip
645          * it like a null option, then exchange with previous non-options as if
646          * it were an option, then skip everything else like a non-option.
647          */
648         if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
649                 d->custom_optind++;
650                 if (d->first_nonopt != d->last_nonopt
651                                 && d->last_nonopt != d->custom_optind)
652                         exchange((char **) argv, d);
653                 else if (d->first_nonopt == d->last_nonopt)
654                         d->first_nonopt = d->custom_optind;
655                 d->last_nonopt = argc;
656                 d->custom_optind = argc;
657         }
658         /*
659          * If we have done all the ARGV-elements, stop the scan and back over
660          * any non-options that we skipped and permuted.
661          */
662         if (d->custom_optind == argc) {
663                 /*
664                  * Set the next-arg-index to point at the non-options that we
665                  * previously skipped, so the caller will digest them.
666                  */
667                 if (d->first_nonopt != d->last_nonopt)
668                         d->custom_optind = d->first_nonopt;
669                 return -1;
670         }
671         /*
672          * If we have come to a non-option and did not permute it, either stop
673          * the scan or describe it to the caller and pass it by.
674          */
675         if (NONOPTION_P) {
676                 d->custom_optarg = argv[d->custom_optind++];
677                 return 1;
678         }
679         /*
680          * We have found another option-ARGV-element. Skip the initial
681          * punctuation.
682          */
683         d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
684         return 0;
685 }
686
687 /*
688  * Check whether the ARGV-element is a long option.
689  *
690  * If there's a long option "fubar" and the ARGV-element is "-fu", consider
691  * that an abbreviation of the long option, just like "--fu", and not "-f" with
692  * arg "u".
693  *
694  * This distinction seems to be the most useful approach.
695  *
696  */
697 static int check_long_opt(int argc, char *const *argv, const char *optstring,
698                 const struct option *longopts, int *longind,
699                 int print_errors, struct custom_getopt_data *d)
700 {
701         char *nameend;
702         const struct option *p;
703         const struct option *pfound = NULL;
704         int exact = 0;
705         int ambig = 0;
706         int indfound = -1;
707         int option_index;
708
709         for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
710                 /* Do nothing.  */ ;
711
712         /* Test all long options for either exact match or abbreviated matches */
713         for (p = longopts, option_index = 0; p->name; p++, option_index++)
714                 if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
715                         if ((unsigned int) (nameend - d->nextchar)
716                                         == (unsigned int) strlen(p->name)) {
717                                 /* Exact match found.  */
718                                 pfound = p;
719                                 indfound = option_index;
720                                 exact = 1;
721                                 break;
722                         } else if (pfound == NULL) {
723                                 /* First nonexact match found.  */
724                                 pfound = p;
725                                 indfound = option_index;
726                         } else if (pfound->has_arg != p->has_arg
727                                         || pfound->flag != p->flag
728                                         || pfound->val != p->val)
729                                 /* Second or later nonexact match found.  */
730                                 ambig = 1;
731                 }
732         if (ambig && !exact) {
733                 if (print_errors) {
734                         fprintf(stderr,
735                                 "%s: option `%s' is ambiguous\n",
736                                 argv[0], argv[d->custom_optind]);
737                 }
738                 d->nextchar += strlen(d->nextchar);
739                 d->custom_optind++;
740                 d->custom_optopt = 0;
741                 return '?';
742         }
743         if (pfound) {
744                 option_index = indfound;
745                 d->custom_optind++;
746                 if (*nameend) {
747                         if (pfound->has_arg != no_argument)
748                                 d->custom_optarg = nameend + 1;
749                         else {
750                                 if (print_errors) {
751                                         if (argv[d->custom_optind - 1][1] == '-') {
752                                                 /* --option */
753                                                 fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
754                                                         argv[0], pfound->name);
755                                         } else {
756                                                 /* +option or -option */
757                                                 fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
758                                                         argv[0], argv[d->custom_optind - 1][0], pfound->name);
759                                         }
760
761                                 }
762                                 d->nextchar += strlen(d->nextchar);
763                                 d->custom_optopt = pfound->val;
764                                 return '?';
765                         }
766                 } else if (pfound->has_arg == required_argument) {
767                         if (d->custom_optind < argc)
768                                 d->custom_optarg = argv[d->custom_optind++];
769                         else {
770                                 if (print_errors) {
771                                         fprintf(stderr,
772                                                 "%s: option `%s' requires an argument\n",
773                                                 argv[0],
774                                                 argv[d->custom_optind - 1]);
775                                 }
776                                 d->nextchar += strlen(d->nextchar);
777                                 d->custom_optopt = pfound->val;
778                                 return optstring[0] == ':' ? ':' : '?';
779                         }
780                 }
781                 d->nextchar += strlen(d->nextchar);
782                 if (longind != NULL)
783                         *longind = option_index;
784                 if (pfound->flag) {
785                         *(pfound->flag) = pfound->val;
786                         return 0;
787                 }
788                 return pfound->val;
789         }
790         /*
791          * Can't find it as a long option.  If this is not getopt_long_only, or
792          * the option starts with '--' or is not a valid short option, then
793          * it's an error.  Otherwise interpret it as a short option.
794          */
795         if (print_errors) {
796                 if (argv[d->custom_optind][1] == '-') {
797                         /* --option */
798                         fprintf(stderr,
799                                 "%s: unrecognized option `--%s'\n",
800                                 argv[0], d->nextchar);
801                 } else {
802                         /* +option or -option */
803                         fprintf(stderr,
804                                 "%s: unrecognized option `%c%s'\n",
805                                 argv[0], argv[d->custom_optind][0],
806                                 d->nextchar);
807                 }
808         }
809         d->nextchar = (char *) "";
810         d->custom_optind++;
811         d->custom_optopt = 0;
812         return '?';
813 }
814
815 static int check_short_opt(int argc, char *const *argv, const char *optstring,
816                 int print_errors, struct custom_getopt_data *d)
817 {
818         char c = *d->nextchar++;
819         const char *temp = strchr(optstring, c);
820
821         /* Increment `custom_optind' when we start to process its last character.  */
822         if (*d->nextchar == '\0')
823                 ++d->custom_optind;
824         if (!temp || c == ':') {
825                 if (print_errors)
826                         fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
827
828                 d->custom_optopt = c;
829                 return '?';
830         }
831         if (temp[1] == ':') {
832                 if (temp[2] == ':') {
833                         /* This is an option that accepts an argument optionally.  */
834                         if (*d->nextchar != '\0') {
835                                 d->custom_optarg = d->nextchar;
836                                 d->custom_optind++;
837                         } else
838                                 d->custom_optarg = NULL;
839                         d->nextchar = NULL;
840                 } else {
841                         /* This is an option that requires an argument.  */
842                         if (*d->nextchar != '\0') {
843                                 d->custom_optarg = d->nextchar;
844                                 /*
845                                  * If we end this ARGV-element by taking the
846                                  * rest as an arg, we must advance to the next
847                                  * element now.
848                                  */
849                                 d->custom_optind++;
850                         } else if (d->custom_optind == argc) {
851                                 if (print_errors) {
852                                         fprintf(stderr,
853                                                 "%s: option requires an argument -- %c\n",
854                                                 argv[0], c);
855                                 }
856                                 d->custom_optopt = c;
857                                 if (optstring[0] == ':')
858                                         c = ':';
859                                 else
860                                         c = '?';
861                         } else
862                                 /*
863                                  * We already incremented `custom_optind' once;
864                                  * increment it again when taking next ARGV-elt
865                                  * as argument.
866                                  */
867                                 d->custom_optarg = argv[d->custom_optind++];
868                         d->nextchar = NULL;
869                 }
870         }
871         return c;
872 }
873
874 /*
875  * Scan elements of ARGV for option characters given in OPTSTRING.
876  *
877  * If an element of ARGV starts with '-', and is not exactly "-" or "--",
878  * then it is an option element.  The characters of this element
879  * (aside from the initial '-') are option characters.  If `getopt'
880  * is called repeatedly, it returns successively each of the option characters
881  * from each of the option elements.
882  *
883  * If `getopt' finds another option character, it returns that character,
884  * updating `custom_optind' and `nextchar' so that the next call to `getopt' can
885  * resume the scan with the following option character or ARGV-element.
886  *
887  * If there are no more option characters, `getopt' returns -1.
888  * Then `custom_optind' is the index in ARGV of the first ARGV-element
889  * that is not an option.  (The ARGV-elements have been permuted
890  * so that those that are not options now come last.)
891  *
892  * OPTSTRING is a string containing the legitimate option characters.
893  * If an option character is seen that is not listed in OPTSTRING,
894  * return '?' after printing an error message.  If you set `custom_opterr' to
895  * zero, the error message is suppressed but we still return '?'.
896  *
897  * If a char in OPTSTRING is followed by a colon, that means it wants an arg,
898  * so the following text in the same ARGV-element, or the text of the following
899  * ARGV-element, is returned in `custom_optarg'.  Two colons mean an option that
900  * wants an optional arg; if there is text in the current ARGV-element,
901  * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero.
902  *
903  * If OPTSTRING starts with `-' or `+', it requests different methods of
904  * handling the non-option ARGV-elements.
905  * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
906  *
907  * Long-named options begin with `--' instead of `-'.
908  * Their names may be abbreviated as long as the abbreviation is unique
909  * or is an exact match for some defined option.  If they have an
910  * argument, it follows the option name in the same ARGV-element, separated
911  * from the option name by a `=', or else the in next ARGV-element.
912  * When `getopt' finds a long-named option, it returns 0 if that option's
913  * `flag' field is nonzero, the value of the option's `val' field
914  * if the `flag' field is zero.
915  *
916  * The elements of ARGV aren't really const, because we permute them.
917  * But we pretend they're const in the prototype to be compatible
918  * with other systems.
919  *
920  * LONGOPTS is a vector of `struct option' terminated by an
921  * element containing a name which is zero.
922  *
923  * LONGIND returns the index in LONGOPT of the long-named option found.
924  * It is only valid when a long-named option has been found by the most
925  * recent call.
926  *
927  * Return the option character from OPTS just read.  Return -1 when there are
928  * no more options.  For unrecognized options, or options missing arguments,
929  * `custom_optopt' is set to the option letter, and '?' is returned.
930  *
931  * The OPTS string is a list of characters which are recognized option letters,
932  * optionally followed by colons, specifying that that letter takes an
933  * argument, to be placed in `custom_optarg'.
934  *
935  * If a letter in OPTS is followed by two colons, its argument is optional.
936  * This behavior is specific to the GNU `getopt'.
937  *
938  * The argument `--' causes premature termination of argument scanning,
939  * explicitly telling `getopt' that there are no more options.  If OPTS begins
940  * with `--', then non-option arguments are treated as arguments to the option
941  * '\0'.  This behavior is specific to the GNU `getopt'.
942  */
943
944 static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
945                 const struct option *longopts, int *longind,
946                 struct custom_getopt_data *d)
947 {
948         int ret, print_errors = d->custom_opterr;
949
950         if (optstring[0] == ':')
951                 print_errors = 0;
952         if (argc < 1)
953                 return -1;
954         d->custom_optarg = NULL;
955
956         /* 
957          * This is a big difference with GNU getopt, since optind == 0
958          * means initialization while here 1 means first call.
959          */
960         if (d->custom_optind == 0 || !d->initialized) {
961                 if (d->custom_optind == 0)
962                         d->custom_optind = 1;   /* Don't scan ARGV[0], the program name.  */
963                 custom_getopt_initialize(d);
964         }
965         if (d->nextchar == NULL || *d->nextchar == '\0') {
966                 ret = shuffle_argv(argc, argv, longopts, d);
967                 if (ret)
968                         return ret;
969         }
970         if (longopts && (argv[d->custom_optind][1] == '-' ))
971                 return check_long_opt(argc, argv, optstring, longopts,
972                         longind, print_errors, d);
973         return check_short_opt(argc, argv, optstring, print_errors, d);
974 }
975
976 static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
977         const struct option *longopts, int *longind)
978 {
979         int result;
980         /* Keep a global copy of all internal members of d */
981         static struct custom_getopt_data d;
982
983         d.custom_optind = custom_optind;
984         d.custom_opterr = custom_opterr;
985         result = getopt_internal_r(argc, argv, optstring, longopts,
986                 longind, &d);
987         custom_optind = d.custom_optind;
988         custom_optarg = d.custom_optarg;
989         custom_optopt = d.custom_optopt;
990         return result;
991 }
992
993 static int custom_getopt_long (int argc, char *const *argv, const char *options,
994         const struct option *long_options, int *opt_index)
995 {
996         return custom_getopt_internal(argc, argv, options, long_options,
997                 opt_index);
998 }
999
1000
1001 static char *package_name = 0;
1002
1003 /**
1004  * @brief updates an option
1005  * @param field the generic pointer to the field to update
1006  * @param orig_field the pointer to the orig field
1007  * @param field_given the pointer to the number of occurrence of this option
1008  * @param prev_given the pointer to the number of occurrence already seen
1009  * @param value the argument for this option (if null no arg was specified)
1010  * @param possible_values the possible values for this option (if specified)
1011  * @param default_value the default value (in case the option only accepts fixed values)
1012  * @param arg_type the type of this option
1013  * @param check_ambiguity @see RNAeval_cmdline_parser_params.check_ambiguity
1014  * @param override @see RNAeval_cmdline_parser_params.override
1015  * @param no_free whether to free a possible previous value
1016  * @param multiple_option whether this is a multiple option
1017  * @param long_opt the corresponding long option
1018  * @param short_opt the corresponding short option (or '-' if none)
1019  * @param additional_error possible further error specification
1020  */
1021 static
1022 int update_arg(void *field, char **orig_field,
1023                unsigned int *field_given, unsigned int *prev_given, 
1024                char *value, const char *possible_values[],
1025                const char *default_value,
1026                RNAeval_cmdline_parser_arg_type arg_type,
1027                int check_ambiguity, int override,
1028                int no_free, int multiple_option,
1029                const char *long_opt, char short_opt,
1030                const char *additional_error)
1031 {
1032   char *stop_char = 0;
1033   const char *val = value;
1034   int found;
1035   char **string_field;
1036   FIX_UNUSED (field);
1037
1038   stop_char = 0;
1039   found = 0;
1040
1041   if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
1042     {
1043       if (short_opt != '-')
1044         fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", 
1045                package_name, long_opt, short_opt,
1046                (additional_error ? additional_error : ""));
1047       else
1048         fprintf (stderr, "%s: `--%s' option given more than once%s\n", 
1049                package_name, long_opt,
1050                (additional_error ? additional_error : ""));
1051       return 1; /* failure */
1052     }
1053
1054   FIX_UNUSED (default_value);
1055     
1056   if (field_given && *field_given && ! override)
1057     return 0;
1058   if (prev_given)
1059     (*prev_given)++;
1060   if (field_given)
1061     (*field_given)++;
1062   if (possible_values)
1063     val = possible_values[found];
1064
1065   switch(arg_type) {
1066   case ARG_FLAG:
1067     *((int *)field) = !*((int *)field);
1068     break;
1069   case ARG_INT:
1070     if (val) *((int *)field) = strtol (val, &stop_char, 0);
1071     break;
1072   case ARG_DOUBLE:
1073     if (val) *((double *)field) = strtod (val, &stop_char);
1074     break;
1075   case ARG_STRING:
1076     if (val) {
1077       string_field = (char **)field;
1078       if (!no_free && *string_field)
1079         free (*string_field); /* free previous string */
1080       *string_field = gengetopt_strdup (val);
1081     }
1082     break;
1083   default:
1084     break;
1085   };
1086
1087   /* check numeric conversion */
1088   switch(arg_type) {
1089   case ARG_INT:
1090   case ARG_DOUBLE:
1091     if (val && !(stop_char && *stop_char == '\0')) {
1092       fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
1093       return 1; /* failure */
1094     }
1095     break;
1096   default:
1097     ;
1098   };
1099
1100   /* store the original value */
1101   switch(arg_type) {
1102   case ARG_NO:
1103   case ARG_FLAG:
1104     break;
1105   default:
1106     if (value && orig_field) {
1107       if (no_free) {
1108         *orig_field = value;
1109       } else {
1110         if (*orig_field)
1111           free (*orig_field); /* free previous string */
1112         *orig_field = gengetopt_strdup (value);
1113       }
1114     }
1115   };
1116
1117   return 0; /* OK */
1118 }
1119
1120
1121 int
1122 RNAeval_cmdline_parser_internal (
1123   int argc, char **argv, struct RNAeval_args_info *args_info,
1124                         struct RNAeval_cmdline_parser_params *params, const char *additional_error)
1125 {
1126   int c;        /* Character of the parsed option.  */
1127
1128   int error = 0;
1129   struct RNAeval_args_info local_args_info;
1130   
1131   int override;
1132   int initialize;
1133   int check_required;
1134   int check_ambiguity;
1135
1136   char *optarg;
1137   int optind;
1138   int opterr;
1139   int optopt;
1140   
1141   package_name = argv[0];
1142   
1143   override = params->override;
1144   initialize = params->initialize;
1145   check_required = params->check_required;
1146   check_ambiguity = params->check_ambiguity;
1147
1148   if (initialize)
1149     RNAeval_cmdline_parser_init (args_info);
1150
1151   RNAeval_cmdline_parser_init (&local_args_info);
1152
1153   optarg = 0;
1154   optind = 0;
1155   opterr = params->print_errors;
1156   optopt = '?';
1157
1158   while (1)
1159     {
1160       int option_index = 0;
1161
1162       static struct option long_options[] = {
1163         { "help",       0, NULL, 'h' },
1164         { "detailed-help",      0, NULL, 0 },
1165         { "version",    0, NULL, 'V' },
1166         { "noconv",     0, NULL, 0 },
1167         { "verbose",    0, NULL, 'v' },
1168         { "temp",       1, NULL, 'T' },
1169         { "noTetra",    0, NULL, '4' },
1170         { "dangles",    1, NULL, 'd' },
1171         { "energyModel",        1, NULL, 'e' },
1172         { "paramFile",  1, NULL, 'P' },
1173         { "circ",       0, NULL, 'c' },
1174         { "gquad",      0, NULL, 'g' },
1175         { "logML",      0, NULL, 0 },
1176         { 0,  0, 0, 0 }
1177       };
1178
1179       custom_optarg = optarg;
1180       custom_optind = optind;
1181       custom_opterr = opterr;
1182       custom_optopt = optopt;
1183
1184       c = custom_getopt_long (argc, argv, "hVvT:4d:e:P:cg", long_options, &option_index);
1185
1186       optarg = custom_optarg;
1187       optind = custom_optind;
1188       opterr = custom_opterr;
1189       optopt = custom_optopt;
1190
1191       if (c == -1) break;       /* Exit from `while (1)' loop.  */
1192
1193       switch (c)
1194         {
1195         case 'h':       /* Print help and exit.  */
1196           RNAeval_cmdline_parser_print_help ();
1197           RNAeval_cmdline_parser_free (&local_args_info);
1198           exit (EXIT_SUCCESS);
1199
1200         case 'V':       /* Print version and exit.  */
1201           RNAeval_cmdline_parser_print_version ();
1202           RNAeval_cmdline_parser_free (&local_args_info);
1203           exit (EXIT_SUCCESS);
1204
1205         case 'v':       /* Print out energy contribution of each loop in the structure.
1206         
1207 .  */
1208         
1209         
1210           if (update_arg((void *)&(args_info->verbose_flag), 0, &(args_info->verbose_given),
1211               &(local_args_info.verbose_given), optarg, 0, 0, ARG_FLAG,
1212               check_ambiguity, override, 1, 0, "verbose", 'v',
1213               additional_error))
1214             goto failure;
1215         
1216           break;
1217         case 'T':       /* Rescale energy parameters to a temperature of temp C. Default is 37C.
1218         
1219 .  */
1220         
1221         
1222           if (update_arg( (void *)&(args_info->temp_arg), 
1223                &(args_info->temp_orig), &(args_info->temp_given),
1224               &(local_args_info.temp_given), optarg, 0, 0, ARG_DOUBLE,
1225               check_ambiguity, override, 0, 0,
1226               "temp", 'T',
1227               additional_error))
1228             goto failure;
1229         
1230           break;
1231         case '4':       /* Do not include special tabulated stabilizing energies for tri-, tetra- and hexaloop hairpins. Mostly for testing.
1232         
1233 .  */
1234         
1235         
1236           if (update_arg((void *)&(args_info->noTetra_flag), 0, &(args_info->noTetra_given),
1237               &(local_args_info.noTetra_given), optarg, 0, 0, ARG_FLAG,
1238               check_ambiguity, override, 1, 0, "noTetra", '4',
1239               additional_error))
1240             goto failure;
1241         
1242           break;
1243         case 'd':       /* How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops
1244 .  */
1245         
1246         
1247           if (update_arg( (void *)&(args_info->dangles_arg), 
1248                &(args_info->dangles_orig), &(args_info->dangles_given),
1249               &(local_args_info.dangles_given), optarg, 0, "2", ARG_INT,
1250               check_ambiguity, override, 0, 0,
1251               "dangles", 'd',
1252               additional_error))
1253             goto failure;
1254         
1255           break;
1256         case 'e':       /* Rarely used option to fold sequences from the artificial ABCD... alphabet, where A pairs B, C-D etc.  Use the energy parameters for GC (-e 1) or AU (-e 2) pairs.
1257         
1258 .  */
1259         
1260         
1261           if (update_arg( (void *)&(args_info->energyModel_arg), 
1262                &(args_info->energyModel_orig), &(args_info->energyModel_given),
1263               &(local_args_info.energyModel_given), optarg, 0, 0, ARG_INT,
1264               check_ambiguity, override, 0, 0,
1265               "energyModel", 'e',
1266               additional_error))
1267             goto failure;
1268         
1269           break;
1270         case 'P':       /* Read energy parameters from paramfile, instead of using the default parameter set.
1271 .  */
1272         
1273         
1274           if (update_arg( (void *)&(args_info->paramFile_arg), 
1275                &(args_info->paramFile_orig), &(args_info->paramFile_given),
1276               &(local_args_info.paramFile_given), optarg, 0, 0, ARG_STRING,
1277               check_ambiguity, override, 0, 0,
1278               "paramFile", 'P',
1279               additional_error))
1280             goto failure;
1281         
1282           break;
1283         case 'c':       /* Assume a circular (instead of linear) RNA molecule.
1284         
1285 .  */
1286         
1287         
1288           if (update_arg((void *)&(args_info->circ_flag), 0, &(args_info->circ_given),
1289               &(local_args_info.circ_given), optarg, 0, 0, ARG_FLAG,
1290               check_ambiguity, override, 1, 0, "circ", 'c',
1291               additional_error))
1292             goto failure;
1293         
1294           break;
1295         case 'g':       /* Incoorporate G-Quadruplex formation into the structure prediction algorithm
1296 .  */
1297         
1298         
1299           if (update_arg((void *)&(args_info->gquad_flag), 0, &(args_info->gquad_given),
1300               &(local_args_info.gquad_given), optarg, 0, 0, ARG_FLAG,
1301               check_ambiguity, override, 1, 0, "gquad", 'g',
1302               additional_error))
1303             goto failure;
1304         
1305           break;
1306
1307         case 0: /* Long option with no short option */
1308           if (strcmp (long_options[option_index].name, "detailed-help") == 0) {
1309             RNAeval_cmdline_parser_print_detailed_help ();
1310             RNAeval_cmdline_parser_free (&local_args_info);
1311             exit (EXIT_SUCCESS);
1312           }
1313
1314           /* Do not automatically substitude nucleotide \"T\" with \"U\"
1315           
1316 .  */
1317           if (strcmp (long_options[option_index].name, "noconv") == 0)
1318           {
1319           
1320           
1321             if (update_arg((void *)&(args_info->noconv_flag), 0, &(args_info->noconv_given),
1322                 &(local_args_info.noconv_given), optarg, 0, 0, ARG_FLAG,
1323                 check_ambiguity, override, 1, 0, "noconv", '-',
1324                 additional_error))
1325               goto failure;
1326           
1327           }
1328           /* Recalculate energies of structures using a logarithmic energy function for multi-loops before output.
1329 .  */
1330           else if (strcmp (long_options[option_index].name, "logML") == 0)
1331           {
1332           
1333           
1334             if (update_arg((void *)&(args_info->logML_flag), 0, &(args_info->logML_given),
1335                 &(local_args_info.logML_given), optarg, 0, 0, ARG_FLAG,
1336                 check_ambiguity, override, 1, 0, "logML", '-',
1337                 additional_error))
1338               goto failure;
1339           
1340           }
1341           
1342           break;
1343         case '?':       /* Invalid option.  */
1344           /* `getopt_long' already printed an error message.  */
1345           goto failure;
1346
1347         default:        /* bug: option not considered.  */
1348           fprintf (stderr, "%s: option unknown: %c%s\n", RNAEVAL_CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
1349           abort ();
1350         } /* switch */
1351     } /* while */
1352
1353
1354
1355
1356   RNAeval_cmdline_parser_release (&local_args_info);
1357
1358   if ( error )
1359     return (EXIT_FAILURE);
1360
1361   return 0;
1362
1363 failure:
1364   
1365   RNAeval_cmdline_parser_release (&local_args_info);
1366   return (EXIT_FAILURE);
1367 }