Make it build on vc98

This commit is contained in:
Sergey Lyubka 2021-11-23 13:24:21 +00:00
parent e24cb04003
commit 1967acfef2

View File

@ -8,7 +8,6 @@ static const char *s_debug_level = "2";
static const char *s_root_dir = "."; static const char *s_root_dir = ".";
static const char *s_listening_address = "http://localhost:8000"; static const char *s_listening_address = "http://localhost:8000";
static const char *s_enable_hexdump = "no"; static const char *s_enable_hexdump = "no";
static const char *s_ssi_pattern = "#.shtml";
// Handle interrupts, like Ctrl-C // Handle interrupts, like Ctrl-C
static int s_signo; static int s_signo;
@ -20,8 +19,8 @@ static void signal_handler(int signo) {
// Simply serve static files from `s_root_dir` // Simply serve static files from `s_root_dir`
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 = {0};
.ssi_pattern = s_ssi_pattern}; opts.root_dir = s_root_dir;
mg_http_serve_dir(c, ev_data, &opts); mg_http_serve_dir(c, ev_data, &opts);
} }
(void) fn_data; (void) fn_data;
@ -32,12 +31,11 @@ static void usage(const char *prog) {
"Mongoose v.%s\n" "Mongoose v.%s\n"
"Usage: %s OPTIONS\n" "Usage: %s OPTIONS\n"
" -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"
" -d DIR - directory to serve, default: '%s'\n" " -d DIR - directory to serve, default: '%s'\n"
" -l ADDR - listening address, default: '%s'\n" " -l ADDR - listening address, default: '%s'\n"
" -v LEVEL - debug level, from 0 to 4, default: '%s'\n", " -v LEVEL - debug level, from 0 to 4, default: '%s'\n",
MG_VERSION, prog, s_debug_level, s_enable_hexdump, s_ssi_pattern, MG_VERSION, prog, s_debug_level, s_enable_hexdump, s_root_dir,
s_root_dir, s_listening_address); s_listening_address);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -52,8 +50,6 @@ int main(int argc, char *argv[]) {
s_root_dir = argv[++i]; s_root_dir = argv[++i];
} else if (strcmp(argv[i], "-H") == 0) { } else if (strcmp(argv[i], "-H") == 0) {
s_enable_hexdump = argv[++i]; s_enable_hexdump = argv[++i];
} else if (strcmp(argv[i], "-S") == 0) {
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], "-v") == 0) { } else if (strcmp(argv[i], "-v") == 0) {