diff options
author | Håvard Pettersen <havardpe@oath.com> | 2022-04-06 12:18:08 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2022-04-08 13:45:13 +0000 |
commit | 9fbcf76d088740aacf535e6482f86c833cfae871 (patch) | |
tree | c62dcd0f9cdcee9876b37c60f741958c14147f80 /searchlib/src/apps/vespa-fileheader-inspect | |
parent | 69454cef2fe53694eb5541e5f622a4e973c081bf (diff) |
remove FastOS_Application
fixup (per application):
- maybe ignore SIGPIPE
- wire argc/argv
untangle Vespa Test Framework
strip down deprecated TestApp
Diffstat (limited to 'searchlib/src/apps/vespa-fileheader-inspect')
-rw-r--r-- | searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp b/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp index 349064eb2a8..eb5b4cba342 100644 --- a/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp +++ b/searchlib/src/apps/vespa-fileheader-inspect/vespa-fileheader-inspect.cpp @@ -1,6 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/app.h> +#include <vespa/vespalib/util/signalhandler.h> #include <vespa/fastos/file.h> #include <iomanip> #include <iostream> @@ -12,14 +12,14 @@ LOG_SETUP("vespa-fileheader-inspect"); using namespace vespalib; -class Application : public FastOS_Application { +class Application { private: vespalib::string _fileName; char _delimiter; bool _quiet; - int parseOpts(); - void usage(); + int parseOpts(int argc, char **argv); + void usage(const char *self); void printQuiet(FileHeader &header); void printVerbose(FileHeader &header); vespalib::string escape(const vespalib::string &str, char quote = '\0'); @@ -29,7 +29,7 @@ private: public: Application(); ~Application(); - int Main() override; + int main(int argc, char **argv); }; Application::Application() : @@ -42,10 +42,10 @@ Application::~Application() {} void -Application::usage() +Application::usage(const char *self) { printf("Tool for inspecting the headers of files used by Vespa.\n"); - printf("Usage: %s [options] filename\n", _argv[0]); + printf("Usage: %s [options] filename\n", self); printf("\n"); printf("The options are:\n"); printf("-d delimiter The delimiter to use to separate values in quiet output.\n"); @@ -56,10 +56,10 @@ Application::usage() int -Application::parseOpts() +Application::parseOpts(int argc, char **argv) { int c = '?'; - while ((c = getopt(_argc, _argv, "d:f:qh")) != -1) { + while ((c = getopt(argc, argv, "d:f:qh")) != -1) { switch (c) { case 'd': _delimiter = optarg[0]; @@ -71,15 +71,15 @@ Application::parseOpts() _quiet = true; break; case 'h': - usage(); + usage(argv[0]); return EXIT_SUCCESS; default: - usage(); + usage(argv[0]); return EXIT_FAILURE; } } - if (_argc == optind + 1) { - _fileName = _argv[optind]; + if (argc == optind + 1) { + _fileName = argv[optind]; } if (_fileName.empty()) { std::cerr << "No filename given." << std::endl; @@ -89,9 +89,9 @@ Application::parseOpts() } int -Application::Main() +Application::main(int argc, char **argv) { - int ret = parseOpts(); + int ret = parseOpts(argc, argv); if (ret == EXIT_FAILURE || ret == EXIT_SUCCESS) { return ret; } @@ -218,6 +218,7 @@ Application::getValueString(const FileHeader::Tag &tag) int main(int argc, char** argv) { + vespalib::SignalHandler::PIPE.ignore(); Application app; - return app.Entry(argc, argv); + return app.main(argc, argv); } |