mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
tester: fix handling of -l arg
This commit is contained in:
parent
b41af4e192
commit
498777db4c
@ -58,14 +58,15 @@ handle_opts(const char** argv){
|
|||||||
}else if(strcmp(*argv, "-p") == 0){
|
}else if(strcmp(*argv, "-p") == 0){
|
||||||
inarg = true;
|
inarg = true;
|
||||||
}else if(strncmp(*argv, "-l", 2) == 0){ // just require -l
|
}else if(strncmp(*argv, "-l", 2) == 0){ // just require -l
|
||||||
|
const char* larg = *(argv + 1);
|
||||||
char* eol;
|
char* eol;
|
||||||
long ll = strtol(*argv + 2, &eol, 0);
|
long ll = strtol(larg, &eol, 0);
|
||||||
if(ll < NCLOGLEVEL_SILENT || ll > NCLOGLEVEL_TRACE){
|
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);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if(*eol){
|
if(*eol){
|
||||||
std::cerr << "illegal loglevel: " << *argv + 2 << std::endl;
|
std::cerr << "illegal loglevel: " << larg << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
std::cout << "got loglevel " << ll << std::endl;
|
std::cout << "got loglevel " << ll << std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user