From: John L. <mov...@us...> - 2003-09-19 20:10:46
|
Update of /cvsroot/oprofile/oprofile/libopt++ In directory sc8-pr-cvs1:/tmp/cvs-serv3900/libopt++ Modified Files: popt_options.cpp popt_options.h Log Message: remove unused popt additional help Index: popt_options.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libopt++/popt_options.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -p -d -r1.15 -r1.16 --- popt_options.cpp 31 May 2003 16:06:44 -0000 1.15 +++ popt_options.cpp 19 Sep 2003 00:34:44 -0000 1.16 @@ -58,50 +58,11 @@ protected: static vector<poptOption> popt_options; static vector<option_base *> options_list; -/// user can specify and additional help string -static string user_help_str; - - -static void help_callback(poptContext con, enum poptCallbackReason reason, - struct poptOption const * opt, - char const *, void const *) -{ - if (reason != POPT_CALLBACK_REASON_OPTION) - return; - - if (!strcmp(opt->longName, "help")) { - poptPrintHelp(con, stdout, 0); - cout << user_help_str; - } else if (!strcmp(opt->longName, "usage")) { - poptPrintUsage(con, stdout, 0); - } else { - cerr << "popt_options.cpp: help_callback called called for " - << "unknown option: " << opt->longName << endl; - poptPrintHelp(con, stdout, 0); - exit(EXIT_FAILURE); - } - - exit(EXIT_SUCCESS); -} - - static int showvers; -// we need a separate table since, when a callback is specified, popt use this -// callback for all table entries and we don't want than top level table entry -// use the callback -static struct poptOption help_options[] = { - // C cast needed, pointer to function to void * - { 0, '\0', POPT_ARG_CALLBACK, (void*)help_callback, 0, 0, 0L, }, - { "help", '?', POPT_ARG_NONE, 0, 0, "Show this help message", 0L }, - { "usage", '\0', POPT_ARG_NONE, 0, 0, "Display brief usage message", 0L }, - POPT_TABLEEND -}; - - static struct poptOption appended_options[] = { { "version", 'v', POPT_ARG_NONE, &showvers, 0, "show version", NULL, }, - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, help_options, 0, "Help options:", 0 }, + POPT_AUTOHELP POPT_TABLEEND }; @@ -140,11 +101,8 @@ static poptContext do_parse_options(int void parse_options(int argc, char const ** argv, - vector<string> & additional_params, - string const & additional_help) + vector<string> & additional_params) { - user_help_str = additional_help; - vector<poptOption> options; poptContext con = Index: popt_options.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libopt++/popt_options.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -p -d -r1.16 -r1.17 --- popt_options.h 16 Sep 2003 21:17:10 -0000 1.16 +++ popt_options.h 19 Sep 2003 00:34:44 -0000 1.17 @@ -59,8 +59,6 @@ namespace popt { * @param argc like the parameter of main() * @param argv like the parameter of main() * @param additional_params additional options are stored here - * @param additional_help if user invoke --help this string is displayed - * after the automatic help displayed by popt lib * * Parse the given command line with the previous * options created. Multiple additional arguments @@ -68,8 +66,7 @@ namespace popt { * vector. */ void parse_options(int argc, char const ** argv, - std::vector<std::string> & additional_params, - std::string const & additional_help = std::string()); + std::vector<std::string> & additional_params); class option_base; |