summaryrefslogtreecommitdiff
path: root/sysdep/unix/main.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-05-13 13:48:04 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-05-13 13:48:04 +0200
commit5af7b59660be615fbbd7c20b92b71321c003c43a (patch)
tree59bc962b18ae5a4ac6bf088863cfe210c9123b57 /sysdep/unix/main.c
parentd39d41fbda2ec86ea2bac27308eb4fb16ecc4702 (diff)
parentb66a9e2f3376b4cb07ef4cc318f70a9c794f407a (diff)
Merge branch 'int-new' of gitlab.labs.nic.cz:labs/bird into int-new
Diffstat (limited to 'sysdep/unix/main.c')
-rw-r--r--sysdep/unix/main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 691fee2d..1f47680e 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -621,7 +621,7 @@ signal_init(void)
* Parsing of command-line arguments
*/
-static char *opt_list = "c:dD:ps:P:u:g:fR";
+static char *opt_list = "c:dD:ps:P:u:g:flR";
static int parse_and_exit;
char *bird_name;
static char *use_user;
@@ -631,7 +631,7 @@ static int run_in_foreground = 0;
static void
usage(void)
{
- fprintf(stderr, "Usage: %s [-c <config-file>] [-d] [-D <debug-file>] [-p] [-s <control-socket>] [-P <pid-file>] [-u <user>] [-g <group>] [-f] [-R]\n", bird_name);
+ fprintf(stderr, "Usage: %s [-c <config-file>] [-d] [-D <debug-file>] [-p] [-s <control-socket>] [-P <pid-file>] [-u <user>] [-g <group>] [-f] [-l] [-R]\n", bird_name);
exit(1);
}
@@ -681,7 +681,7 @@ get_gid(const char *s)
if (!s)
return 0;
-
+
errno = 0;
rv = strtol(s, &endptr, 10);
@@ -698,6 +698,8 @@ get_gid(const char *s)
static void
parse_args(int argc, char **argv)
{
+ int config_changed = 0;
+ int socket_changed = 0;
int c;
bird_name = get_bird_name(argv[0], "bird");
@@ -716,6 +718,7 @@ parse_args(int argc, char **argv)
{
case 'c':
config_name = optarg;
+ config_changed = 1;
break;
case 'd':
debug_flag |= 1;
@@ -729,6 +732,7 @@ parse_args(int argc, char **argv)
break;
case 's':
path_control_socket = optarg;
+ socket_changed = 1;
break;
case 'P':
pid_file = optarg;
@@ -742,6 +746,12 @@ parse_args(int argc, char **argv)
case 'f':
run_in_foreground = 1;
break;
+ case 'l':
+ if (!config_changed)
+ config_name = xbasename(config_name);
+ if (!socket_changed)
+ path_control_socket = xbasename(path_control_socket);
+ break;
case 'R':
graceful_restart_recovery();
break;