summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/statetrace/statetrace.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/util/statetrace/statetrace.cc b/util/statetrace/statetrace.cc
index 824dfda69..2861bb29c 100644
--- a/util/statetrace/statetrace.cc
+++ b/util/statetrace/statetrace.cc
@@ -61,6 +61,7 @@ int main(int argc, char * argv[], char * envp[])
//Parse the command line arguments
bool printInitial = false;
bool printTrace = true;
+ string host = "localhost";
for(int x = 1; x < argc; x++)
{
if(!strcmp(argv[x], "-h"))
@@ -68,6 +69,17 @@ int main(int argc, char * argv[], char * envp[])
printUsage(argv[0]);
return 0;
}
+ if(!strcmp(argv[x], "--host"))
+ {
+ x++;
+ if(x >= argc)
+ {
+ cerr << "Incorrect usage.\n" << endl;
+ printUsage(argv[0]);
+ return 1;
+ }
+ host = argv[x];
+ }
else if(!strcmp(argv[x], "-r"))
{
cout << "Legal register names:" << endl;
@@ -127,7 +139,7 @@ int main(int argc, char * argv[], char * envp[])
return 1;
}
struct hostent *server;
- server = gethostbyname("localhost");
+ server = gethostbyname(host.c_str());
if(!server)
{
cerr << "Couldn't get host ip! " << strerror(errno) << endl;