diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2015-06-16 21:05:31 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2015-06-16 21:05:31 +0200 |
commit | 2700d016843dddd53ff2a86fd39ce9aa2b7e5cd7 (patch) | |
tree | c1b5225198e45288d9e55646c9b9ea87467642df | |
parent | 608a68fba0caee7cb803c034957830d980a870c7 (diff) | |
download | biruda-2700d016843dddd53ff2a86fd39ce9aa2b7e5cd7.tar.gz biruda-2700d016843dddd53ff2a86fd39ce9aa2b7e5cd7.tar.bz2 |
playing with embeddable web frontend
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | TODOS | 4 | ||||
-rw-r--r-- | src/GNUmakefile | 6 | ||||
-rw-r--r-- | src/index.html | 11 | ||||
-rw-r--r-- | src/webserver.c | 5 |
5 files changed, 22 insertions, 5 deletions
@@ -6,3 +6,4 @@ src/3rdParty/xxd/xxd *_cmdline.c *_cmdline.h biruda_conf.c +index.h @@ -31,9 +31,7 @@ more philosophical and in flux: so it can auto-deliver the client side. This means zero-install, which is good. examples: - - https://github.com/davidsblog/rCPU - => high CPU load, so the embedded webserver is not that terribly - efficient + => https://github.com/davidsblog/rCPU => http://smoothiecharts.org/ is really nice though, uses HTML 5 canvas - sort out adressing mess diff --git a/src/GNUmakefile b/src/GNUmakefile index bec27f0..07f5748 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -34,7 +34,7 @@ master.o: master.c master.h port.h coordinator.o: coordinator.c coordinator.h port.h system.h worker.o: worker.c worker.h port.h system.o: system.c system.h -webserver.o: webserver.c webserver.h +webserver.o: webserver.c webserver.h index.h 3rdParty/linenoise/linenoise.o: 3rdParty/linenoise/linenoise.c 3rdParty/linenoise/linenoise.h 3rdParty/http_tiny/http_lib.o: 3rdParty/http_tiny/http_lib.c 3rdParty/http_tiny/http_lib.h cli.o: cli.c cli.h @@ -54,6 +54,9 @@ workertest.o: workertest.c biruda_conf.c: biruda.conf 3rdParty/xxd/xxd 3rdParty/xxd/xxd -i biruda.conf > biruda_conf.c +index.h: index.html 3rdParty/xxd/xxd + 3rdParty/xxd/xxd -i index.html > index.h + clean: @-rm *.o @-rm biruda birudaenv @@ -63,6 +66,7 @@ clean: @-rm 3rdParty/linenoise/*.o @-rm 3rdParty/xxd/xxd @-rm biruda_conf.c + @-rm index.h # default values DESTDIR ?= diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..cd9b586 --- /dev/null +++ b/src/index.html @@ -0,0 +1,11 @@ +<html> + <head> + <title>biruda</title> + </head> + + <body> + <p> + Welcome to biruda! Please state your wish.. + </p> + </body> +</html> diff --git a/src/webserver.c b/src/webserver.c index 81ec523..947f90f 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -12,6 +12,9 @@ #include <microhttpd.h> +/* embedded web pages and JS code */ +#include "index.h" + static struct MHD_Daemon *d; #if MHD_VERSION < 0x00090500 @@ -100,7 +103,7 @@ static int handle_request( void *cls, struct MHD_Connection *connection, } } else { - snprintf( biruda_msg, sizeof( biruda_msg ), "Welcome to biruda! Please state your wish..\n" ); + snprintf( biruda_msg, index_html_len, (char *)index_html ); } response = MHD_create_response_from_buffer( strlen( biruda_msg ), |