Fix example build

This commit is contained in:
cpq 2021-01-03 08:55:00 +00:00
parent 2c1324dc0a
commit e135743efa

View File

@ -11,8 +11,7 @@ static const char *s_ssi_pattern = "#.shtml";
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_HTTP_MSG) { if (ev == MG_EV_HTTP_MSG) {
struct mg_http_serve_opts opts = {.root_dir = s_root_dir, struct mg_http_serve_opts opts = {s_root_dir, s_ssi_pattern};
.ssi_pattern = s_ssi_pattern};
mg_http_serve_dir(c, ev_data, &opts); mg_http_serve_dir(c, ev_data, &opts);
} }
(void) fn_data; (void) fn_data;
@ -26,9 +25,9 @@ static void usage(const char *prog) {
" -H yes|no - enable traffic hexdump, default: '%s'\n" " -H yes|no - enable traffic hexdump, default: '%s'\n"
" -S GLOB - glob pattern for SSI files, default: '%s'\n" " -S GLOB - glob pattern for SSI files, default: '%s'\n"
" -d DIR - directory to serve, default: '%s'\n" " -d DIR - directory to serve, default: '%s'\n"
" -l ADDR - listening address, default: '%s'\n" MG_VERSION, " -l ADDR - listening address, default: '%s'\n",
prog, s_debug_level, s_enable_hexdump, s_ssi_pattern, s_root_dir, MG_VERSION, prog, s_debug_level, s_enable_hexdump, s_ssi_pattern,
s_listening_address); s_root_dir, s_listening_address);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -49,8 +48,6 @@ int main(int argc, char *argv[]) {
s_ssi_pattern = argv[++i]; s_ssi_pattern = argv[++i];
} else if (strcmp(argv[i], "-l") == 0) { } else if (strcmp(argv[i], "-l") == 0) {
s_listening_address = argv[++i]; s_listening_address = argv[++i];
} else if (strcmp(argv[i], "-r") == 0) {
s_rewrites = argv[++i];
} else { } else {
usage(argv[0]); usage(argv[0]);
} }