sf_parse_daemon_mode_and_action: set default action to start
parent
9e0f2dda7b
commit
638c5b16a3
|
|
@ -83,8 +83,8 @@ void sf_usage(const char *program)
|
||||||
"[start | stop | restart]\n", program);
|
"[start | stop | restart]\n", program);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sf_parse_daemon_mode_and_action(int argc, char *argv[],
|
void sf_parse_daemon_mode_and_action_ex(int argc, char *argv[],
|
||||||
bool *daemon_mode, char **action)
|
bool *daemon_mode, char **action, const char *default_action)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ void sf_parse_daemon_mode_and_action(int argc, char *argv[],
|
||||||
if (argc - (*daemon_mode ? 0 : 1) > 2) {
|
if (argc - (*daemon_mode ? 0 : 1) > 2) {
|
||||||
*action = argv[argc - 1];
|
*action = argv[argc - 1];
|
||||||
} else {
|
} else {
|
||||||
*action = NULL;
|
*action = (char *)default_action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ __FILE__, eln, eres, emsg, strerror(eres))
|
||||||
|
|
||||||
#define dszoffset(cls, mem) ((char*)&((cls*)0)->mem - ((char*)0))
|
#define dszoffset(cls, mem) ((char*)&((cls*)0)->mem - ((char*)0))
|
||||||
|
|
||||||
|
#define sf_parse_daemon_mode_and_action(argc, argv, daemon_mode, action) \
|
||||||
|
sf_parse_daemon_mode_and_action_ex(argc, argv, daemon_mode, action, "start")
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -53,8 +56,8 @@ int sf_printbuffer(char* buffer,int32_t len);
|
||||||
|
|
||||||
void sf_usage(const char *program);
|
void sf_usage(const char *program);
|
||||||
|
|
||||||
void sf_parse_daemon_mode_and_action(int argc, char *argv[],
|
void sf_parse_daemon_mode_and_action_ex(int argc, char *argv[],
|
||||||
bool *daemon_mode, char **action);
|
bool *daemon_mode, char **action, const char *default_action);
|
||||||
|
|
||||||
int sf_logger_init(LogContext *pContext, const char *filename_prefix);
|
int sf_logger_init(LogContext *pContext, const char *filename_prefix);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue