added -v to hcl. found a bug of a new line printed when printf is called. need to debug it

This commit is contained in:
2019-04-16 09:35:56 +00:00
parent 7f7a2685d0
commit dc3c393247
2 changed files with 19 additions and 3 deletions

View File

@ -945,12 +945,13 @@ int main (int argc, char* argv[])
};
static hcl_bopt_t opt =
{
"l:m:",
"l:m:v",
lopt
};
const char* logopt = HCL_NULL;
hcl_oow_t memsize = MIN_MEMSIZE;
int verbose = 0;
int large_pages = 0;
#if defined(HCL_BUILD_DEBUG)
@ -980,6 +981,10 @@ int main (int argc, char* argv[])
if (memsize <= MIN_MEMSIZE) memsize = MIN_MEMSIZE;
break;
case 'v':
verbose = 1;
break;
case '\0':
if (hcl_comp_bcstr(opt.lngopt, "large-pages") == 0)
{
@ -1155,7 +1160,7 @@ count++;
goto oops;
}
if (hcl_print(hcl, obj) <= -1)
if (verbose && hcl_print(hcl, obj) <= -1)
{
hcl_logbfmt (hcl, HCL_LOG_STDERR, "ERROR: cannot print object - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
}
@ -1231,7 +1236,7 @@ count++;
}
else
{
hcl_logbfmt (hcl, HCL_LOG_STDERR, "EXECUTION OK - EXITED WITH %O\n", retv);
if (verbose) hcl_logbfmt (hcl, HCL_LOG_STDERR, "EXECUTION OK - EXITED WITH %O\n", retv);
}
/*cancel_tick();*/