touched up various remaining implementation details of the printf builtin function.

This commit is contained in:
2018-03-01 05:25:09 +00:00
parent 09302470f7
commit 6eaf73a3d7
5 changed files with 96 additions and 115 deletions

View File

@ -377,23 +377,8 @@ static hcl_pfrc_t pf_integer_rem (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
/* ------------------------------------------------------------------------- */
static hcl_pfrc_t pf_printf (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
{
hcl_oop_char_t fmt;
fmt = (hcl_oop_char_t)HCL_STACK_GETARG(hcl, nargs, 0);
if (!HCL_IS_STRING(hcl, fmt))
{
/* if the first argument is not a string, it just prints the
* argument and ignore the remaining arguments */
if (hcl_print(hcl, (hcl_oop_t)fmt) <= -1)
HCL_STACK_SETRETTOERRNUM (hcl, nargs);
else
HCL_STACK_SETRET (hcl, nargs, hcl->_nil);
return HCL_PF_SUCCESS;
}
if (hcl_printfmt(hcl, nargs) <= -1)
{
HCL_STACK_SETRETTOERRNUM (hcl, nargs);