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:
parent
7f7a2685d0
commit
dc3c393247
11
lib/main.c
11
lib/main.c
@ -945,12 +945,13 @@ int main (int argc, char* argv[])
|
|||||||
};
|
};
|
||||||
static hcl_bopt_t opt =
|
static hcl_bopt_t opt =
|
||||||
{
|
{
|
||||||
"l:m:",
|
"l:m:v",
|
||||||
lopt
|
lopt
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* logopt = HCL_NULL;
|
const char* logopt = HCL_NULL;
|
||||||
hcl_oow_t memsize = MIN_MEMSIZE;
|
hcl_oow_t memsize = MIN_MEMSIZE;
|
||||||
|
int verbose = 0;
|
||||||
int large_pages = 0;
|
int large_pages = 0;
|
||||||
|
|
||||||
#if defined(HCL_BUILD_DEBUG)
|
#if defined(HCL_BUILD_DEBUG)
|
||||||
@ -980,6 +981,10 @@ int main (int argc, char* argv[])
|
|||||||
if (memsize <= MIN_MEMSIZE) memsize = MIN_MEMSIZE;
|
if (memsize <= MIN_MEMSIZE) memsize = MIN_MEMSIZE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
verbose = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case '\0':
|
case '\0':
|
||||||
if (hcl_comp_bcstr(opt.lngopt, "large-pages") == 0)
|
if (hcl_comp_bcstr(opt.lngopt, "large-pages") == 0)
|
||||||
{
|
{
|
||||||
@ -1155,7 +1160,7 @@ count++;
|
|||||||
goto oops;
|
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));
|
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
|
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();*/
|
/*cancel_tick();*/
|
||||||
|
11
t/test-bi.sh
Normal file
11
t/test-bi.sh
Normal file
@ -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"
|
Loading…
Reference in New Issue
Block a user