diff options
author | iseg <iseg@yandex-team.ru> | 2022-02-10 16:49:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:39 +0300 |
commit | 8b71ce88bea710a9663bb143e4916f961c57212e (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/getopt/small/opt.cpp | |
parent | f828a15ab90e9ca8e848f83caf95c95f06be46e7 (diff) | |
download | ydb-8b71ce88bea710a9663bb143e4916f961c57212e.tar.gz |
Restoring authorship annotation for <iseg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt/small/opt.cpp')
-rw-r--r-- | library/cpp/getopt/small/opt.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/library/cpp/getopt/small/opt.cpp b/library/cpp/getopt/small/opt.cpp index 40020680c2a..744501765cb 100644 --- a/library/cpp/getopt/small/opt.cpp +++ b/library/cpp/getopt/small/opt.cpp @@ -3,9 +3,9 @@ #include <util/system/progname.h> #include <ctype.h> - + using namespace NLastGetopt; - + namespace { struct TOptsNoDefault: public TOpts { TOptsNoDefault(const TStringBuf& optstring = TStringBuf()) @@ -34,15 +34,15 @@ void Opt::Init(int argc, char* argv[], const char* optString, const Ion* longOpt } opt->HasArg_ = EHasArg(o->has_arg); opt->UserValue(o); - } + } Opts_->AllowSingleDashForLong_ = longOnly; Opts_->AllowPlusForLong_ = true; Opts_->AllowUnknownCharOptions_ = isOpen; Opts_->AllowUnknownLongOptions_ = false; - + OptsParser_.Reset(new TOptsParser(Opts_.Get(), argc, argv)); -} - +} + Opt::Opt(int argc, char* argv[], const char* optString, const Ion* longOptions, bool longOnly, bool isOpen) { Init(argc, argv, optString, longOptions, longOnly, isOpen); } @@ -65,7 +65,7 @@ int Opt::Get(int* longOptionIndex) { bool r = OptsParser_->Next(); Ind = (int)OptsParser_->Pos_; if (!r) { - return EOF; + return EOF; } else { Arg = (char*)OptsParser_->CurVal(); if (!OptsParser_->CurOpt()) { @@ -78,16 +78,16 @@ int Opt::Get(int* longOptionIndex) { } char c = OptsParser_->CurOpt()->GetCharOr0(); return c != 0 ? c : ion->val; - } - } + } + } } catch (const NLastGetopt::TException&) { GotError_ = true; if (Err) Cerr << CurrentExceptionMessage() << Endl; return '?'; - } -} - + } +} + void Opt::DummyHelp(IOutputStream& os) { Opts_->PrintUsage(GetProgramName(), os); } |