added HCL_MOD_LIBDIRS
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-05 15:01:59 +09:00
parent 15a8f142f1
commit 9bc90c4d60
10 changed files with 286 additions and 110 deletions

View File

@ -597,8 +597,9 @@ int main (int argc, char* argv[])
{ ":debug", '\0' },
#endif
{ ":heapsize", '\0' },
{ ":log", 'l' },
{ ":log", 'l' },
{ ":info", '\0' },
{ ":modlibdirs", '\0' },
{ HCL_NULL, '\0' }
};
@ -613,6 +614,7 @@ int main (int argc, char* argv[])
int verbose = 0;
int show_info = 0;
int experimental = 0;
const char* modlibdirs = HCL_NULL;
#if defined(HCL_BUILD_DEBUG)
const char* dbgopt = HCL_NULL;
@ -662,6 +664,11 @@ int main (int argc, char* argv[])
show_info = 1;
break;
}
else if (hcl_comp_bcstr(opt.lngopt, "modlibdirs") == 0)
{
modlibdirs = opt.arg;
break;
}
goto print_usage;
@ -711,6 +718,33 @@ int main (int argc, char* argv[])
hcl_setoption (hcl, HCL_LOG_MASK, &trait);*/
}
if (modlibdirs)
{
#if defined(HCL_OOCH_IS_UCH)
hcl_ooch_t* tmp;
tmp = hcl_dupbtoucstr(hcl, modlibdirs, HCL_NULL);
if (HCL_UNLIKELY(!tmp))
{
hcl_logbfmt (hcl, HCL_LOG_STDERR,"ERROR: cannot duplicate modlibdirs - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
goto oops;
}
if (hcl_setoption(hcl, HCL_MOD_LIBDIRS, tmp) <= -1)
{
hcl_logbfmt (hcl, HCL_LOG_STDERR,"ERROR: cannot set modlibdirs - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
hcl_freemem (hcl, tmp);
goto oops;
}
hcl_freemem (hcl, tmp);
#else
if (hcl_setoption(hcl, HCL_MOD_LIBDIRS, modlibdirs) <= -1)
{
hcl_logbfmt (hcl, HCL_LOG_STDERR,"ERROR: cannot set modlibdirs - [%d] %js\n", hcl_geterrnum(hcl), hcl_geterrmsg(hcl));
goto oops;
}
#endif
}
xtn = (xtn_t*)hcl_getxtn(hcl);
memset (&hclcb, 0, HCL_SIZEOF(hclcb));