summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJongHeon Choi <j-h.choi@samsung.com>2017-02-08 14:39:43 +0900
committerJongHeon Choi <j-h.choi@samsung.com>2017-03-14 13:12:27 +0900
commit3ec845f45547262515002fd6b72e47728952b562 (patch)
treeba7e3ded27aa9da0f8c566b5d8d6129eb7d499c2
parent54ebfe5e7821b9725edfd231a1b72142fc1db59d (diff)
downloadlauncher-3ec845f45547262515002fd6b72e47728952b562.tar.gz
launcher-3ec845f45547262515002fd6b72e47728952b562.tar.bz2
launcher-3ec845f45547262515002fd6b72e47728952b562.zip
Bug fix for multiple parameters of nitool
Change-Id: Iddca7fd903e6cb42caed952b803a3f3100497a59
-rw-r--r--NativeLauncher/installer-plugin/nitool.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/NativeLauncher/installer-plugin/nitool.cc b/NativeLauncher/installer-plugin/nitool.cc
index dbda0d5..b60bd8b 100644
--- a/NativeLauncher/installer-plugin/nitool.cc
+++ b/NativeLauncher/installer-plugin/nitool.cc
@@ -24,16 +24,13 @@
std::vector<const char*> get_cmd_args(char** begin, char** end)
{
- for (char** itr = end-1; itr != begin-1; --itr)
+ std::vector<const char*> list;
+ for (char** itr = begin+1; itr != end; itr++)
{
- if (itr != end && strncmp(*itr, "--", 2) == 0)
- {
- itr++;
- int len = end - itr;
- return std::vector<const char*>(len, *itr);
- }
+ if (strncmp(*itr, "--", 2) != 0)
+ list.push_back(*itr);
}
- return std::vector<const char*>(end-begin-1, *(begin+1));
+ return list;
}
bool cmd_option_exists(char** begin, char** end, const std::string& option)
@@ -70,22 +67,23 @@ int main(int argc, char* argv[])
help(argv[0]);
return 0;
}
-
- if (cmd_option_exists(argv, argv+argc, "--system"))
+ else if (cmd_option_exists(argv, argv+argc, "--system"))
{
create_ni_platform();
return 0;
}
-
- if (cmd_option_exists(argv, argv+argc, "--dll"))
+ else if (cmd_option_exists(argv, argv+argc, "--dll"))
{
dll_mode = true;
}
-
- if (cmd_option_exists(argv, argv+argc, "--pkg"))
+ else if (cmd_option_exists(argv, argv+argc, "--pkg"))
{
pkg_mode = true;
}
+ else {
+ help(argv[0]);
+ return 1;
+ }
std::vector<const char*> args = get_cmd_args(argv, argv+argc);