diff options
author | fireice-uk <fireice2@o2.pl> | 2017-01-02 22:24:32 +0000 |
---|---|---|
committer | fireice-uk <fireice2@o2.pl> | 2017-01-02 22:24:32 +0000 |
commit | 2e2d499200c13c99c8f14b8b82f1e98843563963 (patch) | |
tree | 558a0d4bc71b7e10f626f91b31d9b7fa5bd378a9 /cli-miner.cpp | |
parent | 603c73372a7ac08481197fef52ef012397cd3d3b (diff) | |
download | xmr-stak-2e2d499200c13c99c8f14b8b82f1e98843563963.zip xmr-stak-2e2d499200c13c99c8f14b8b82f1e98843563963.tar.gz |
Tweaks to make the application more Windows-friendly
Diffstat (limited to 'cli-miner.cpp')
-rw-r--r-- | cli-miner.cpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/cli-miner.cpp b/cli-miner.cpp index b4d563c..580d50a 100644 --- a/cli-miner.cpp +++ b/cli-miner.cpp @@ -21,30 +21,67 @@ #include <stdlib.h> #include <stdio.h> +#include <string.h> + +//Do a press any key for the windows folk. *insert any key joke here* +#ifdef _WIN32 +void win_exit() +{ + + printer::inst()->print_str("Press any key to exit."); + get_key(); + return; +} + +#define strcasecmp _stricmp + +#else +void win_exit() { return; } +#endif // _WIN32 int main(int argc, char *argv[]) { - if(argc != 2 || strcmp(argv[1], "-h") == 0) + const char* sFilename = "config.txt"; + + if(argc >= 2) { - printer::inst()->print_msg(L0, "Usage %s [CONFIG FILE]", argv[0]); - return 0; + if(strcmp(argv[1], "-h") == 0) + { + printer::inst()->print_msg(L0, "Usage %s [CONFIG FILE]", argv[0]); + win_exit(); + return 0; + } + + if(argc >= 3 && strcasecmp(argv[1], "-c") == 0) + sFilename = argv[2]; + else + sFilename = argv[1]; } - if(!jconf::inst()->parse_config(argv[1])) + if(!jconf::inst()->parse_config(sFilename)) + { + win_exit(); return 0; - + } printer::inst()->print_str("-------------------------------------------------------------------\n"); printer::inst()->print_str("XMR-Stak-CPU mining software, CPU Version.\n"); printer::inst()->print_str("Based on CPU mining code by wolf9466 (heavily optimized by myself).\n"); - printer::inst()->print_str("Brought to you by fireice_uk under GPLv3.\n"); + printer::inst()->print_str("Brought to you by fireice_uk under GPLv3.\n\n"); char buffer[64]; - snprintf(buffer, sizeof(buffer), "Configurable dev donation level is set to %.1f %%\n", fDevDonationLevel * 100.0); + snprintf(buffer, sizeof(buffer), "Configurable dev donation level is set to %.1f %%\n\n", fDevDonationLevel * 100.0); printer::inst()->print_str(buffer); + printer::inst()->print_str("You can use following keys to display reports:\n"); + printer::inst()->print_str("'h' - hashrate\n"); + printer::inst()->print_str("'r' - results\n"); + printer::inst()->print_str("'c' - connection\n"); printer::inst()->print_str("-------------------------------------------------------------------\n"); if (!minethd::self_test()) + { + win_exit(); return 0; + } executor::inst()->ex_start(); |