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 | f828a15ab90e9ca8e848f83caf95c95f06be46e7 (patch) | |
tree | de25241f7ec727b05ff1e5b9e1336f567f788a44 /library/cpp/getopt | |
parent | 8124e2bb214b063687e0d77c900150c727e16782 (diff) | |
download | ydb-f828a15ab90e9ca8e848f83caf95c95f06be46e7.tar.gz |
Restoring authorship annotation for <iseg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/getopt')
-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 744501765c..40020680c2 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); } |