Skip to content
Snippets Groups Projects
Commit a4644ed6 authored by Ondřej Zajíček's avatar Ondřej Zajíček
Browse files

Implement option to exit after config file parsing.

parent 3f9b7bfe
No related merge requests found
...@@ -129,7 +129,10 @@ options. The most important ones are: ...@@ -129,7 +129,10 @@ options. The most important ones are:
enable debug messages and run bird in foreground. enable debug messages and run bird in foreground.
<tag>-D <m/filename of debug log/</tag> <tag>-D <m/filename of debug log/</tag>
log debugging information to given file instead of stderr log debugging information to given file instead of stderr.
<tag>-p</tag>
just parse the config file and exit.
<tag>-s <m/name of communication socket/</tag> <tag>-s <m/name of communication socket/</tag>
use given filename for a socket for communications with the client, default is <it/prefix/<file>/var/run/bird.ctl</file>. use given filename for a socket for communications with the client, default is <it/prefix/<file>/var/run/bird.ctl</file>.
......
...@@ -365,7 +365,7 @@ signal_init(void) ...@@ -365,7 +365,7 @@ signal_init(void)
* Parsing of command-line arguments * Parsing of command-line arguments
*/ */
static char *opt_list = "c:dD:s:"; static char *opt_list = "c:dD:ps:";
static void static void
usage(void) usage(void)
...@@ -374,6 +374,8 @@ usage(void) ...@@ -374,6 +374,8 @@ usage(void)
exit(1); exit(1);
} }
int parse_and_exit;
static void static void
parse_args(int argc, char **argv) parse_args(int argc, char **argv)
{ {
...@@ -402,6 +404,9 @@ parse_args(int argc, char **argv) ...@@ -402,6 +404,9 @@ parse_args(int argc, char **argv)
log_init_debug(optarg); log_init_debug(optarg);
debug_flag |= 2; debug_flag |= 2;
break; break;
case 'p':
parse_and_exit = 1;
break;
case 's': case 's':
path_control_socket = optarg; path_control_socket = optarg;
break; break;
...@@ -444,6 +449,9 @@ main(int argc, char **argv) ...@@ -444,6 +449,9 @@ main(int argc, char **argv)
read_config(); read_config();
if (parse_and_exit)
exit(0);
if (!debug_flag) if (!debug_flag)
{ {
pid_t pid = fork(); pid_t pid = fork();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment