diff --git a/lib/main.c b/lib/main.c index f10cc70..8ee4d22 100644 --- a/lib/main.c +++ b/lib/main.c @@ -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();*/ diff --git a/t/test-bi.sh b/t/test-bi.sh new file mode 100644 index 0000000..8eeb6ac --- /dev/null +++ b/t/test-bi.sh @@ -0,0 +1,11 @@ +a=`openssl rand -hex 20 | tr '[a-z]' '[A-Z]'` +b=`openssl rand -hex 19 | tr '[a-z]' '[A-Z]'` + +q1=$(echo -e "ibase=16\nprint ($a / $b)" | bc -q) +r1=$(echo -e "ibase=16\nprint ($a % $b)" | bc -q) + +q2=$(echo -e "(printf \"%O\" (/ #x$a #x$b))" | ~/xxx/bin/hcl /dev/stdin 2> /dev/null) +r2=$(echo -e "(printf \"%O\" (rem #x$a #x$b))" | ~/xxx/bin/hcl /dev/stdin 2>/dev/null) + +echo "$q2" +echo "$r2"