Commit a560d850 authored by Zhang Shengju's avatar Zhang Shengju Committed by Stephen Hemminger

iplink: shortify printing the usage of link type

Allow to print link type usage by: ip link help bridge_slave
Signed-off-by: default avatarZhang Shengju <zhangshengju@cmss.chinamobile.com>
parent 43367ef7
......@@ -19,9 +19,9 @@
#include "utils.h"
#include "ip_common.h"
static void explain(void)
static void print_explain(FILE *f)
{
fprintf(stderr,
fprintf(f,
"Usage: ... bridge_slave [ state STATE ] [ priority PRIO ] [cost COST ]\n"
" [ guard {on | off} ]\n"
" [ hairpin {on | off} ] \n"
......@@ -32,6 +32,11 @@ static void explain(void)
);
}
static void explain(void)
{
print_explain(stderr);
}
static const char *port_states[] = {
[BR_STATE_DISABLED] = "disabled",
[BR_STATE_LISTENING] = "listening",
......@@ -172,10 +177,17 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
return 0;
}
static void bridge_slave_print_help(struct link_util *lu, int argc, char **argv,
FILE *f)
{
print_explain(f);
}
struct link_util bridge_slave_link_util = {
.id = "bridge",
.maxattr = IFLA_BRPORT_MAX,
.print_opt = bridge_slave_print_opt,
.parse_opt = bridge_slave_parse_opt,
.print_help = bridge_slave_print_help,
.slave = true,
};
Markdown is supported
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