diff --git a/mongoose.h b/mongoose.h index 913b9e48..0793c1ed 100644 --- a/mongoose.h +++ b/mongoose.h @@ -883,6 +883,9 @@ size_t mg_print_mac(void (*out)(char, void *), void *arg, va_list *ap); void mg_pfn_iobuf(char ch, void *param); // param: struct mg_iobuf * void mg_pfn_stdout(char c, void *param); // param: ignored +// A helper macro for printing JSON: mg_snprintf(buf, len, "%m", MG_ESC("hi")) +#define MG_ESC(str) mg_print_esc, 0, (str) + diff --git a/src/printf.h b/src/printf.h index 47ea873c..edbc9961 100644 --- a/src/printf.h +++ b/src/printf.h @@ -25,3 +25,6 @@ size_t mg_print_mac(void (*out)(char, void *), void *arg, va_list *ap); // Various output functions void mg_pfn_iobuf(char ch, void *param); // param: struct mg_iobuf * void mg_pfn_stdout(char c, void *param); // param: ignored + +// A helper macro for printing JSON: mg_snprintf(buf, len, "%m", MG_ESC("hi")) +#define MG_ESC(str) mg_print_esc, 0, (str)