📄 cmdline_add_alphabet.c
字号:
/* File autogenerated by gengetopt version 2.12.2 generated with the following command: /home/ae/hakanv/gengetopt/bin/gengetopt --file-name=cmdline_add_alphabet The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it.*//* If we use autoconf. */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <stdio.h>#include <stdlib.h>#include <string.h>#include "getopt.h"#include "cmdline_add_alphabet.h"staticvoid clear_given (struct gengetopt_args_info *args_info);staticvoid clear_args (struct gengetopt_args_info *args_info);static intcmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error);static char *gengetopt_strdup (const char *s);staticvoid clear_given (struct gengetopt_args_info *args_info){ args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->hmminfile_given = 0 ; args_info->outfile_given = 0 ; args_info->alphafile_given = 0 ; args_info->verbose_given = 0 ;}staticvoid clear_args (struct gengetopt_args_info *args_info){ args_info->hmminfile_arg = NULL; args_info->outfile_arg = NULL; args_info->alphafile_arg = NULL; args_info->verbose_flag = 0;}voidcmdline_parser_print_version (void){ printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);}voidcmdline_parser_print_help (void){ cmdline_parser_print_version (); printf("\n" "Purpose:\n"" add alphabet with predefined emission probabilities to a given model file\n" "\n" "Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); printf("\n"); printf("%s\n"," -h, --help Print help and exit"); printf("%s\n"," -V, --version Print version and exit"); printf("%s\n"," -i, --hmminfile=filename modelfile (in .hmg format)"); printf("%s\n"," -o, --outfile=filename model outfile"); printf("%s\n"," -a, --alphafile=filename alphabet file"); printf("%s\n"," -v, --verbose print some information about what is going on \n (default=off)");}voidcmdline_parser_init (struct gengetopt_args_info *args_info){ clear_given (args_info); clear_args (args_info);}voidcmdline_parser_free (struct gengetopt_args_info *args_info){ if (args_info->hmminfile_arg) { free (args_info->hmminfile_arg); /* free previous argument */ args_info->hmminfile_arg = 0; } if (args_info->outfile_arg) { free (args_info->outfile_arg); /* free previous argument */ args_info->outfile_arg = 0; } if (args_info->alphafile_arg) { free (args_info->alphafile_arg); /* free previous argument */ args_info->alphafile_arg = 0; } clear_given (args_info);}/* gengetopt_strdup() *//* strdup.c replacement of strdup, which is not standard */char *gengetopt_strdup (const char *s){ char *result = NULL; if (!s) return result; result = (char*)malloc(strlen(s) + 1); if (result == (char*)0) return (char*)0; strcpy(result, s); return result;}intcmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info){ return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);}intcmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required){ int result; result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); if (result == EXIT_FAILURE) { cmdline_parser_free (args_info); exit (EXIT_FAILURE); } return result;}intcmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error){ int c; /* Character of the parsed option. */ int error = 0; struct gengetopt_args_info local_args_info; if (initialize) cmdline_parser_init (args_info); cmdline_parser_init (&local_args_info); optarg = 0; optind = 1; opterr = 1; optopt = '?'; while (1) { int option_index = 0; char *stop_char; static struct option long_options[] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "hmminfile", 1, NULL, 'i' }, { "outfile", 1, NULL, 'o' }, { "alphafile", 1, NULL, 'a' }, { "verbose", 0, NULL, 'v' }, { NULL, 0, NULL, 0 } }; stop_char = 0; c = getopt_long (argc, argv, "hVi:o:a:v", long_options, &option_index); if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) { case 'h': /* Print help and exit. */ cmdline_parser_print_help (); exit (EXIT_SUCCESS); case 'V': /* Print version and exit. */ cmdline_parser_print_version (); exit (EXIT_SUCCESS); case 'i': /* modelfile (in .hmg format). */ if (local_args_info.hmminfile_given) { fprintf (stderr, "%s: `--hmminfile' (`-i') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); goto failure; } if (args_info->hmminfile_given && ! override) continue; local_args_info.hmminfile_given = 1; args_info->hmminfile_given = 1; if (args_info->hmminfile_arg) free (args_info->hmminfile_arg); /* free previous string */ args_info->hmminfile_arg = gengetopt_strdup (optarg); break; case 'o': /* model outfile. */ if (local_args_info.outfile_given) { fprintf (stderr, "%s: `--outfile' (`-o') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); goto failure; } if (args_info->outfile_given && ! override) continue; local_args_info.outfile_given = 1; args_info->outfile_given = 1; if (args_info->outfile_arg) free (args_info->outfile_arg); /* free previous string */ args_info->outfile_arg = gengetopt_strdup (optarg); break; case 'a': /* alphabet file. */ if (local_args_info.alphafile_given) { fprintf (stderr, "%s: `--alphafile' (`-a') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); goto failure; } if (args_info->alphafile_given && ! override) continue; local_args_info.alphafile_given = 1; args_info->alphafile_given = 1; if (args_info->alphafile_arg) free (args_info->alphafile_arg); /* free previous string */ args_info->alphafile_arg = gengetopt_strdup (optarg); break; case 'v': /* print some information about what is going on. */ if (local_args_info.verbose_given) { fprintf (stderr, "%s: `--verbose' (`-v') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); goto failure; } if (args_info->verbose_given && ! override) continue; local_args_info.verbose_given = 1; args_info->verbose_given = 1; args_info->verbose_flag = !(args_info->verbose_flag); break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ /* `getopt_long' already printed an error message. */ goto failure; default: /* bug: option not considered. */ fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); abort (); } /* switch */ } /* while */ if (check_required) { if (! args_info->hmminfile_given) { fprintf (stderr, "%s: '--hmminfile' ('-i') option required%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); error = 1; } if (! args_info->outfile_given) { fprintf (stderr, "%s: '--outfile' ('-o') option required%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); error = 1; } if (! args_info->alphafile_given) { fprintf (stderr, "%s: '--alphafile' ('-a') option required%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); error = 1; } } if ( error ) return (EXIT_FAILURE); return 0;failure: return (EXIT_FAILURE);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -