mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-19 19:40:56 +00:00
Moved hello.c example to its own dir
This commit is contained in:
1 parent
882f3b3ac3
commit
f372faf614
2 files changed
+25
-9
No files matched your search
@@ -0,0 +1,19 @@
|
|||||||
|
# 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 @@
|
|||||||
#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) {
|
||||||
Reference in new issue
Block a user