summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpsychocrypt <psychocrypt@users.noreply.github.com>2017-09-30 23:57:55 +0200
committerpsychocrypt <psychocrypt@users.noreply.github.com>2017-09-30 23:57:55 +0200
commit42cc3c3a9566cd2e21bb7e6e7218b7860e081b08 (patch)
treedca6a8a75eec549927ad9f284d3a4b1af5c6f2bb
parentb1ee3d2184fd1aaad60d22c2bad7e7e2a6f66cdb (diff)
downloadxmr-stak-42cc3c3a9566cd2e21bb7e6e7218b7860e081b08.zip
xmr-stak-42cc3c3a9566cd2e21bb7e6e7218b7860e081b08.tar.gz
add -c option for config file
-rw-r--r--doc/usage.md4
-rw-r--r--xmrstak/cli/cli-miner.cpp33
2 files changed, 26 insertions, 11 deletions
diff --git a/doc/usage.md b/doc/usage.md
index dfebf21..42a29fd 100644
--- a/doc/usage.md
+++ b/doc/usage.md
@@ -29,9 +29,9 @@ The number of files depends on the available backends.
The miner allow to overwrite some of the settings via command line options.
```
-Usage: xmr-stak [OPTION]... [CONFIGFILE]
+Usage: xmr-stak [OPTION]...
- -c, --config common miner configuration file
+ -c, --config FILE common miner configuration file
-h, --help show this help
--noCPU disable the CPU miner backend
--cpu FILE CPU backend miner config file
diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp
index 66adaf1..585b114 100644
--- a/xmrstak/cli/cli-miner.cpp
+++ b/xmrstak/cli/cli-miner.cpp
@@ -60,9 +60,9 @@ void help()
using namespace std;
using namespace xmrstak;
- cout<<"Usage: "<<params::inst().binaryName<<" [OPTION]... [CONFIGFILE]"<<endl;
+ cout<<"Usage: "<<params::inst().binaryName<<" [OPTION]..."<<endl;
cout<<" "<<endl;
- cout<<" CONFIGFILE common miner configuration file"<<endl;
+ cout<<" -c, --config FILE common miner configuration file"<<endl;
cout<<" -h, --help show this help"<<endl;
#ifndef CONF_NO_CPU
cout<<" --noCPU disable the CPU miner backend"<<endl;
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
++i;
if( i >=argc )
{
- printer::inst()->print_msg(L0, "No argument for opName '--cpu' given");
+ printer::inst()->print_msg(L0, "No argument for parameter '--cpu' given");
win_exit();
return 1;
}
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
++i;
if( i >=argc )
{
- printer::inst()->print_msg(L0, "No argument for opName '--amd' given");
+ printer::inst()->print_msg(L0, "No argument for parameter '--amd' given");
win_exit();
return 1;
}
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
++i;
if( i >=argc )
{
- printer::inst()->print_msg(L0, "No argument for opName '--nvidia' given");
+ printer::inst()->print_msg(L0, "No argument for parameter '--nvidia' given");
win_exit();
return 1;
}
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
++i;
if( i >=argc )
{
- printer::inst()->print_msg(L0, "No argument for opName '-o/--url' given");
+ printer::inst()->print_msg(L0, "No argument for parameter '-o/--url' given");
win_exit();
return 1;
}
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
++i;
if( i >=argc )
{
- printer::inst()->print_msg(L0, "No argument for opName '-u/--user' given");
+ printer::inst()->print_msg(L0, "No argument for parameter '-u/--user' given");
win_exit();
return 1;
}
@@ -194,15 +194,30 @@ int main(int argc, char *argv[])
++i;
if( i >=argc )
{
- printer::inst()->print_msg(L0, "No argument for opName '-p/--pass' given");
+ printer::inst()->print_msg(L0, "No argument for parameter '-p/--pass' given");
win_exit();
return 1;
}
userSetPasswd = true;
params::inst().poolPasswd = argv[i];
}
- else
+ else if(opName.compare("-c") == 0 || opName.compare("--config") == 0)
+ {
+ ++i;
+ if( i >=argc )
+ {
+ printer::inst()->print_msg(L0, "No argument for parameter '-c/--config' given");
+ win_exit();
+ return 1;
+ }
params::inst().configFile = argv[i];
+ }
+ else
+ {
+ printer::inst()->print_msg(L0, "Parameter unknown '%s'",argv[i]);
+ win_exit();
+ return 1;
+ }
}
// check if we need a guided start
OpenPOWER on IntegriCloud