diff options
author | qwerty <qwerty@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
commit | ca6b8a0150d5ee4cc8fb804d1285d9c32fb4fe88 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/getopt/small | |
parent | 34e37ee57f5837a8da2fdfaccaac9bbe6c7f02ba (diff) | |
download | ydb-ca6b8a0150d5ee4cc8fb804d1285d9c32fb4fe88.tar.gz |
Restoring authorship annotation for <qwerty@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/small')
-rw-r--r-- | library/cpp/getopt/small/modchooser.cpp | 2 | ||||
-rw-r--r-- | library/cpp/getopt/small/modchooser.h | 2 | ||||
-rw-r--r-- | library/cpp/getopt/small/opt2.cpp | 20 | ||||
-rw-r--r-- | library/cpp/getopt/small/opt2.h | 8 |
4 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 762cdf8702..2fa5cfd070 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -67,7 +67,7 @@ TModChooser::TMode::TMode(const TString& name, TMainClass* main, const TString& , Hidden(hidden) , NoCompletion(noCompletion) { -} +} TModChooser::TModChooser() : ModesHelpOption("-?") // Default help option in last_getopt diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 0d7f5e36fa..0a8de6d50b 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -34,7 +34,7 @@ public: typedef void (*TVersionHandlerPtr)(); /*! Main class for handling different modes in single tool. - * + * * You can add modes for this class, use autogenerated help with * list of modes and automaticly call necessary mode in run(). * diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp index 700dd452eb..0cdc774e78 100644 --- a/library/cpp/getopt/small/opt2.cpp +++ b/library/cpp/getopt/small/opt2.cpp @@ -231,23 +231,23 @@ long Opt2::Int(char opt, const char* help, long def, bool required) { return rv; } -// Get() + strtoul, may set up HasErrors +// Get() + strtoul, may set up HasErrors unsigned long Opt2::UInt(char opt, const char* help, unsigned long def, bool required) { Opt2Param& p = GetInternal(opt, (char*)(uintptr_t)def, help, required); - if (!p.HasArg) + if (!p.HasArg) ythrow yexception() << "Opt2::UInt called for '" << opt << "' which is an option without argument"; - p.IsNumeric = true; + p.IsNumeric = true; if (!p.IsFound || p.ActualValue.empty() || !p.ActualValue.back()) - return def; + return def; char* e; unsigned long rv = strtoul(p.ActualValue.back(), &e, 10); if (e == p.ActualValue.back() || *e) { - OptionWrongArg = opt; - HasErrors = true; - } - return rv; -} - + OptionWrongArg = opt; + HasErrors = true; + } + return rv; +} + // Add user defined error message and set error flag void Opt2::AddError(const char* message) { HasErrors = true; diff --git a/library/cpp/getopt/small/opt2.h b/library/cpp/getopt/small/opt2.h index fded5d1961..4d9d943237 100644 --- a/library/cpp/getopt/small/opt2.h +++ b/library/cpp/getopt/small/opt2.h @@ -98,12 +98,12 @@ public: return Int(opt, helpUsage, 0, true); } - // Get() + strtoul, may set up HasErrors + // Get() + strtoul, may set up HasErrors unsigned long UInt(char opt, const char* helpUsage, unsigned long defValue, bool required = false); unsigned long UInt(char opt, const char* helpUsage) { - return UInt(opt, helpUsage, 0, true); - } - + return UInt(opt, helpUsage, 0, true); + } + // For options w/o parameters bool Has(char opt, const char* helpUsage); |