Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
adamierymenko committed Nov 28, 2018
2 parents 65e0a74 + 04de230 commit 52c4385
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion one.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ static int cli(int argc,char **argv)
}
} else if (command == "get") {
if (arg1.length() != 16) {
cliPrintHelp(argv[0],stderr);
fprintf(stderr,"invalid network ID format, must be a 16-digit hexidecimal number\n");
return 2;
}
char jsons[1024], cl[128];
Expand All @@ -654,16 +654,21 @@ static int cli(int argc,char **argv)
printf("%u %s invalid JSON response (unknown exception)" ZT_EOL_S,scode,command.c_str());
return 1;
}
bool bNetworkFound = false;
if (j.is_array()) {
for(unsigned long i=0;i<j.size();++i) {
nlohmann::json &n = j[i];
if (n.is_object()) {
if (n["id"] == arg1) {
printf("%s\n", OSUtils::jsonString(n[arg2],"-").c_str());
bNetworkFound = true;
}
}
}
}
if (!bNetworkFound) {
fprintf(stderr,"unknown network ID, check that you are a member of the network\n");
}
if (scode == 200) {
return 0;
} else {
Expand Down

0 comments on commit 52c4385

Please sign in to comment.