diff options
author | Håvard Pettersen <havardpe@oath.com> | 2022-03-31 11:44:10 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2022-04-01 10:24:32 +0000 |
commit | d71f76a73fe54558f613e75a3a8cfd70fc46a7e8 (patch) | |
tree | 7d170e5b792dbf5fed06ff7c7b2db398b6cb64c7 /fastos | |
parent | 1bb3dd192f4bcb91e710fe19ca54b2b8935ffb83 (diff) |
use getopt/getopt_long directly
Diffstat (limited to 'fastos')
-rw-r--r-- | fastos/src/vespa/fastos/unix_app.cpp | 25 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_app.h | 37 |
2 files changed, 0 insertions, 62 deletions
diff --git a/fastos/src/vespa/fastos/unix_app.cpp b/fastos/src/vespa/fastos/unix_app.cpp index 6b1ff743506..733b8806fb5 100644 --- a/fastos/src/vespa/fastos/unix_app.cpp +++ b/fastos/src/vespa/fastos/unix_app.cpp @@ -22,31 +22,6 @@ extern "C" extern char **environ; }; -int -FastOS_UNIX_Application::GetOpt (const char *optionsString, const char* &optionArgument, int &optionIndex) -{ - int rc = getopt(_argc, _argv, optionsString); - optionArgument = optarg; - optionIndex = optind; - return rc; -} - -int -FastOS_UNIX_Application::GetOptLong(const char *optionsString, const char* &optionArgument, int &optionIndex, - const struct option *longopts,int *longindex) -{ - int rc = getopt_long(_argc, _argv, optionsString, longopts, longindex); - optionArgument = optarg; - optionIndex = optind; - return rc; -} - -void -FastOS_UNIX_Application::resetOptIndex(int optionIndex) -{ - optind = optionIndex; -} - bool FastOS_UNIX_Application::PreThreadInit () { bool rc = true; diff --git a/fastos/src/vespa/fastos/unix_app.h b/fastos/src/vespa/fastos/unix_app.h index beb494b4fea..0f11356614e 100644 --- a/fastos/src/vespa/fastos/unix_app.h +++ b/fastos/src/vespa/fastos/unix_app.h @@ -24,43 +24,6 @@ public: FastOS_UNIX_Application(const FastOS_UNIX_Application&) = delete; FastOS_UNIX_Application& operator=(const FastOS_UNIX_Application&) = delete; virtual ~FastOS_UNIX_Application(); - - /** - * Parse program arguments. @ref GetOpt() incrementally parses the - * command line argument list and returns the next known option - * character. An option character is known if it has been - * specified in the string of accepted option characters, - * [optionsString]. - * - * The option string [optionsString] may contain the following - * elements: individual characters, and characters followed by a - * colon to indicate an option argument is to follow. For example, - * an option string "x" recognizes an option ``-x'', and an option - * string "x:" recognizes an option and argument ``-x argument''. - * It does not matter to @ref GetOpt() if a following argument has - * leading white space. - * - * @ref GetOpt() returns -1 when the argument list is exhausted, or - * `?' if a non-recognized option is encountered. The - * interpretation of options in the argument list may be canceled - * by the option `--' (double dash) which causes getopt() to signal - * the end of argument processing and return -1. When all options - * have been processed (i.e., up to the first non-option argument), - * getopt() returns -1. - * - * @ref GetOpt() should only be run by a single thread at the same - * time. In order to evaluate the argument list multiple times, the - * previous GetOpt loop must be finished (-1 returned). - */ - int GetOpt (const char *optionsString, const char* &optionArgument, int &optionIndex); - - int GetOptLong(const char *optionsString, const char* &optionArgument, int &optionIndex, - const struct option *longopts, int *longindex); - /** - * Called before calling GetOpt() or GetOptLong() by sub-applications. - */ - static void resetOptIndex(int OptionIndex); - bool Init () override; void Cleanup () override; }; |