dcb: Change --Netns/-N to --netns/-n

This to keep compatible with the major tools, ip and tc. Also
document the option in the man page, which was neglected.

Fixes: 67033d1c1c ("Add skeleton of a new tool, dcb")
Signed-off-by: Petr Machata <me@pmachata.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Petr Machata 2021-01-03 11:57:24 +01:00 committed by Stephen Hemminger
parent b4c0cad06e
commit 934919b991
2 changed files with 11 additions and 4 deletions

View File

@ -332,7 +332,7 @@ static void dcb_help(void)
{ {
fprintf(stderr, fprintf(stderr,
"Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n" "Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n"
" dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" " dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname\n"
"where OBJECT := { buffer | ets | maxrate | pfc }\n" "where OBJECT := { buffer | ets | maxrate | pfc }\n"
" OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n"
" | -p | --pretty | -s | --statistics | -v | --verbose]\n"); " | -p | --pretty | -s | --statistics | -v | --verbose]\n");
@ -379,7 +379,7 @@ int main(int argc, char **argv)
{ "json", no_argument, NULL, 'j' }, { "json", no_argument, NULL, 'j' },
{ "pretty", no_argument, NULL, 'p' }, { "pretty", no_argument, NULL, 'p' },
{ "statistics", no_argument, NULL, 's' }, { "statistics", no_argument, NULL, 's' },
{ "Netns", required_argument, NULL, 'N' }, { "netns", required_argument, NULL, 'n' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -396,7 +396,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
while ((opt = getopt_long(argc, argv, "b:fhijpsvN:V", while ((opt = getopt_long(argc, argv, "b:fhijn:psvV",
long_options, NULL)) >= 0) { long_options, NULL)) >= 0) {
switch (opt) { switch (opt) {
@ -419,7 +419,7 @@ int main(int argc, char **argv)
case 's': case 's':
dcb->stats = true; dcb->stats = true;
break; break;
case 'N': case 'n':
if (netns_switch(optarg)) { if (netns_switch(optarg)) {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
goto dcb_free; goto dcb_free;

View File

@ -27,6 +27,13 @@ dcb \- show / manipulate DCB (Data Center Bridging) settings
.SH OPTIONS .SH OPTIONS
.TP
.BR "\-n" , " \--netns " <NETNS>
switches
.B dcb
to the specified network namespace
.IR NETNS .
.TP .TP
.BR "\-V" , " --Version" .BR "\-V" , " --Version"
Print the version of the Print the version of the