diff --git a/bsa/tests/bsatool.cpp b/bsa/tests/bsatool.cpp index 3c2e0f103..a804c58fe 100644 --- a/bsa/tests/bsatool.cpp +++ b/bsa/tests/bsatool.cpp @@ -3,6 +3,7 @@ #include "bsatool_cmd.h" #include +#include #include #include @@ -73,7 +74,17 @@ int main(int argc, char** argv) // List all files const BSAFile::FileList &files = bsa.getList(); for(int i=0; ihelp_given = 0 ; args_info->version_given = 0 ; args_info->extract_given = 0 ; + args_info->long_given = 0 ; } static @@ -75,6 +77,7 @@ void init_args_info(struct gengetopt_args_info *args_info) args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->extract_help = gengetopt_args_info_help[2] ; + args_info->long_help = gengetopt_args_info_help[3] ; } @@ -198,6 +201,8 @@ cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) write_into_file(outfile, "version", 0, 0 ); if (args_info->extract_given) write_into_file(outfile, "extract", args_info->extract_orig, 0); + if (args_info->long_given) + write_into_file(outfile, "long", 0, 0 ); i = EXIT_SUCCESS; @@ -1054,6 +1059,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, { "extract", 1, NULL, 'x' }, + { "long", 0, NULL, 'l' }, { NULL, 0, NULL, 0 } }; @@ -1062,7 +1068,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf custom_opterr = opterr; custom_optopt = optopt; - c = custom_getopt_long (argc, argv, "hVx:", long_options, &option_index); + c = custom_getopt_long (argc, argv, "hVx:l", long_options, &option_index); optarg = custom_optarg; optind = custom_optind; @@ -1095,6 +1101,18 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf goto failure; break; + case 'l': /* Include extra information in archive listing. */ + + + if (update_arg( 0 , + 0 , &(args_info->long_given), + &(local_args_info.long_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "long", 'l', + additional_error)) + goto failure; + + break; case 0: /* Long option with no short option */ case '?': /* Invalid option. */ diff --git a/bsa/tests/bsatool_cmd.h b/bsa/tests/bsatool_cmd.h index 5496978fc..0158bc371 100644 --- a/bsa/tests/bsatool_cmd.h +++ b/bsa/tests/bsatool_cmd.h @@ -37,10 +37,12 @@ struct gengetopt_args_info char * extract_arg; /**< @brief Extract file from archive. */ char * extract_orig; /**< @brief Extract file from archive original value given at command line. */ const char *extract_help; /**< @brief Extract file from archive help description. */ + const char *long_help; /**< @brief Include extra information in archive listing help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int extract_given ; /**< @brief Whether extract was given. */ + unsigned int long_given ; /**< @brief Whether long was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */