mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Main: Improve BIRD help messages
This commit is contained in:
parent
6273fcf072
commit
292f7858e6
@ -617,7 +617,7 @@ signal_init(void)
|
||||
* Parsing of command-line arguments
|
||||
*/
|
||||
|
||||
static char *opt_list = "c:dD:ps:P:u:g:flR";
|
||||
static char *opt_list = "c:dD:ps:P:u:g:flRh";
|
||||
static int parse_and_exit;
|
||||
char *bird_name;
|
||||
static char *use_user;
|
||||
@ -625,10 +625,43 @@ static char *use_group;
|
||||
static int run_in_foreground = 0;
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
display_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] [-l] [-R]\n", bird_name);
|
||||
exit(1);
|
||||
fprintf(stderr, "Usage: %s [--version] [--help] [-c <config-file>] [OPTIONS]\n", bird_name);
|
||||
}
|
||||
|
||||
static void
|
||||
display_help(void)
|
||||
{
|
||||
display_usage();
|
||||
|
||||
fprintf(stderr,
|
||||
"\n"
|
||||
"Options: \n"
|
||||
" -c <config-file> Use given configuration file instead\n"
|
||||
" of prefix/etc/bird.conf\n"
|
||||
" -d Enable debug messages and run bird in foreground\n"
|
||||
" -D <debug-file> Log debug messages to given file instead of stderr\n"
|
||||
" -f Run bird in foreground\n"
|
||||
" -g <group> Use given group ID\n"
|
||||
" -h, --help Display this information\n"
|
||||
" -l Look for a configuration file and a communication socket\n"
|
||||
" file in the current working directory\n"
|
||||
" -p Test configuration file and exit without start\n"
|
||||
" -P <pid-file> Create a PID file with given filename\n"
|
||||
" -R Apply graceful restart recovery after start\n"
|
||||
" -s <control-socket> Use given filename for a control socket\n"
|
||||
" -u <user> Drop privileges and use given user ID\n"
|
||||
" --version Display version of BIRD\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
display_version(void)
|
||||
{
|
||||
fprintf(stderr, "BIRD version " BIRD_VERSION "\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
@ -702,12 +735,9 @@ parse_args(int argc, char **argv)
|
||||
if (argc == 2)
|
||||
{
|
||||
if (!strcmp(argv[1], "--version"))
|
||||
{
|
||||
fprintf(stderr, "BIRD version " BIRD_VERSION "\n");
|
||||
exit(0);
|
||||
}
|
||||
display_version();
|
||||
if (!strcmp(argv[1], "--help"))
|
||||
usage();
|
||||
display_help();
|
||||
}
|
||||
while ((c = getopt(argc, argv, opt_list)) >= 0)
|
||||
switch (c)
|
||||
@ -751,11 +781,19 @@ parse_args(int argc, char **argv)
|
||||
case 'R':
|
||||
graceful_restart_recovery();
|
||||
break;
|
||||
case 'h':
|
||||
display_help();
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
fputc('\n', stderr);
|
||||
display_usage();
|
||||
exit(1);
|
||||
}
|
||||
if (optind < argc)
|
||||
usage();
|
||||
{
|
||||
display_usage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user