Skip to content

Commit

Permalink
tester: fix handling of -l arg
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jun 11, 2024
1 parent b41af4e commit 498777d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ handle_opts(const char** argv){
}else if(strcmp(*argv, "-p") == 0){
inarg = true;
}else if(strncmp(*argv, "-l", 2) == 0){ // just require -l
const char* larg = *(argv + 1);
char* eol;
long ll = strtol(*argv + 2, &eol, 0);
long ll = strtol(larg, &eol, 0);
if(ll < NCLOGLEVEL_SILENT || ll > NCLOGLEVEL_TRACE){
std::cerr << "illegal loglevel: " << *argv + 2 << std::endl;
std::cerr << "illegal loglevel: " << larg << std::endl;
exit(EXIT_FAILURE);
}
if(*eol){
std::cerr << "illegal loglevel: " << *argv + 2 << std::endl;
std::cerr << "illegal loglevel: " << larg << std::endl;
exit(EXIT_FAILURE);
}
std::cout << "got loglevel " << ll << std::endl;
Expand Down

0 comments on commit 498777d

Please sign in to comment.