Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
9bd2812f
Commit
9bd2812f
authored
Jun 17, 2011
by
valenok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added examples/hello.c - a minimalistic embedding example
parent
377cece9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
Makefile
examples/Makefile
+2
-3
hello.c
examples/hello.c
+28
-0
No files found.
examples/Makefile
View file @
9bd2812f
PROG
=
chat
CFLAGS
=
-W
-Wall
-I
..
-pthread
-g
all
:
OS
=
`
uname
`
;
\
test
"
$$
OS"
=
Linux
&&
LIBS
=
"-ldl"
;
\
$(CC)
$(CFLAGS)
chat.c ../mongoose.c
$$
LIBS
$(ADD)
-o
$(PROG)
./
$(PROG)
$(CC)
$(CFLAGS)
hello.c ../mongoose.c
$$
LIBS
$(ADD)
-o
hello
;
$(CC)
$(CFLAGS)
chat.c ../mongoose.c
$$
LIBS
$(ADD)
-o
chat
examples/hello.c
0 → 100644
View file @
9bd2812f
#include <stdio.h>
#include <string.h>
#include "mongoose.h"
static
void
*
callback
(
enum
mg_event
event
,
struct
mg_connection
*
conn
,
const
struct
mg_request_info
*
request_info
)
{
if
(
event
==
MG_NEW_REQUEST
)
{
// Echo requested URI back to the client
mg_printf
(
conn
,
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: text/plain
\r\n\r\n
"
"%s"
,
request_info
->
uri
);
return
""
;
// Mark as processed
}
else
{
return
NULL
;
}
}
int
main
(
void
)
{
struct
mg_context
*
ctx
;
const
char
*
options
[]
=
{
"listening_ports"
,
"8080"
,
NULL
};
ctx
=
mg_start
(
&
callback
,
NULL
,
options
);
getchar
();
// Wait until user hits "enter"
mg_stop
(
ctx
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment