1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lwsws: add -n to allow skipping lws plugins dir

This commit is contained in:
Andy Green 2020-10-20 11:06:10 +01:00
parent 109677df61
commit 0e6c578ab1

View file

@ -57,7 +57,7 @@ int fork(void)
static struct lws_context *context;
static lws_sorted_usec_list_t sul_lwsws;
static char config_dir[128];
static char config_dir[128], default_plugin_path = 1;
static int opts = 0, do_reload = 1;
static uv_loop_t loop;
static uv_signal_t signal_outer[2];
@ -89,6 +89,7 @@ static struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "debug", required_argument, NULL, 'd' },
{ "configdir", required_argument, NULL, 'c' },
{ "no-default-plugins", no_argument, NULL, 'n' },
{ NULL, 0, 0, 0 }
};
#endif
@ -153,7 +154,8 @@ context_creation(void)
LWS_SERVER_OPTION_LIBUV;
#if defined(LWS_WITH_PLUGINS)
info.plugin_dirs = plugin_dirs;
if (default_plugin_path)
info.plugin_dirs = plugin_dirs;
#endif
lwsl_notice("Using config dir: \"%s\"\n", config_dir);
@ -244,9 +246,9 @@ int main(int argc, char **argv)
strcpy(config_dir, "/etc/lwsws");
while (n >= 0) {
#if defined(LWS_HAS_GETOPT_LONG) || defined(WIN32)
n = getopt_long(argc, argv, "hd:c:", options, NULL);
n = getopt_long(argc, argv, "hd:c:n", options, NULL);
#else
n = getopt(argc, argv, "hd:c:");
n = getopt(argc, argv, "hd:c:n");
#endif
if (n < 0)
continue;
@ -254,12 +256,16 @@ int main(int argc, char **argv)
case 'd':
debug_level = atoi(optarg);
break;
case 'n':
default_plugin_path = 0;
break;
case 'c':
lws_strncpy(config_dir, optarg, sizeof(config_dir));
break;
case 'h':
fprintf(stderr, "Usage: lwsws [-c <config dir>] "
"[-d <log bitfield>] [--help]\n");
"[-d <log bitfield>] [--help] "
"[-n]\n");
exit(1);
}
}