Skip to content

Commit

Permalink
add --version
Browse files Browse the repository at this point in the history
  • Loading branch information
hinto-janai committed Apr 17, 2023
1 parent 80352f6 commit 950ecd6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/COMMAND_LINE.MD
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
--no-upnp Disable UPnP port forwarding
--no-igd An alias for --no-upnp
--upnp-stratum Port forward Stratum port (it's not forwarded by default)
--version Print p2pool's version and build details
```

### Example command line
Expand Down
11 changes: 11 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void p2pool_usage()
"--no-igd An alias for --no-upnp\n"
"--upnp-stratum Port forward Stratum port (it's not forwarded by default)\n"
#endif
"--version Print p2pool's version and build details\n"
"--help Show this help message\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",
Expand All @@ -75,6 +76,11 @@ void p2pool_usage()
);
}

void p2pool_version()
{
printf("P2Pool %s\n", p2pool::VERSION);
}

void memory_tracking_start();
void memory_tracking_stop();

Expand All @@ -90,6 +96,11 @@ int main(int argc, char* argv[])
p2pool_usage();
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();
Expand Down
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ struct PerfTimer
void memory_tracking_start();
void memory_tracking_stop();
void p2pool_usage();
void p2pool_version();

namespace robin_hood {

Expand Down

0 comments on commit 950ecd6

Please sign in to comment.