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
fcb49d75
Commit
fcb49d75
authored
Sep 07, 2010
by
valenok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
got rid of getcwd(). using __cdecl for signal handler.
parent
1ceafea1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
main.c
main.c
+9
-7
No files found.
main.c
View file @
fcb49d75
...
...
@@ -45,10 +45,12 @@
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define sleep(x) Sleep((x) * 1000)
#define WINCDECL __cdecl
#else
#include <sys/wait.h>
#include <unistd.h>
#define DIRSEP '/'
#define WINCDECL
#endif // _WIN32
#define MAX_OPTIONS 40
...
...
@@ -62,7 +64,7 @@ static struct mg_context *ctx;
#define CONFIG_FILE "mongoose.conf"
#endif
/* !CONFIG_FILE */
static
void
signal_handler
(
int
sig_num
)
{
static
void
WINCDECL
signal_handler
(
int
sig_num
)
{
#if !defined(_WIN32)
if
(
sig_num
==
SIGCHLD
)
{
do
{
...
...
@@ -177,7 +179,7 @@ static void set_option(char **options, const char *name, const char *value) {
static
void
process_command_line_arguments
(
char
*
argv
[],
char
**
options
)
{
const
char
*
config_file
=
NULL
;
char
line
[
512
],
opt
[
512
],
val
[
512
],
path
[
PATH_MAX
];
char
line
[
512
],
opt
[
512
],
val
[
512
],
path
[
PATH_MAX
]
,
*
p
;
FILE
*
fp
=
NULL
;
struct
stat
st
;
size_t
i
,
line_no
=
0
;
...
...
@@ -185,12 +187,12 @@ static void process_command_line_arguments(char *argv[], char **options) {
/* Should we use a config file ? */
if
(
argv
[
1
]
!=
NULL
&&
argv
[
2
]
==
NULL
)
{
config_file
=
argv
[
1
];
}
else
if
(
argv
[
1
]
==
NULL
)
{
}
else
if
(
argv
[
1
]
==
NULL
&&
(
p
=
strchr
(
argv
[
0
],
DIRSEP
))
==
NULL
)
{
// No command line flags specified. Look where binary lives
// TODO(lsm): do proper error handling here
getcwd
(
path
,
sizeof
(
path
));
snprintf
(
path
+
strlen
(
path
),
sizeof
(
path
)
-
strlen
(
path
),
"
%c%s"
,
DIRSEP
,
CONFIG_FILE
);
config_file
=
CONFIG_FILE
;
}
else
if
(
argv
[
1
]
==
NULL
)
{
snprintf
(
path
,
sizeof
(
path
),
"%.*s
%c%s"
,
(
int
)
(
p
-
argv
[
0
]),
argv
[
0
],
DIRSEP
,
CONFIG_FILE
);
if
(
stat
(
path
,
&
st
)
==
0
)
{
config_file
=
path
;
}
...
...
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