enhanced the inclusion path handling in the sample hcl server code
added HCL_SERVER_SCRIPT_INCLUDE_PATH added optstate field in hcl_server_worker_t
This commit is contained in:
parent
b3cef9ec5c
commit
c41c3a12af
90
lib/hcl-s.c
90
lib/hcl-s.c
@ -220,10 +220,22 @@ struct hcl_server_proto_t
|
|||||||
enum hcl_server_worker_state_t
|
enum hcl_server_worker_state_t
|
||||||
{
|
{
|
||||||
HCL_SERVER_WORKER_STATE_DEAD = 0,
|
HCL_SERVER_WORKER_STATE_DEAD = 0,
|
||||||
HCL_SERVER_WORKER_STATE_ALIVE = 1
|
HCL_SERVER_WORKER_STATE_ALIVE = 1,
|
||||||
|
HCL_SERVER_WORKER_STATE_ZOMBIE = 2 /* the worker is not chained in the server's client list */
|
||||||
};
|
};
|
||||||
typedef enum hcl_server_worker_state_t hcl_server_worker_state_t;
|
typedef enum hcl_server_worker_state_t hcl_server_worker_state_t;
|
||||||
|
|
||||||
|
enum hcl_server_worker_opstate_t
|
||||||
|
{
|
||||||
|
HCL_SERVER_WORKER_OPSTATE_IDLE = 0,
|
||||||
|
HCL_SERVER_WORKER_OPSTATE_ERROR = 1,
|
||||||
|
HCL_SERVER_WORKER_OPSTATE_WAIT = 2,
|
||||||
|
HCL_SERVER_WORKER_OPSTATE_READ = 3,
|
||||||
|
HCL_SERVER_WORKER_OPSTATE_COMPILE = 4,
|
||||||
|
HCL_SERVER_WORKER_OPSTATE_EXECUTE = 5
|
||||||
|
};
|
||||||
|
typedef enum hcl_server_worker_opstate_t hcl_server_worker_opstate_t;
|
||||||
|
|
||||||
struct hcl_server_worker_t
|
struct hcl_server_worker_t
|
||||||
{
|
{
|
||||||
pthread_t thr;
|
pthread_t thr;
|
||||||
@ -233,9 +245,10 @@ struct hcl_server_worker_t
|
|||||||
/* TODO: peer address */
|
/* TODO: peer address */
|
||||||
|
|
||||||
int claimed;
|
int claimed;
|
||||||
time_t time_created;
|
|
||||||
hcl_server_worker_state_t state;
|
|
||||||
|
|
||||||
|
hcl_ntime_t time_created;
|
||||||
|
hcl_server_worker_state_t state;
|
||||||
|
hcl_server_worker_opstate_t opstate;
|
||||||
hcl_server_proto_t* proto;
|
hcl_server_proto_t* proto;
|
||||||
|
|
||||||
hcl_server_t* server;
|
hcl_server_t* server;
|
||||||
@ -279,6 +292,7 @@ struct hcl_server_t
|
|||||||
hcl_ntime_t worker_idle_timeout;
|
hcl_ntime_t worker_idle_timeout;
|
||||||
hcl_oow_t actor_heap_size;
|
hcl_oow_t actor_heap_size;
|
||||||
hcl_ntime_t actor_max_runtime;
|
hcl_ntime_t actor_max_runtime;
|
||||||
|
hcl_ooch_t script_include_path[HCL_PATH_MAX + 1];
|
||||||
} cfg;
|
} cfg;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -308,12 +322,16 @@ int hcl_server_proto_feed_reply (hcl_server_proto_t* proto, const hcl_ooch_t* pt
|
|||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
# define IS_PATH_SEP(c) ((c) == '/' || (c) == '\\')
|
# define IS_PATH_SEP(c) ((c) == '/' || (c) == '\\')
|
||||||
|
# define PATH_SEP_CHAR ('\\')
|
||||||
#else
|
#else
|
||||||
# define IS_PATH_SEP(c) ((c) == '/')
|
# define IS_PATH_SEP(c) ((c) == '/')
|
||||||
|
# define PATH_SEP_CHAR ('/')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
|
static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
|
||||||
{
|
{
|
||||||
const hcl_bch_t* p, * last = HCL_NULL;
|
const hcl_bch_t* p, * last = HCL_NULL;
|
||||||
@ -330,11 +348,16 @@ static HCL_INLINE int open_input (hcl_t* hcl, hcl_ioinarg_t* arg)
|
|||||||
{
|
{
|
||||||
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
|
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
|
||||||
bb_t* bb = HCL_NULL;
|
bb_t* bb = HCL_NULL;
|
||||||
|
hcl_server_t* server;
|
||||||
|
|
||||||
|
server = xtn->proto->worker->server;
|
||||||
|
|
||||||
/* TOOD: support predefined include directory as well */
|
|
||||||
if (arg->includer)
|
if (arg->includer)
|
||||||
{
|
{
|
||||||
/* includee */
|
/* includee */
|
||||||
|
|
||||||
|
/* TOOD: Do i need to skip prepending the include path if the included path is an absolute path?
|
||||||
|
* it may be good for security if i don't skip it. we can lock the included files in a given directory */
|
||||||
hcl_oow_t ucslen, bcslen, parlen;
|
hcl_oow_t ucslen, bcslen, parlen;
|
||||||
const hcl_bch_t* fn, * fb;
|
const hcl_bch_t* fn, * fb;
|
||||||
|
|
||||||
@ -345,21 +368,43 @@ static HCL_INLINE int open_input (hcl_t* hcl, hcl_ioinarg_t* arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fn = ((bb_t*)arg->includer->handle)->fn;
|
fn = ((bb_t*)arg->includer->handle)->fn;
|
||||||
|
if (fn[0] == '\0' && server->cfg.script_include_path[0] != '\0')
|
||||||
|
{
|
||||||
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
|
if (hcl_convootobcstr(hcl, server->cfg.script_include_path, &ucslen, HCL_NULL, &parlen) <= -1) goto oops;
|
||||||
|
#else
|
||||||
|
parlen = hcl_countbcstr(server->cfg.script_include_path);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fb = get_base_name(fn);
|
fb = get_base_name(fn);
|
||||||
parlen = fb - fn;
|
parlen = fb - fn;
|
||||||
|
}
|
||||||
|
|
||||||
bb = (bb_t*)hcl_callocmem (hcl, HCL_SIZEOF(*bb) + (HCL_SIZEOF(hcl_bch_t) * (parlen + bcslen + 1)));
|
bb = (bb_t*)hcl_callocmem(hcl, HCL_SIZEOF(*bb) + (HCL_SIZEOF(hcl_bch_t) * (parlen + bcslen + 2)));
|
||||||
if (!bb) goto oops;
|
if (!bb) goto oops;
|
||||||
|
|
||||||
bb->fn = (hcl_bch_t*)(bb + 1);
|
bb->fn = (hcl_bch_t*)(bb + 1);
|
||||||
|
if (fn[0] == '\0' && server->cfg.script_include_path[0] != '\0')
|
||||||
|
{
|
||||||
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
|
hcl_convootobcstr (hcl, server->cfg.script_include_path, &ucslen, bb->fn, &parlen);
|
||||||
|
#else
|
||||||
|
hcl_copybchars (bb->fn, fn, server->cfg.script_include_path);
|
||||||
|
#endif
|
||||||
|
if (!IS_PATH_SEP(bb->fn[parlen])) bb->fn[parlen++] = PATH_SEP_CHAR; /* +2 was used in hcl_callocmem() for this (+1 for this, +1 for '\0' */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
hcl_copybchars (bb->fn, fn, parlen);
|
hcl_copybchars (bb->fn, fn, parlen);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(HCL_OOCH_IS_UCH)
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
hcl_convootobcstr (hcl, arg->name, &ucslen, &bb->fn[parlen], &bcslen);
|
hcl_convootobcstr (hcl, arg->name, &ucslen, &bb->fn[parlen], &bcslen);
|
||||||
#else
|
#else
|
||||||
hcl_copybcstr (&bb->fn[parlen], bcslen + 1, arg->name);
|
hcl_copybcstr (&bb->fn[parlen], bcslen + 1, arg->name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bb->fd = open(bb->fn, O_RDONLY, 0);
|
bb->fd = open(bb->fn, O_RDONLY, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -369,8 +414,9 @@ static HCL_INLINE int open_input (hcl_t* hcl, hcl_ioinarg_t* arg)
|
|||||||
bb = (bb_t*)hcl_callocmem(hcl, HCL_SIZEOF(*bb) + (HCL_SIZEOF(hcl_bch_t) * (pathlen + 1)));
|
bb = (bb_t*)hcl_callocmem(hcl, HCL_SIZEOF(*bb) + (HCL_SIZEOF(hcl_bch_t) * (pathlen + 1)));
|
||||||
if (!bb) goto oops;
|
if (!bb) goto oops;
|
||||||
|
|
||||||
/*bb->fn = (hcl_bch_t*)(bb + 1);
|
/* copy ane empty string as a main stream's name */
|
||||||
hcl_copybcstr (bb->fn, pathlen + 1, "");*/
|
bb->fn = (hcl_bch_t*)(bb + 1);
|
||||||
|
hcl_copybcstr (bb->fn, pathlen + 1, "");
|
||||||
|
|
||||||
bb->fd = xtn->proto->worker->sck;
|
bb->fd = xtn->proto->worker->sck;
|
||||||
}
|
}
|
||||||
@ -436,7 +482,7 @@ static HCL_INLINE int read_input (hcl_t* hcl, hcl_ioinarg_t* arg)
|
|||||||
|
|
||||||
pfd.fd = bb->fd;
|
pfd.fd = bb->fd;
|
||||||
pfd.events = POLLIN | POLLERR;
|
pfd.events = POLLIN | POLLERR;
|
||||||
n = poll(&pfd, 1, 10000); /* TOOD: adjust this interval? */
|
n = poll(&pfd, 1, 10000); /* TOOD: adjust this interval base on the worker_idle_timeout? */
|
||||||
if (n <= -1)
|
if (n <= -1)
|
||||||
{
|
{
|
||||||
if (errno == EINTR) goto start_over;
|
if (errno == EINTR) goto start_over;
|
||||||
@ -1657,6 +1703,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_EXECUTE;
|
||||||
if (execute_script(proto, ".END") <= -1) return -1;
|
if (execute_script(proto, ".END") <= -1) return -1;
|
||||||
proto->req.state = HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL;
|
proto->req.state = HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL;
|
||||||
break;
|
break;
|
||||||
@ -1679,6 +1726,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
|
|
||||||
if (proto->req.state == HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL) hcl_reset(proto->hcl);
|
if (proto->req.state == HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL) hcl_reset(proto->hcl);
|
||||||
|
|
||||||
|
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_READ;
|
||||||
obj = hcl_read(proto->hcl);
|
obj = hcl_read(proto->hcl);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
@ -1693,6 +1741,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_COMPILE;
|
||||||
if (hcl_compile(proto->hcl, obj) <= -1)
|
if (hcl_compile(proto->hcl, obj) <= -1)
|
||||||
{
|
{
|
||||||
HCL_LOG1 (proto->hcl, SERVER_LOGMASK_ERROR, "Unable to compile .SCRIPT contents - %js\n", hcl_geterrmsg(proto->hcl));
|
HCL_LOG1 (proto->hcl, SERVER_LOGMASK_ERROR, "Unable to compile .SCRIPT contents - %js\n", hcl_geterrmsg(proto->hcl));
|
||||||
@ -1701,6 +1750,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
|
|
||||||
if (proto->req.state == HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL)
|
if (proto->req.state == HCL_SERVER_PROTO_REQ_IN_TOP_LEVEL)
|
||||||
{
|
{
|
||||||
|
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_EXECUTE;
|
||||||
if (execute_script(proto, ".SCRIPT") <= -1) return -1;
|
if (execute_script(proto, ".SCRIPT") <= -1) return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1721,6 +1771,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hcl_server_proto_start_reply (proto);
|
hcl_server_proto_start_reply (proto);
|
||||||
|
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_EXECUTE;
|
||||||
show_server_workers (proto);
|
show_server_workers (proto);
|
||||||
if (hcl_server_proto_end_reply(proto, HCL_NULL) <= -1)
|
if (hcl_server_proto_end_reply(proto, HCL_NULL) <= -1)
|
||||||
{
|
{
|
||||||
@ -1760,6 +1811,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hcl_server_proto_start_reply (proto);
|
hcl_server_proto_start_reply (proto);
|
||||||
|
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_EXECUTE;
|
||||||
n = kill_server_worker(proto, wid);
|
n = kill_server_worker(proto, wid);
|
||||||
if (hcl_server_proto_end_reply(proto, (n <= -1? failmsg: HCL_NULL)) <= -1)
|
if (hcl_server_proto_end_reply(proto, (n <= -1? failmsg: HCL_NULL)) <= -1)
|
||||||
{
|
{
|
||||||
@ -1992,6 +2044,8 @@ static hcl_server_worker_t* alloc_worker (hcl_server_t* server, int cli_sck)
|
|||||||
if (!worker) return HCL_NULL;
|
if (!worker) return HCL_NULL;
|
||||||
|
|
||||||
HCL_MEMSET (worker, 0, HCL_SIZEOF(*worker));
|
HCL_MEMSET (worker, 0, HCL_SIZEOF(*worker));
|
||||||
|
worker->state = HCL_SERVER_WORKER_STATE_ZOMBIE;
|
||||||
|
worker->opstate = HCL_SERVER_WORKER_OPSTATE_IDLE;
|
||||||
worker->sck = cli_sck;
|
worker->sck = cli_sck;
|
||||||
worker->server = server;
|
worker->server = server;
|
||||||
|
|
||||||
@ -2076,6 +2130,7 @@ static void zap_worker_in_server (hcl_server_t* server, hcl_server_worker_t* wor
|
|||||||
|
|
||||||
HCL_ASSERT (server->dummy_hcl, server->worker_list[wstate].count > 0);
|
HCL_ASSERT (server->dummy_hcl, server->worker_list[wstate].count > 0);
|
||||||
server->worker_list[wstate].count--;
|
server->worker_list[wstate].count--;
|
||||||
|
worker->state = HCL_SERVER_WORKER_STATE_ZOMBIE;
|
||||||
worker->prev_worker = HCL_NULL;
|
worker->prev_worker = HCL_NULL;
|
||||||
worker->next_worker = HCL_NULL;
|
worker->next_worker = HCL_NULL;
|
||||||
}
|
}
|
||||||
@ -2103,7 +2158,12 @@ static void* worker_main (void* ctx)
|
|||||||
|
|
||||||
while (!server->stopreq)
|
while (!server->stopreq)
|
||||||
{
|
{
|
||||||
if (hcl_server_proto_handle_request(worker->proto) <= 0) break;
|
worker->opstate = HCL_SERVER_WORKER_OPSTATE_WAIT;
|
||||||
|
if (hcl_server_proto_handle_request(worker->proto) <= 0)
|
||||||
|
{
|
||||||
|
worker->opstate = HCL_SERVER_WORKER_OPSTATE_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_server_proto_close (worker->proto);
|
hcl_server_proto_close (worker->proto);
|
||||||
@ -2421,6 +2481,10 @@ int hcl_server_setoption (hcl_server_t* server, hcl_server_option_t id, const vo
|
|||||||
case HCL_SERVER_ACTOR_MAX_RUNTIME:
|
case HCL_SERVER_ACTOR_MAX_RUNTIME:
|
||||||
server->cfg.actor_max_runtime = *(hcl_ntime_t*)value;
|
server->cfg.actor_max_runtime = *(hcl_ntime_t*)value;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case HCL_SERVER_SCRIPT_INCLUDE_PATH:
|
||||||
|
hcl_copyoocstr (server->cfg.script_include_path, HCL_COUNTOF(server->cfg.script_include_path), (const hcl_ooch_t*)value);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hcl_server_seterrnum (server, HCL_EINVAL);
|
hcl_server_seterrnum (server, HCL_EINVAL);
|
||||||
@ -2458,6 +2522,10 @@ int hcl_server_getoption (hcl_server_t* server, hcl_server_option_t id, void* va
|
|||||||
case HCL_SERVER_ACTOR_MAX_RUNTIME:
|
case HCL_SERVER_ACTOR_MAX_RUNTIME:
|
||||||
*(hcl_ntime_t*)value = server->cfg.actor_max_runtime;
|
*(hcl_ntime_t*)value = server->cfg.actor_max_runtime;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case HCL_SERVER_SCRIPT_INCLUDE_PATH:
|
||||||
|
*(hcl_ooch_t**)value = server->cfg.script_include_path;
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
hcl_server_seterrnum (server, HCL_EINVAL);
|
hcl_server_seterrnum (server, HCL_EINVAL);
|
||||||
|
@ -41,7 +41,8 @@ enum hcl_server_option_t
|
|||||||
HCL_SERVER_WORKER_STACK_SIZE,
|
HCL_SERVER_WORKER_STACK_SIZE,
|
||||||
HCL_SERVER_WORKER_IDLE_TIMEOUT,
|
HCL_SERVER_WORKER_IDLE_TIMEOUT,
|
||||||
HCL_SERVER_ACTOR_HEAP_SIZE,
|
HCL_SERVER_ACTOR_HEAP_SIZE,
|
||||||
HCL_SERVER_ACTOR_MAX_RUNTIME
|
HCL_SERVER_ACTOR_MAX_RUNTIME,
|
||||||
|
HCL_SERVER_SCRIPT_INCLUDE_PATH
|
||||||
};
|
};
|
||||||
typedef enum hcl_server_option_t hcl_server_option_t;
|
typedef enum hcl_server_option_t hcl_server_option_t;
|
||||||
|
|
||||||
|
29
lib/main2.c
29
lib/main2.c
@ -475,6 +475,20 @@ static int handle_dbgopt (hcl_server_t* server, const char* str)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int handle_incpath (hcl_server_t* server, const char* str)
|
||||||
|
{
|
||||||
|
#if defined(HCL_OOCH_IS_UCH)
|
||||||
|
hcl_ooch_t incpath[HCL_PATH_MAX + 1];
|
||||||
|
hcl_oow_t bcslen, ucslen;
|
||||||
|
|
||||||
|
ucslen = HCL_COUNTOF(incpath);
|
||||||
|
if (hcl_conv_bcs_to_ucs_with_cmgr(str, &bcslen, incpath, &ucslen, hcl_server_getcmgr(server), 1) <= -1) return -1;
|
||||||
|
return hcl_server_setoption(server, HCL_SERVER_SCRIPT_INCLUDE_PATH, incpath);
|
||||||
|
#else
|
||||||
|
return hcl_server_setoption(server, HCL_SERVER_SCRIPT_INCLUDE_PATH, str);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
|
|
||||||
#define MIN_WORKER_STACK_SIZE 512000ul
|
#define MIN_WORKER_STACK_SIZE 512000ul
|
||||||
@ -492,6 +506,7 @@ int main (int argc, char* argv[])
|
|||||||
{ ":worker-idle-timeout", '\0' },
|
{ ":worker-idle-timeout", '\0' },
|
||||||
{ ":actor-heap-size", 'm' },
|
{ ":actor-heap-size", 'm' },
|
||||||
{ ":actor-max-runtime", '\0' },
|
{ ":actor-max-runtime", '\0' },
|
||||||
|
{ ":script-include-path", '\0' },
|
||||||
#if defined(HCL_BUILD_DEBUG)
|
#if defined(HCL_BUILD_DEBUG)
|
||||||
{ ":debug", '\0' }, /* NOTE: there is no short option for --debug */
|
{ ":debug", '\0' }, /* NOTE: there is no short option for --debug */
|
||||||
#endif
|
#endif
|
||||||
@ -510,6 +525,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
const char* logopt = HCL_NULL;
|
const char* logopt = HCL_NULL;
|
||||||
const char* dbgopt = HCL_NULL;
|
const char* dbgopt = HCL_NULL;
|
||||||
|
const char* incpath = HCL_NULL;
|
||||||
hcl_oow_t worker_max_count = 0;
|
hcl_oow_t worker_max_count = 0;
|
||||||
hcl_oow_t worker_stack_size = MIN_ACTOR_HEAP_SIZE;
|
hcl_oow_t worker_stack_size = MIN_ACTOR_HEAP_SIZE;
|
||||||
hcl_ntime_t worker_idle_timeout = { 0, 0 };
|
hcl_ntime_t worker_idle_timeout = { 0, 0 };
|
||||||
@ -562,6 +578,10 @@ int main (int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
actor_max_runtime.sec = strtoul(opt.arg, HCL_NULL, 0);
|
actor_max_runtime.sec = strtoul(opt.arg, HCL_NULL, 0);
|
||||||
}
|
}
|
||||||
|
else if (hcl_compbcstr(opt.lngopt, "script-include-path") == 0)
|
||||||
|
{
|
||||||
|
incpath = opt.arg;
|
||||||
|
}
|
||||||
#if defined(HCL_BUILD_DEBUG)
|
#if defined(HCL_BUILD_DEBUG)
|
||||||
else if (hcl_compbcstr(opt.lngopt, "debug") == 0)
|
else if (hcl_compbcstr(opt.lngopt, "debug") == 0)
|
||||||
{
|
{
|
||||||
@ -606,13 +626,20 @@ int main (int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xtn->logmask = HCL_LOG_ALL_TYPES | HCL_LOG_ERROR | HCL_LOG_FATAL;
|
/*xtn->logmask = HCL_LOG_ALL_TYPES | HCL_LOG_ERROR | HCL_LOG_FATAL;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HCL_BUILD_DEBUG)
|
||||||
if (dbgopt)
|
if (dbgopt)
|
||||||
{
|
{
|
||||||
if (handle_dbgopt(server, dbgopt) <= -1) goto oops;
|
if (handle_dbgopt(server, dbgopt) <= -1) goto oops;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (incpath)
|
||||||
|
{
|
||||||
|
if (handle_incpath(server, incpath) <= -1) goto oops;
|
||||||
|
}
|
||||||
|
|
||||||
hcl_server_getoption (server, HCL_SERVER_TRAIT, &trait);
|
hcl_server_getoption (server, HCL_SERVER_TRAIT, &trait);
|
||||||
if (large_pages) trait |= HCL_SERVER_TRAIT_USE_LARGE_PAGES;
|
if (large_pages) trait |= HCL_SERVER_TRAIT_USE_LARGE_PAGES;
|
||||||
|
@ -1244,7 +1244,7 @@ static int begin_include (hcl_t* hcl)
|
|||||||
|
|
||||||
if (hcl->c->reader (hcl, HCL_IO_OPEN, arg) <= -1)
|
if (hcl->c->reader (hcl, HCL_IO_OPEN, arg) <= -1)
|
||||||
{
|
{
|
||||||
hcl_setsynerr (hcl, HCL_SYNERR_INCLUDE, TOKEN_LOC(hcl), TOKEN_NAME(hcl));
|
hcl_setsynerrbfmt (hcl, HCL_SYNERR_INCLUDE, TOKEN_LOC(hcl), TOKEN_NAME(hcl), "unable to include %js", io_name);
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user