Commit 70154f6c authored by Sergey Lyubka's avatar Sergey Lyubka

Moved mod_lua.c to src/lua.c

parent d3577b78
......@@ -21,13 +21,13 @@
PROG = mongoose
EXE_SUFFIX =
CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread -pipe -I.. $(CFLAGS_EXTRA)
CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread -pipe -I. -I.. $(CFLAGS_EXTRA)
VERSION = $(shell perl -lne \
'print $$1 if /define\s+MONGOOSE_VERSION\s+"(\S+)"/' ../mongoose.c)
# The order in which files are listed is important
SOURCES = src/internal.h src/string.c src/parse_date.c src/options.c \
src/crypto.c src/auth.c src/mongoose.c
src/crypto.c src/auth.c src/mongoose.c src/lua.c
TINY_SOURCES = ../mongoose.c main.c
LUA_SOURCES = $(TINY_SOURCES) sqlite3.c lsqlite3.c lua_5.2.1.c
......@@ -60,7 +60,7 @@ endif
all:
@echo "make (unix|windows|macos)"
../mongoose.c: mod_lua.c ../mongoose.h Makefile $(SOURCES)
../mongoose.c: ../mongoose.h Makefile $(SOURCES)
cat $(SOURCES) | sed '/#include "internal.h"/d' > $@
unix_unit_test: $(LUA_SOURCES) Makefile ../test/unit_test.c
......
......@@ -460,3 +460,9 @@ struct de {
static FILE *mg_fopen(const char *path, const char *mode);
static int mg_stat(const char *path, struct file *filep);
#ifdef USE_LUA
#include "lua_5.2.1.h"
static int handle_lsp_request(struct mg_connection *, const char *,
struct file *, struct lua_State *);
#endif
#include "lua_5.2.1.h"
#include "internal.h"
#ifdef USE_LUA
#ifdef _WIN32
static void *mmap(void *addr, int64_t len, int prot, int flags, int fd,
int offset) {
......@@ -20,7 +21,6 @@ static void *mmap(void *addr, int64_t len, int prot, int flags, int fd,
static const char *LUASOCKET = "luasocket";
// Forward declarations
static void handle_request(struct mg_connection *);
static int handle_lsp_request(struct mg_connection *, const char *,
struct file *, struct lua_State *);
......@@ -387,3 +387,4 @@ static int handle_lsp_request(struct mg_connection *conn, const char *path,
return error;
}
#endif // USE_LUA
......@@ -2842,10 +2842,6 @@ static uint32_t get_remote_ip(const struct mg_connection *conn) {
return ntohl(* (uint32_t *) &conn->client.rsa.sin.sin_addr);
}
#ifdef USE_LUA
#include "build/mod_lua.c"
#endif // USE_LUA
FILE *mg_upload(struct mg_connection *conn, const char *destination_dir,
char *path, int path_len) {
const char *content_type_header, *boundary_start;
......
This diff is collapsed.
......@@ -222,7 +222,7 @@ static int event_handler(struct mg_event *event) {
if (!strcmp(ri->uri, "/upload")) {
test_upload(event->conn, "lua_5.2.1.h", "./f1.txt");
test_upload(event->conn, "mod_lua.c", "./f2.txt");
test_upload(event->conn, "lsqlite3.c", "./f2.txt");
ASSERT(mg_upload(event->conn, ".", NULL, 0) == NULL);
mg_printf(event->conn, "HTTP/1.0 200 OK\r\n"
......@@ -330,7 +330,7 @@ static void test_mg_upload(void) {
// Upload two files
ASSERT((file_data = read_file("lua_5.2.1.h", &file_len)) != NULL);
ASSERT((file2_data = read_file("mod_lua.c", &file2_len)) != NULL);
ASSERT((file2_data = read_file("lsqlite3.c", &file2_len)) != NULL);
post_data = NULL;
post_data_len = alloc_printf(&post_data, 0,
// First file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment