From f49683353dca0c5343c931db1c4711caf0212915 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Mon, 8 Aug 2022 16:01:04 -0300 Subject: [PATCH] Change argument of %M handler to mg_pfn_t plus some cosmetic changes --- docs/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index bc945c88..814e3dfb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -647,6 +647,7 @@ int mg_vprintf(struct mg_connection *, const char *fmt, va_list ap); Same as `mg_send()`, but formats data using `printf()` semantics. Return number of bytes appended to the output buffer. + NOTE: See [mg\_snprintf](#mg_snprintf-mg_vsnprintf) for the list of supported format specifiers @@ -692,7 +693,7 @@ struct mg_connection *mg_wrapfd(struct mg_mgr *mgr, int fd, ``` Wrap a given file descriptor `fd` into a connection, and add that connection -to the event manager. An `fd` descriptor must suport `send()`, `recv()`, +to the event manager. An `fd` descriptor must support `send()`, `recv()`, `select()` syscalls, and be non-blocking. Mongoose will treat it as a TCP socket. The `c->rem` and `c->loc` addresses will be empty. @@ -1025,9 +1026,11 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm, const char *path, struct mg_http_serve_opts *opts); ``` -Serve static file. +Serve static file. + NOTE: `opts->root_dir` settings is ignored by this function. + NOTE: `opts->extra_headers` must end with `\r\n`. @@ -1517,8 +1520,10 @@ size_t mg_ws_vprintf(struct mg_connection *, int op, const char *fmt, va_list *) ``` Same as `mg_ws_send()`, but formats data using `printf()` semantics. + NOTE: See [mg\_ws\_send](#mg_ws_send) for the list of possible Websocket message types + NOTE: See [mg\_snprintf](#mg_snprintf-mg_vsnprintf) for the list of supported format specifiers @@ -2625,7 +2630,7 @@ Supported format specifiers: - `Q` - expect `char *`, outputs double-quoted JSON-escaped string (extension) - `H` - expect `int`, `void *`, outputs double-quoted hex string (extension) - `V` - expect `int`, `void *`, outputs double-quoted base64 string (extension) -- `M` - expect `size_t (*)(char, void *), void *ptr, va_list *)`, calls another print function (extension) +- `M` - expect `mg_pfn_t`, calls another print function (extension) - `g`, `f` - expect `double` - `c` - expect `char` - `%` - expect `%` character itself