Signed-off-by: Anders Roxell <anders.rox...@linaro.org> --- example/webserver/httpd.c | 7 ++++--- scripts/start_webserver.sh | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/example/webserver/httpd.c b/example/webserver/httpd.c index d4e37fa..98753a4 100644 --- a/example/webserver/httpd.c +++ b/example/webserver/httpd.c @@ -14,9 +14,6 @@ void httpd_main(uint32_t addr); int sigreceived = 0; static uint32_t myaddr; -/* Set www_dir to point to your web directory. */ -static const char *www_dir = "/home/hjokinen/Dropbox/kolumbus-web"; - /* Table of concurrent connections */ #define NUM_CONNECTIONS 16 static struct { @@ -62,6 +59,8 @@ static int sendf(int fd, const char *fmt, ...) /* Send one file. */ static void get_file(int s, char *url) { + /* Set www_dir to point to your web directory. */ + char *www_dir = NULL; char bufo[512]; int n, w; @@ -88,6 +87,8 @@ static void get_file(int s, char *url) else if (!strcmp(p2, "js")) mime = "text/javascript"; } + www_dir = getenv("www_dir"); + snprintf(bufo, sizeof(bufo), "%s/%s", www_dir, p); FILE *f = fopen(bufo, "rb"); diff --git a/scripts/start_webserver.sh b/scripts/start_webserver.sh index ac9b66d..ced4ac1 100755 --- a/scripts/start_webserver.sh +++ b/scripts/start_webserver.sh @@ -7,6 +7,8 @@ fi intf=$1 echo Starting Web Server on interface $intf +www_dir="${www_dir:-"/var/www/"}" +export www_dir ./example/webserver/webserver -i $intf -c 2 & sleep 1 -- 2.1.4 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp