Fix #5404 - r2agent -v show version

This commit is contained in:
pancake 2016-08-07 00:43:16 +01:00
parent 1447dc7522
commit d07b788786
2 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,11 @@ static int usage (int v) {
return !v; return !v;
} }
static int showversion() {
printf (R2_VERSION"\n");
return 0;
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
RSocket *s; RSocket *s;
RSocketHTTPRequest *rs; RSocketHTTPRequest *rs;
@ -32,7 +37,7 @@ int main(int argc, char **argv) {
bool listenlocal = true; bool listenlocal = true;
const char *port = "8080"; const char *port = "8080";
while ((c = getopt (argc, argv, "ahp:ds")) != -1) { while ((c = getopt (argc, argv, "adhp:sv")) != -1) {
switch (c) { switch (c) {
case 'a': case 'a':
listenlocal = false; listenlocal = false;
@ -45,6 +50,8 @@ int main(int argc, char **argv) {
break; break;
case 'h': case 'h':
return usage (1); return usage (1);
case 'v':
return showversion ();
case 'p': case 'p':
port = optarg; port = optarg;
break; break;

View File

@ -20,6 +20,8 @@ Show help prompt
Run in sandbox mode Run in sandbox mode
.It Fl p, Cm port Ar PORT .It Fl p, Cm port Ar PORT
Specify listening port for the agent Specify listening port for the agent
.It Fl v
Show version information
.El .El
.Sh EXAMPLES .Sh EXAMPLES
.Pp .Pp