add --version

This commit is contained in:
hinto.janai 2023-04-17 09:37:05 -04:00
parent 80352f6b30
commit 950ecd6bbc
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
3 changed files with 13 additions and 0 deletions

View file

@ -29,6 +29,7 @@
--no-upnp Disable UPnP port forwarding --no-upnp Disable UPnP port forwarding
--no-igd An alias for --no-upnp --no-igd An alias for --no-upnp
--upnp-stratum Port forward Stratum port (it's not forwarded by default) --upnp-stratum Port forward Stratum port (it's not forwarded by default)
--version Print p2pool's version and build details
``` ```
### Example command line ### Example command line

View file

@ -58,6 +58,7 @@ void p2pool_usage()
"--no-igd An alias for --no-upnp\n" "--no-igd An alias for --no-upnp\n"
"--upnp-stratum Port forward Stratum port (it's not forwarded by default)\n" "--upnp-stratum Port forward Stratum port (it's not forwarded by default)\n"
#endif #endif
"--version Print p2pool's version and build details\n"
"--help Show this help message\n\n" "--help Show this help message\n\n"
"Example command line:\n\n" "Example command line:\n\n"
"%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n", "%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n",
@ -75,6 +76,11 @@ void p2pool_usage()
); );
} }
void p2pool_version()
{
printf("P2Pool %s\n", p2pool::VERSION);
}
void memory_tracking_start(); void memory_tracking_start();
void memory_tracking_stop(); void memory_tracking_stop();
@ -90,6 +96,11 @@ int main(int argc, char* argv[])
p2pool_usage(); p2pool_usage();
return 0; return 0;
} }
if (strcmp(argv[i], "--version") || strcmp(argv[i], "/version") || strcmp(argv[i], "-v") || strcmp(argv[i], "/v")) {
p2pool_version();
return 0;
}
} }
memory_tracking_start(); memory_tracking_start();

View file

@ -280,6 +280,7 @@ struct PerfTimer
void memory_tracking_start(); void memory_tracking_start();
void memory_tracking_stop(); void memory_tracking_stop();
void p2pool_usage(); void p2pool_usage();
void p2pool_version();
namespace robin_hood { namespace robin_hood {