summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-16 14:08:36 (GMT)
committerThomas Graf <tgraf@suug.ch>2010-11-16 14:08:36 (GMT)
commita3ea8a603f65b0e86533c4b3e8a25f889f406a91 (patch)
tree0f016c6cc3000a1ef145951385ec11b991668417 /src
parent01bc3c58c23c97f5d1a407a212e7ab3cbd3b6fb7 (diff)
downloadlibnl-a3ea8a603f65b0e86533c4b3e8a25f889f406a91.zip
libnl-a3ea8a603f65b0e86533c4b3e8a25f889f406a91.tar.gz
libnl-a3ea8a603f65b0e86533c4b3e8a25f889f406a91.tar.bz2
Make syntax of nl-link-list consistent and install it
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am5
-rw-r--r--src/nl-link-list.c52
2 files changed, 24 insertions, 33 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 76a541a..64d1cce 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,13 +10,14 @@ sbin_PROGRAMS = \
nl-class-add nl-class-list nl-class-delete \
nl-cls-add nl-cls-list nl-cls-delete \
nl-classid-lookup \
- nl-pktloc-lookup
+ nl-pktloc-lookup \
+ nl-link-list
noinst_PROGRAMS = \
genl-ctrl-list \
nf-ct-list nf-log nf-queue nf-monitor \
nl-addr-add nl-addr-delete nl-addr-list \
- nl-link-list nl-link-set nl-link-stats \
+ nl-link-set nl-link-stats \
nl-link-ifindex2name nl-link-name2ifindex \
nl-neigh-add nl-neigh-delete nl-neigh-list \
nl-rule-list \
diff --git a/src/nl-link-list.c b/src/nl-link-list.c
index b1f75ce..b5c98b4 100644
--- a/src/nl-link-list.c
+++ b/src/nl-link-list.c
@@ -9,40 +9,26 @@
* Copyright (c) 2003-2010 Thomas Graf <tgraf@suug.ch>
*/
-#if 0
-static void print_usage(void)
-{
- printf(
- "Usage: nl-link-dump <mode> [<filter>]\n"
- " mode := { brief | detailed | stats | xml }\n"
- " filter := [dev DEV] [mtu MTU] [txqlen TXQLEN] [weight WEIGHT] [link LINK]\n"
- " [master MASTER] [qdisc QDISC] [addr ADDR] [broadcast BRD]\n"
- " [{ up | down }] [{ arp | noarp }] [{ promisc | nopromisc }]\n"
- " [{ dynamic | nodynamic }] [{ multicast | nomulticast }]\n"
- " [{ trailers | notrailers }] [{ allmulticast | noallmulticast }]\n");
- exit(1);
-}
-#endif
-
#include <netlink/cli/utils.h>
#include <netlink/cli/link.h>
static void print_usage(void)
{
printf(
- "Usage: nl-link-list [OPTION]... [Link]\n"
- "\n"
- "Options\n"
- " -f, --format=TYPE Output format { brief | details | stats }\n"
- " -h, --help Show this help\n"
- " -v, --version Show versioning information\n"
- "\n"
- "Link Options\n"
- " -n, --name=NAME link name\n"
- " -i, --index interface index\n"
- " --mtu=NUM MTU value\n"
- " --txqlen=NUM TX queue length\n"
- " --weight=NUM weight\n"
+"Usage: nl-link-list [OPTIONS]... \n"
+"\n"
+"OPTIONS\n"
+" --details Show detailed information of each link\n"
+" --stats Show statistics, implies --details\n"
+" -h, --help Show this help text.\n"
+" -v, --version Show versioning information.\n"
+"\n"
+" -n, --name=NAME Name of link\n"
+" -i, --index Interface index (unique identifier)\n"
+" --family=NAME Link address family\n"
+" --mtu=NUM MTU value\n"
+" --txqlen=NUM TX queue length\n"
+" --weight=NUM Weight\n"
);
exit(0);
}
@@ -68,9 +54,12 @@ int main(int argc, char *argv[])
ARG_MTU = 258,
ARG_TXQLEN,
ARG_WEIGHT,
+ ARG_DETAILS,
+ ARG_STATS,
};
static struct option long_opts[] = {
- { "format", 1, 0, 'f' },
+ { "details", 0, 0, ARG_DETAILS },
+ { "stats", 0, 0, ARG_STATS },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' },
{ "name", 1, 0, 'n' },
@@ -82,12 +71,13 @@ int main(int argc, char *argv[])
{ 0, 0, 0, 0 }
};
- c = getopt_long(argc, argv, "f:hvn:i:", long_opts, &optidx);
+ c = getopt_long(argc, argv, "hvn:i:", long_opts, &optidx);
if (c == -1)
break;
switch (c) {
- case 'f': params.dp_type = nl_cli_parse_dumptype(optarg); break;
+ case ARG_DETAILS: params.dp_type = NL_DUMP_DETAILS; break;
+ case ARG_STATS: params.dp_type = NL_DUMP_STATS; break;
case 'h': print_usage(); break;
case 'v': nl_cli_print_version(); break;
case 'n': nl_cli_link_parse_name(link, optarg); break;