aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/getopt
diff options
context:
space:
mode:
authoragorodilov <agorodilov@yandex-team.ru>2022-02-10 16:47:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:09 +0300
commitbd5ef432f5cfb1e18851381329d94665a4c22470 (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/getopt
parent7a4979e6211c3e78c7f9041d4a9e5d3405343c36 (diff)
downloadydb-bd5ef432f5cfb1e18851381329d94665a4c22470.tar.gz
Restoring authorship annotation for <agorodilov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/getopt')
-rw-r--r--library/cpp/getopt/small/last_getopt.h4
-rw-r--r--library/cpp/getopt/small/last_getopt_parser.cpp2
-rw-r--r--library/cpp/getopt/small/modchooser.cpp4
-rw-r--r--library/cpp/getopt/small/modchooser.h6
-rw-r--r--library/cpp/getopt/small/opt.cpp6
-rw-r--r--library/cpp/getopt/small/opt.h6
-rw-r--r--library/cpp/getopt/small/opt2.cpp4
-rw-r--r--library/cpp/getopt/small/opt2.h4
-rw-r--r--library/cpp/getopt/small/posix_getopt.cpp8
-rw-r--r--library/cpp/getopt/small/ygetopt.cpp4
-rw-r--r--library/cpp/getopt/ut/posix_getopt_ut.cpp26
-rw-r--r--library/cpp/getopt/ut/ygetopt_ut.cpp2
12 files changed, 38 insertions, 38 deletions
diff --git a/library/cpp/getopt/small/last_getopt.h b/library/cpp/getopt/small/last_getopt.h
index 916cbf3818..07687bc914 100644
--- a/library/cpp/getopt/small/last_getopt.h
+++ b/library/cpp/getopt/small/last_getopt.h
@@ -30,7 +30,7 @@ namespace NLastGetopt {
{
}
- void HandleOpt(const TOptsParser* parser) override {
+ void HandleOpt(const TOptsParser* parser) override {
const TStringBuf curval(parser->CurValOrDef());
if (curval.IsInited()) {
StringSplitter(curval).Split(ElementsDelim).Consume([&](const TStringBuf& val) {
@@ -68,7 +68,7 @@ namespace NLastGetopt {
{
}
- void HandleOpt(const TOptsParser* parser) override {
+ void HandleOpt(const TOptsParser* parser) override {
const TStringBuf curval(parser->CurValOrDef());
if (curval.IsInited()) {
StringSplitter(curval).Split(Delim).Consume([&](const TStringBuf& val) {
diff --git a/library/cpp/getopt/small/last_getopt_parser.cpp b/library/cpp/getopt/small/last_getopt_parser.cpp
index 1fccbcaf60..7668b12a03 100644
--- a/library/cpp/getopt/small/last_getopt_parser.cpp
+++ b/library/cpp/getopt/small/last_getopt_parser.cpp
@@ -182,7 +182,7 @@ namespace NLastGetopt {
if (!arg.StartsWith('-') || opt->GetHasArg() == REQUIRED_ARGUMENT) {
return Commit(opt, arg, pos + 1, 0);
}
- return Commit(opt, nullptr, pos, 0);
+ return Commit(opt, nullptr, pos, 0);
}
TOptsParser::EIsOpt TOptsParser::IsOpt(const TStringBuf& arg) const {
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp
index f4919a24f0..2fa5cfd070 100644
--- a/library/cpp/getopt/small/modchooser.cpp
+++ b/library/cpp/getopt/small/modchooser.cpp
@@ -71,14 +71,14 @@ TModChooser::TMode::TMode(const TString& name, TMainClass* main, const TString&
TModChooser::TModChooser()
: ModesHelpOption("-?") // Default help option in last_getopt
- , VersionHandler(nullptr)
+ , VersionHandler(nullptr)
, ShowSeparated(true)
, SvnRevisionOptionDisabled(false)
, PrintShortCommandInUsage(false)
{
}
-TModChooser::~TModChooser() = default;
+TModChooser::~TModChooser() = default;
void TModChooser::AddMode(const TString& mode, const TMainFunctionRawPtr func, const TString& description, bool hidden, bool noCompletion) {
AddMode(mode, TMainFunctionPtr(func), description, hidden, noCompletion);
diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h
index 7a2a2d6f61..0a8de6d50b 100644
--- a/library/cpp/getopt/small/modchooser.h
+++ b/library/cpp/getopt/small/modchooser.h
@@ -20,14 +20,14 @@ using TMainFunctionRawPtr = int (*)(const int argc, const char** argv);
class TMainClassV {
public:
virtual int operator()(const TVector<TString>& argv) = 0;
- virtual ~TMainClassV() = default;
+ virtual ~TMainClassV() = default;
};
//! Mode class with classic argc and argv arguments.
class TMainClass {
public:
virtual int operator()(int argc, const char** argv) = 0;
- virtual ~TMainClass() = default;
+ virtual ~TMainClass() = default;
};
//! Function to handle '--version' parameter
@@ -111,7 +111,7 @@ public:
TVector<TString> Aliases;
TMode()
- : Main(nullptr)
+ : Main(nullptr)
{
}
diff --git a/library/cpp/getopt/small/opt.cpp b/library/cpp/getopt/small/opt.cpp
index d6bb60ea38..744501765c 100644
--- a/library/cpp/getopt/small/opt.cpp
+++ b/library/cpp/getopt/small/opt.cpp
@@ -23,7 +23,7 @@ void Opt::Init(int argc, char* argv[], const char* optString, const Ion* longOpt
Ind = argc;
Opts_.Reset(new TOptsNoDefault(optString));
- for (const Ion* o = longOptions; o != nullptr && o->name != nullptr; ++o) {
+ for (const Ion* o = longOptions; o != nullptr && o->name != nullptr; ++o) {
TOpt* opt;
if ((unsigned)o->val < 0x80 && isalnum(o->val)) {
opt = &Opts_->CharOption(char(o->val));
@@ -52,14 +52,14 @@ Opt::Opt(int argc, const char* argv[], const char* optString, const Ion* longOpt
}
int Opt::Get() {
- return Get(nullptr);
+ return Get(nullptr);
}
int Opt::Get(int* longOptionIndex) {
if (GotError_)
return EOF;
- Arg = nullptr;
+ Arg = nullptr;
try {
bool r = OptsParser_->Next();
diff --git a/library/cpp/getopt/small/opt.h b/library/cpp/getopt/small/opt.h
index 0bc624e8c4..ecb57439bc 100644
--- a/library/cpp/getopt/small/opt.h
+++ b/library/cpp/getopt/small/opt.h
@@ -76,11 +76,11 @@ private:
const Ion* Ions_;
bool GotError_;
- void Init(int argc, char* argv[], const char* optString, const Ion* longOptions = nullptr, bool longOnly = false, bool isOpen = false);
+ void Init(int argc, char* argv[], const char* optString, const Ion* longOptions = nullptr, bool longOnly = false, bool isOpen = false);
public:
- Opt(int argc, char* argv[], const char* optString, const Ion* longOptions = nullptr, bool longOnly = false, bool isOpen = false);
- Opt(int argc, const char* argv[], const char* optString, const Ion* longOptions = nullptr, bool longOnly = false, bool isOpen = false);
+ Opt(int argc, char* argv[], const char* optString, const Ion* longOptions = nullptr, bool longOnly = false, bool isOpen = false);
+ Opt(int argc, const char* argv[], const char* optString, const Ion* longOptions = nullptr, bool longOnly = false, bool isOpen = false);
// Get() means next
int Get();
diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp
index 2af0f89648..0cdc774e78 100644
--- a/library/cpp/getopt/small/opt2.cpp
+++ b/library/cpp/getopt/small/opt2.cpp
@@ -20,7 +20,7 @@ void Opt2::Init(int argc, char* const* argv, const char* optspec, IntRange free_
Argc = argc;
Argv = argv;
HasErrors = false, BadPosCount = false, UnknownOption = 0, OptionMissingArg = 0;
- UnknownLongOption = nullptr;
+ UnknownLongOption = nullptr;
OptionWrongArg = 0, RequiredOptionMissing = 0;
EatArgv(optspec, long_alias);
MinArgs = Min<int>(free_args_num.Left, free_args_num.Right);
@@ -292,7 +292,7 @@ int Opt2::AutoUsage(const char* free_arg_names) {
if (UnknownLongOption) {
fprintf(where, " *** Unknown long option '%s'\n", UnknownLongOption);
free(UnknownLongOption);
- UnknownLongOption = nullptr;
+ UnknownLongOption = nullptr;
}
if (RequiredOptionMissing)
fprintf(where, " *** Required option '%c' missing\n", RequiredOptionMissing);
diff --git a/library/cpp/getopt/small/opt2.h b/library/cpp/getopt/small/opt2.h
index 8d03ce4e5b..4d9d943237 100644
--- a/library/cpp/getopt/small/opt2.h
+++ b/library/cpp/getopt/small/opt2.h
@@ -85,7 +85,7 @@ public:
// For options with parameters
const char* Arg(char opt, const char* helpUsage, const char* defValue, bool required = false);
const char* Arg(char opt, const char* helpUsage) {
- return Arg(opt, helpUsage, nullptr, true);
+ return Arg(opt, helpUsage, nullptr, true);
}
const char* Arg(char opt, const char* helpUsage, TString defValue, bool required = false);
@@ -108,7 +108,7 @@ public:
bool Has(char opt, const char* helpUsage);
// Add user defined error message and set error flag
- void AddError(const char* message = nullptr);
+ void AddError(const char* message = nullptr);
public:
// non-option args
diff --git a/library/cpp/getopt/small/posix_getopt.cpp b/library/cpp/getopt/small/posix_getopt.cpp
index a2f073bdd4..bd06f3499f 100644
--- a/library/cpp/getopt/small/posix_getopt.cpp
+++ b/library/cpp/getopt/small/posix_getopt.cpp
@@ -17,7 +17,7 @@ namespace NLastGetopt {
int getopt_long_impl(int argc, char* const* argv, const char* optstring,
const struct option* longopts, int* longindex, bool long_only) {
if (!Opts || optreset == 1) {
- optarg = nullptr;
+ optarg = nullptr;
optind = 1;
opterr = 1;
optreset = 0;
@@ -25,7 +25,7 @@ namespace NLastGetopt {
Opts->AllowSingleDashForLong_ = long_only;
- for (const struct option* o = longopts; o != nullptr && o->name != nullptr; ++o) {
+ for (const struct option* o = longopts; o != nullptr && o->name != nullptr; ++o) {
TOpt* opt;
if ((unsigned)o->val < 0x80 && isalnum(o->val)) {
opt = &Opts->CharOption(char(o->val));
@@ -41,7 +41,7 @@ namespace NLastGetopt {
OptsParser.Reset(new TOptsParser(&*Opts, argc, (const char**)argv));
}
- optarg = nullptr;
+ optarg = nullptr;
try {
if (!OptsParser->Next()) {
@@ -71,7 +71,7 @@ namespace NLastGetopt {
// XXX: leading colon is not supported
// XXX: updating optind by client is not supported
int getopt(int argc, char* const* argv, const char* optstring) {
- return getopt_long(argc, argv, optstring, nullptr, nullptr);
+ return getopt_long(argc, argv, optstring, nullptr, nullptr);
}
}
diff --git a/library/cpp/getopt/small/ygetopt.cpp b/library/cpp/getopt/small/ygetopt.cpp
index 2f55c73e8e..1f52827f74 100644
--- a/library/cpp/getopt/small/ygetopt.cpp
+++ b/library/cpp/getopt/small/ygetopt.cpp
@@ -68,7 +68,7 @@ private:
};
TGetOpt::TIterator::TIterator() noexcept
- : Impl_(nullptr)
+ : Impl_(nullptr)
{
}
@@ -99,7 +99,7 @@ const char* TGetOpt::TIterator::Arg() const noexcept {
return Impl_->Arg();
}
- return nullptr;
+ return nullptr;
}
TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format)
diff --git a/library/cpp/getopt/ut/posix_getopt_ut.cpp b/library/cpp/getopt/ut/posix_getopt_ut.cpp
index 50e1f944de..b6d374bf28 100644
--- a/library/cpp/getopt/ut/posix_getopt_ut.cpp
+++ b/library/cpp/getopt/ut/posix_getopt_ut.cpp
@@ -39,12 +39,12 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {
NLastGetopt::optreset = 1;
UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, &longIndex));
UNIT_ASSERT_VALUES_EQUAL(0, longIndex);
- UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, &longIndex));
UNIT_ASSERT_VALUES_EQUAL(1, longIndex);
- UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL(0, NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL(0, NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
UNIT_ASSERT_VALUES_EQUAL(6, NLastGetopt::optind);
}
@@ -63,9 +63,9 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {
char** const argv = (char**)argv0;
NLastGetopt::optreset = 1;
- UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long(argc, argv, "bf:", longopts, nullptr));
UNIT_ASSERT_VALUES_EQUAL(3, NLastGetopt::optind);
}
@@ -81,7 +81,7 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {
char** const argv = (char**)argv0;
NLastGetopt::optreset = 1;
- UNIT_ASSERT_VALUES_EQUAL('?', NLastGetopt::getopt_long(argc, argv, "bf", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('?', NLastGetopt::getopt_long(argc, argv, "bf", longopts, nullptr));
}
Y_UNIT_TEST(TestLongOnly) {
@@ -96,10 +96,10 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {
char** const argv = (char**)argv0;
NLastGetopt::optreset = 1;
- UNIT_ASSERT_VALUES_EQUAL('F', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL('F', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
- UNIT_ASSERT_VALUES_EQUAL('o', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('F', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('F', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('o', NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt_long_only(argc, argv, "fo", longopts, nullptr));
}
@@ -114,6 +114,6 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) {
char** const argv = (char**)argv0;
NLastGetopt::optreset = 1;
- UNIT_ASSERT_VALUES_EQUAL('?', NLastGetopt::getopt_long(argc, argv, "z", longopts, nullptr));
+ UNIT_ASSERT_VALUES_EQUAL('?', NLastGetopt::getopt_long(argc, argv, "z", longopts, nullptr));
}
}
diff --git a/library/cpp/getopt/ut/ygetopt_ut.cpp b/library/cpp/getopt/ut/ygetopt_ut.cpp
index b9b259c4fb..a76f117216 100644
--- a/library/cpp/getopt/ut/ygetopt_ut.cpp
+++ b/library/cpp/getopt/ut/ygetopt_ut.cpp
@@ -16,7 +16,7 @@ public:
UNIT_TEST_SUITE_REGISTRATION(TGetOptTest);
void TGetOptTest::TestZeroArgC() {
- TGetOpt opt(0, nullptr, "");
+ TGetOpt opt(0, nullptr, "");
}
void TGetOptTest::TestGetOpt() {