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
d6cbf9f7
Commit
d6cbf9f7
authored
May 19, 2015
by
NickCis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing C coding style mistakes
parent
c06abbc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
array_vars.c
examples/array_vars/array_vars.c
+2
-3
mongoose.c
mongoose.c
+2
-2
No files found.
examples/array_vars/array_vars.c
View file @
d6cbf9f7
// Copyright (c) 2014 Cesanta Software
// All rights reserved
//
// This example demostrates
basic use of Mongoose embedded web server.
// This example demostrates
how to use array get variables using mg_get_n_var
// $Date: 2014-09-09 22:20:23 UTC $
#include <stdio.h>
...
...
@@ -15,8 +15,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
{
mg_printf_data
(
conn
,
"Hello! Requested URI is [%s] "
,
conn
->
uri
);
char
buffer
[
1024
];
int
ret
,
i
;
int
i
,
ret
;
for
(
i
=
0
;
(
ret
=
mg_get_n_var
(
conn
,
"foo[]"
,
buffer
,
1024
,
i
))
>
0
;
i
++
)
mg_printf_data
(
conn
,
"
\n
foo[%d] = %s"
,
i
,
buffer
);
...
...
mongoose.c
View file @
d6cbf9f7
...
...
@@ -5001,7 +5001,7 @@ static int get_var(const char *data, size_t data_len, const char *name,
char
*
dst
,
size_t
dst_len
,
int
n
)
{
const
char
*
p
,
*
e
,
*
s
;
size_t
name_len
;
int
len
;
int
i
,
len
;
if
(
dst
==
NULL
||
dst_len
==
0
)
{
len
=
-
2
;
...
...
@@ -5009,12 +5009,12 @@ static int get_var(const char *data, size_t data_len, const char *name,
len
=
-
1
;
dst
[
0
]
=
'\0'
;
}
else
{
i
=
0
;
name_len
=
strlen
(
name
);
e
=
data
+
data_len
;
len
=
-
1
;
dst
[
0
]
=
'\0'
;
int
i
=
0
;
// data is "var1=val1&var2=val2...". Find variable first
for
(
p
=
data
;
p
+
name_len
<
e
;
p
++
)
{
if
((
p
==
data
||
p
[
-
1
]
==
'&'
)
&&
p
[
name_len
]
==
'='
&&
...
...
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