diff options
author | Håvard Pettersen <havardpe@oath.com> | 2022-03-31 11:44:10 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2022-04-01 10:24:32 +0000 |
commit | d71f76a73fe54558f613e75a3a8cfd70fc46a7e8 (patch) | |
tree | 7d170e5b792dbf5fed06ff7c7b2db398b6cb64c7 /config/src/apps/vespa-get-config/getconfig.cpp | |
parent | 1bb3dd192f4bcb91e710fe19ca54b2b8935ffb83 (diff) |
use getopt/getopt_long directly
Diffstat (limited to 'config/src/apps/vespa-get-config/getconfig.cpp')
-rw-r--r-- | config/src/apps/vespa-get-config/getconfig.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/config/src/apps/vespa-get-config/getconfig.cpp b/config/src/apps/vespa-get-config/getconfig.cpp index 5c681d09526..e62521d8db1 100644 --- a/config/src/apps/vespa-get-config/getconfig.cpp +++ b/config/src/apps/vespa-get-config/getconfig.cpp @@ -12,6 +12,7 @@ #include <vespa/config/common/configresponse.h> #include <vespa/config/common/trace.h> #include <vespa/fastos/app.h> +#include <unistd.h> #include <sstream> #include <fstream> @@ -117,24 +118,22 @@ GetConfig::Main() int serverPort = 19090; - const char *optArg = nullptr; - int optInd = 0; - while ((c = GetOpt("a:n:v:g:i:jlm:c:t:V:w:r:s:p:dh", optArg, optInd)) != -1) { + while ((c = getopt(_argc, _argv, "a:n:v:g:i:jlm:c:t:V:w:r:s:p:dh")) != -1) { int retval = 1; switch (c) { case 'a': - schemaString = optArg; + schemaString = optarg; break; case 'n': - defName = optArg; + defName = optarg; break; case 'v': break; case 'g': - generation = atoll(optArg); + generation = atoll(optarg); break; case 'i': - configId = optArg; + configId = optarg; break; case 'j': printAsJson = true; @@ -143,25 +142,25 @@ GetConfig::Main() printAsJson = false; break; case 'm': - defMD5 = optArg; + defMD5 = optarg; break; case 't': - serverTimeout = vespalib::from_s(atof(optArg)); + serverTimeout = vespalib::from_s(atof(optarg)); break; case 'w': - clientTimeout = vespalib::from_s(atof(optArg)); + clientTimeout = vespalib::from_s(atof(optarg)); break; case 'r': - traceLevel = atoi(optArg); + traceLevel = atoi(optarg); break; case 'V': - vespaVersionString = optArg; + vespaVersionString = optarg; break; case 's': - serverHost = optArg; + serverHost = optarg; break; case 'p': - serverPort = atoi(optArg); + serverPort = atoi(optarg); break; case 'd': debugging = true; |