ip: Make uniform the use of synonyms list, show and lst
Subsystems (2)
PATCH 1/2 ip: Make uniform the use of synonyms list, show and lst
Where used in the ip tool, the 'show' option always has the synonyms 'list' and 'lst', except for ip-token and ip-addrlabel, which are missing 'lst'. Add this as a synonym for these commands.
--- ip/ipaddrlabel.c | 1 + ip/iptoken.c | 1 + 2 files changed, 2 insertions(+)
ip/ipaddrlabel.c +1 -0
@@ -248,6 +248,7 @@ int do_ipaddrlabel(int argc, char **argv)if (argc <1 ) {return ipaddrlabel_list (0 ,NULL ); }else if (matches (argv[0 ],"list" ) ==0 || +matches (argv[0 ],"lst" ) ==0 ||matches (argv[0 ],"show" ) ==0 ) {return ipaddrlabel_list (argc-1 , argv+1 ); }else if (matches (argv[0 ],"add" ) ==0 ) {
ip/iptoken.c +1 -0
@@ -195,6 +195,7 @@ int do_iptoken(int argc, char **argv)if (argc <1 ) {return iptoken_list (0 ,NULL ); }else if (matches (argv[0 ],"list" ) ==0 || +matches (argv[0 ],"lst" ) ==0 ||matches (argv[0 ],"show" ) ==0 ) {return iptoken_list (argc -1 , argv +1 ); } else if (matches(argv[0], "set") == 0 ||
Signature · 1 line
2.1.4
PATCH 2/2 ip: Harmonise usage references to show / list option
The majority of ip commands that implement show / list options reference only the 'show' option in usage notes. Some others reference only 'list', while ip-tuntap references both. Additionally, ip-addrlabel and ip-rule reference 'list' in usage notes while having an error message that references 'show', which is confusing.
Harmonise all these references to be the current majority choice of 'show'.
Prefer alphabetical listing of options where changes are made.
--- ip/ipaddrlabel.c | 2 +- ip/ipnetns.c | 2 +- ip/iproute.c | 2 +- ip/iprule.c | 2 +- ip/iptoken.c | 2 +- ip/iptuntap.c | 2 +- ip/xfrm_policy.c | 2 +- ip/xfrm_state.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
ip/ipaddrlabel.c +1 -1
@@ -49,7 +49,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip addrlabel [ list | add | del | flush ] prefix PREFIX [ dev DEV ] [ label LABEL ]\n" ); +fprintf (stderr,"Usage: ip addrlabel [ add | del | flush | show ] prefix PREFIX [ dev DEV ] [ label LABEL ]\n" );exit (-1 ); }
ip/ipnetns.c +1 -1
@@ -23,7 +23,7 @@static int usage (void ) { -fprintf (stderr,"Usage: ip netns list\n" ); +fprintf (stderr,"Usage: ip netns show\n" );fprintf (stderr," ip netns add NAME\n" );fprintf (stderr," ip netns set NAME NETNSID\n" );fprintf (stderr," ip [-all] netns delete [NAME]\n" );
ip/iproute.c +1 -1
@@ -59,7 +59,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip route { list | flush } SELECTOR\n" ); +fprintf (stderr,"Usage: ip route { flush | show } SELECTOR\n" );fprintf (stderr," ip route save SELECTOR\n" );fprintf (stderr," ip route restore\n" );fprintf (stderr," ip route showdump\n" );
ip/iprule.c +1 -1
@@ -32,7 +32,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip rule [ list | add | del | flush ] SELECTOR ACTION\n" ); +fprintf (stderr,"Usage: ip rule [ add | del | flush | show ] SELECTOR ACTION\n" );fprintf (stderr,"SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ]\n" );fprintf (stderr," [ iif STRING ] [ oif STRING ] [ pref NUMBER ]\n" );fprintf (stderr,"ACTION := [ table TABLE_ID ]\n" );
ip/iptoken.c +1 -1
@@ -38,7 +38,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip token [ list | set | get ] [ TOKEN ] [ dev DEV ]\n" ); +fprintf (stderr,"Usage: ip token [ get | set | show ] [ TOKEN ] [ dev DEV ]\n" );exit (-1 ); }
ip/iptuntap.c +1 -1
@@ -36,7 +36,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip tuntap { add | del | show | list | lst | help } [ dev PHYS_DEV ] \n" ); +fprintf (stderr,"Usage: ip tuntap { add | del | show | help } [ dev PHYS_DEV ] \n" );fprintf (stderr," [ mode { tun | tap } ] [ user USER ] [ group GROUP ]\n" );fprintf (stderr," [ one_queue ] [ pi ] [ vnet_hdr ] [ multi_queue ]\n" );fprintf (stderr,"\n" );
ip/xfrm_policy.c +1 -1
@@ -59,7 +59,7 @@ static void usage(void)fprintf (stderr," [ LIMIT-LIST ] [ TMPL-LIST ]\n" );fprintf (stderr,"Usage: ip xfrm policy { delete | get } { SELECTOR | index INDEX } dir DIR\n" );fprintf (stderr," [ ctx CTX ] [ mark MARK [ mask MASK ] ] [ ptype PTYPE ]\n" ); -fprintf (stderr,"Usage: ip xfrm policy { deleteall | list } [ SELECTOR ] [ dir DIR ]\n" ); +fprintf (stderr,"Usage: ip xfrm policy { deleteall | show } [ SELECTOR ] [ dir DIR ]\n" );fprintf (stderr," [ index INDEX ] [ ptype PTYPE ] [ action ACTION ] [ priority PRIORITY ]\n" );fprintf (stderr," [ flag FLAG-LIST ]\n" );fprintf (stderr,"Usage: ip xfrm policy flush [ ptype PTYPE ]\n" );
ip/xfrm_state.c +1 -1
@@ -64,7 +64,7 @@ static void usage(void)fprintf (stderr,"Usage: ip xfrm state allocspi ID [ mode MODE ] [ mark MARK [ mask MASK ] ]\n" );fprintf (stderr," [ reqid REQID ] [ seq SEQ ] [ min SPI max SPI ]\n" );fprintf (stderr,"Usage: ip xfrm state { delete | get } ID [ mark MARK [ mask MASK ] ]\n" ); -fprintf (stderr,"Usage: ip xfrm state { deleteall | list } [ ID ] [ mode MODE ] [ reqid REQID ]\n" ); +fprintf (stderr,"Usage: ip xfrm state { deleteall | show } [ ID ] [ mode MODE ] [ reqid REQID ]\n" );fprintf (stderr," [ flag FLAG-LIST ]\n" );fprintf (stderr,"Usage: ip xfrm state flush [ proto XFRM-PROTO ]\n" );fprintf (stderr,"Usage: ip xfrm state count\n" );
Signature · 1 line
2.1.4
Re: [PATCH iproute2 2/2] ip: Harmonise usage references to show / list option
ip/iproute.c static void usage(void) __attribute__((noreturn)); · line 62
Quoted 9 lines · On Mon, 16 Mar 2015 09:59:10 +0000 Mark Einon <[email protected]> wrote:
ip/iproute.c +0
-1@@ -59,7 +59,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip route { list | flush } SELECTOR\n" );
Sorry, this sounds like a good idea until I went and checked what is shown on the man pages.
The ip route man page has:
ip route { list | flush } SELECTOR
For me, it is more important that the usage match the man page, rather than having all usage messages match.
Re: [PATCH iproute2 2/2] ip: Harmonise usage references to show / list option
Quoted 16 lines · Stephen Hemminger
ip/iproute.c static void usage(void) __attribute__((noreturn)); · line 62
Quoted 9 lines · On Mon, 16 Mar 2015 09:59:10 +0000 Mark Einon <[email protected]> wrote:
ip/iproute.c +0
-1@@ -59,7 +59,7 @@ static void usage(void) __attribute__((noreturn));static void usage (void ) { -fprintf (stderr,"Usage: ip route { list | flush } SELECTOR\n" );Sorry, this sounds like a good idea until I went and checked what is shown on the man pages.
Quoted 6 lines
The ip route man page has:
ip route { list | flush } SELECTOR
For me, it is more important that the usage match the man page, rather than having all usage messages match.
Thanks for the review Stephen. So, I'm assuming that a set of patches with corresponding man page fixes would be acceptable? I was going to look at those next anyway, time permitting.
Mark
Stephen Hemminger
AppliedQuoted 5 lines · On Mon, 16 Mar 2015 09:59:09 +0000 Mark Einon <[email protected]> wrote:
Where used in the ip tool, the 'show' option always has the synonyms 'list' and 'lst', except for ip-token and ip-addrlabel, which are missing 'lst'. Add this as a synonym for these commands.
Signed-off-by Mark Einon <[email protected]>
Applied