Message ID | 20210814184727.2405108-2-gokulkumar792@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | bridge: fixes regarding the colorized output | expand |
On 8/14/21 12:47 PM, Gokul Sivakumar wrote: > As per the man/man8/bridge.8 page, the shorthand cmd line arg "-c" can be > used to colorize the bridge cmd output. But while parsing the args in while > loop, matches() detects "-c" as "-compressedvlans" instead of "-color", so > fix this by doing the check for "-color" option first before checking for > "-compressedvlans". > > Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com> > --- > bridge/bridge.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bridge/bridge.c b/bridge/bridge.c > index f7bfe0b5..48b0e7f8 100644 > --- a/bridge/bridge.c > +++ b/bridge/bridge.c > @@ -149,9 +149,9 @@ main(int argc, char **argv) > NEXT_ARG(); > if (netns_switch(argv[1])) > exit(-1); > + } else if (matches_color(opt, &color)) { > } else if (matches(opt, "-compressvlans") == 0) { > ++compress_vlans; > - } else if (matches_color(opt, &color)) { > } else if (matches(opt, "-force") == 0) { > ++force; > } else if (matches(opt, "-json") == 0) { > Another example of why matches needs to be deprecated. Re-assigned the set to Stephen for main tree.
On Tue, 2021-08-17 at 09:11 -0600, David Ahern wrote: > On 8/14/21 12:47 PM, Gokul Sivakumar wrote: > > As per the man/man8/bridge.8 page, the shorthand cmd line arg "-c" can be > > used to colorize the bridge cmd output. But while parsing the args in while > > loop, matches() detects "-c" as "-compressedvlans" instead of "-color", so > > fix this by doing the check for "-color" option first before checking for > > "-compressedvlans". > > > > Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com> > > --- > > bridge/bridge.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/bridge/bridge.c b/bridge/bridge.c > > index f7bfe0b5..48b0e7f8 100644 > > --- a/bridge/bridge.c > > +++ b/bridge/bridge.c > > @@ -149,9 +149,9 @@ main(int argc, char **argv) > > NEXT_ARG(); > > if (netns_switch(argv[1])) > > exit(-1); > > + } else if (matches_color(opt, &color)) { > > } else if (matches(opt, "-compressvlans") == 0) { > > ++compress_vlans; > > - } else if (matches_color(opt, &color)) { > > } else if (matches(opt, "-force") == 0) { > > ++force; > > } else if (matches(opt, "-json") == 0) { > > > > Another example of why matches needs to be deprecated. > > Re-assigned the set to Stephen for main tree. Thanks, i will send a v3 patchset with the subject prefix "PATCH iproute2" instead of "PATCH iproute2-next" after addressing Stephen's recent suggestion to remove the unnecessary is_json_context() condition checks from patch 2/3. Gokul
diff --git a/bridge/bridge.c b/bridge/bridge.c index f7bfe0b5..48b0e7f8 100644 --- a/bridge/bridge.c +++ b/bridge/bridge.c @@ -149,9 +149,9 @@ main(int argc, char **argv) NEXT_ARG(); if (netns_switch(argv[1])) exit(-1); + } else if (matches_color(opt, &color)) { } else if (matches(opt, "-compressvlans") == 0) { ++compress_vlans; - } else if (matches_color(opt, &color)) { } else if (matches(opt, "-force") == 0) { ++force; } else if (matches(opt, "-json") == 0) {
As per the man/man8/bridge.8 page, the shorthand cmd line arg "-c" can be used to colorize the bridge cmd output. But while parsing the args in while loop, matches() detects "-c" as "-compressedvlans" instead of "-color", so fix this by doing the check for "-color" option first before checking for "-compressedvlans". Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com> --- bridge/bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)