Skip to content
Snippets Groups Projects
Commit f372faf6 authored by Sergey Lyubka's avatar Sergey Lyubka
Browse files

Moved hello.c example to its own dir

parent 882f3b3a
No related branches found
No related tags found
No related merge requests found
# Copyright (c) 2014 Cesanta Software
# All rights reserved
PROG = hello_world
CFLAGS = -W -Wall -I../.. $(CFLAGS_EXTRA)
SOURCES = $(PROG).c ../../mongoose.c
all: $(PROG)
./$(PROG)
$(PROG): $(SOURCES) Makefile
$(CC) -o $(PROG) $(SOURCES) $(CFLAGS)
win:
wine cl $(SOURCES) /MD /nologo /DNDEBUG /O1 /I../.. /Fe$(PROG).exe
wine $(PROG).exe
clean:
rm -rf $(PROG) *.exe *.dSYM *.obj *.exp .*o *.lib *.gc*
...@@ -3,16 +3,13 @@ ...@@ -3,16 +3,13 @@
#include "mongoose.h" #include "mongoose.h"
static int ev_handler(struct mg_connection *conn, enum mg_event ev) { static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
int result = MG_FALSE; switch (ev) {
case MG_AUTH: return MG_TRUE;
if (ev == MG_REQUEST) { case MG_REQUEST:
mg_printf_data(conn, "Hello! Requested URI is [%s]", conn->uri); mg_printf_data(conn, "Hello! Requested URI is [%s]", conn->uri);
result = MG_TRUE; return MG_TRUE;
} else if (ev == MG_AUTH) { default: return MG_FALSE;
result = MG_TRUE;
} }
return result;
} }
int main(void) { int main(void) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment