diff --git a/examples/embedded_c/embedded_c.c b/examples/embedded_c/embedded_c.c index d45b2e7a..fb3ff832 100644 --- a/examples/embedded_c/embedded_c.c +++ b/examples/embedded_c/embedded_c.c @@ -34,21 +34,28 @@ int ExampleHandler(struct mg_connection *conn, void *cbdata) mg_printf( conn, "

To see a page from the A handler click A

"); - mg_printf(conn, "

To see a page from the A handler click " - "A/A

"); - mg_printf(conn, "

To see a page from the A/B handler click A/B

"); - mg_printf(conn, "

To see a page from the B handler (0) click B

"); - mg_printf(conn, "

To see a page from the B handler (1) click B/A

"); - mg_printf(conn, "

To see a page from the B handler (2) click B/B

"); - mg_printf(conn, "

To see a page from the *.foo handler click xy.foo

"); + mg_printf(conn, + "

To see a page from the A handler click " + "A/A

"); + mg_printf(conn, + "

To see a page from the A/B handler click A/B

"); + mg_printf(conn, + "

To see a page from the B handler (0) click B

"); + mg_printf(conn, + "

To see a page from the B handler (1) click B/A

"); + mg_printf(conn, + "

To see a page from the B handler (2) click B/B

"); + mg_printf(conn, + "

To see a page from the *.foo handler click xy.foo

"); #ifdef USE_WEBSOCKET - mg_printf(conn, "

To test websocket handler click " - "websocket

"); + mg_printf(conn, + "

To test websocket handler click " + "websocket

"); #endif mg_printf(conn, "

To exit click exit

", EXIT_URI); mg_printf(conn, "\n"); @@ -289,6 +296,29 @@ int main(int argc, char *argv[]) struct mg_context *ctx; struct mg_server_ports ports[32]; int port_cnt, n; + int err = 0; + +#ifdef USE_IPV6 + if (!mg_check_feature(8)) { + fprintf(stderr, + "Error: Embedded example built with websocket support, " + "but civetweb library build without.\n"); + err = 1; + } +#endif +#ifdef USE_WEBSOCKET + if (!mg_check_feature(16)) { + fprintf(stderr, + "Error: Embedded example built with websocket support, " + "but civetweb library build without.\n"); + err = 1; + } +#endif + + if (err) { + fprintf(stderr, "Cannot start CivetWeb - inconsistent build.\n"); + return EXIT_FAILURE; + } memset(&callbacks, 0, sizeof(callbacks)); ctx = mg_start(&callbacks, 0, options);