Skip to content

Commit

Permalink
add --syslog option
Browse files Browse the repository at this point in the history
  • Loading branch information
荒野無燈 authored and liudf0716 committed Jun 12, 2017
1 parent ec56f27 commit c0116c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion commandline.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static struct option long_options[] = {
{ "nc", required_argument, NULL, GETOPT_VAL_NC},
{ "sockbuf", required_argument, NULL, GETOPT_VAL_SOCKBUF},
{ "keepalive", required_argument, NULL, GETOPT_VAL_KEEPALIVE},
{ "syslog", no_argument, NULL, GETOPT_VAL_SYSLOG},
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
{ "version", no_argument, NULL, GETOPT_VAL_VERSION},
{ NULL, 0, NULL, 0 }
Expand All @@ -73,7 +74,8 @@ usage(const char *appname)
fprintf(stdout, " -f Run in foreground\n");
fprintf(stdout, " -h --help Print usage\n");
fprintf(stdout, " -v --version Print version information\n");
fprintf(stdout, " -d <level> Debug level\n\n");
fprintf(stdout, " -d <level> Debug level\n");
fprintf(stdout, " --syslog Log to syslog\n\n");

fprintf(stdout, " -i <interface> Interface to use (default br-lan)\n");
fprintf(stdout, " -l <port> Port number of your local server (default: 9088)\n");
Expand Down Expand Up @@ -215,6 +217,11 @@ parse_commandline(int argc, char **argv)
param->keepalive = atoi(optarg);
break;

case GETOPT_VAL_SYSLOG:
debugconf.log_syslog = 1;
debugconf.log_stderr = 0;
break;

case GETOPT_VAL_VERSION:
case 'v':
fprintf(stdout, "This is %s version " VERSION "\n", argv[0]);
Expand Down
1 change: 1 addition & 0 deletions commandline.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ enum {
GETOPT_VAL_RESEND,
GETOPT_VAL_SOCKBUF,
GETOPT_VAL_KEEPALIVE,
GETOPT_VAL_SYSLOG,
GETOPT_VAL_HELP,
GETOPT_VAL_VERSION
};
Expand Down

0 comments on commit c0116c5

Please sign in to comment.