diff options
author | qwerty <qwerty@yandex-team.ru> | 2022-02-10 16:49:24 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:24 +0300 |
commit | 34e37ee57f5837a8da2fdfaccaac9bbe6c7f02ba (patch) | |
tree | c9e2dc7251a6743c4352ec4a4c717b18a1bd4da7 /library/cpp/getopt/small/opt2.cpp | |
parent | 19bd45eb7775ffded0c62ab05d10b7326198aaa6 (diff) | |
download | ydb-34e37ee57f5837a8da2fdfaccaac9bbe6c7f02ba.tar.gz |
Restoring authorship annotation for <qwerty@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/getopt/small/opt2.cpp')
-rw-r--r-- | library/cpp/getopt/small/opt2.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp index 0cdc774e78..700dd452eb 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; |