diff options
author | Thomas Graf <tgraf@suug.ch> | 2009-12-16 16:20:46 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2009-12-16 16:20:46 +0100 |
commit | 8808743839b0f459394ecd00cb0f7c1896c0ab7a (patch) | |
tree | a3ab1da0c8bb02390662891bcb92e2130662b5d7 /src/nl-neigh-add.c | |
parent | ff76549013c31082d303b3feef755bbd35e13ec6 (diff) | |
download | libnl-8808743839b0f459394ecd00cb0f7c1896c0ab7a.tar.gz |
CLI - Command Line Interface Library
Moved common code in src/ used by CLI tools to src/lib/ for possible use
by other CLI tools. Just link to libnl-cli.{so|la}
Diffstat (limited to 'src/nl-neigh-add.c')
-rw-r--r-- | src/nl-neigh-add.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/nl-neigh-add.c b/src/nl-neigh-add.c index 1c73e24..4cddabe 100644 --- a/src/nl-neigh-add.c +++ b/src/nl-neigh-add.c @@ -6,10 +6,12 @@ * License as published by the Free Software Foundation version 2.1 * of the License. * - * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch> + * Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch> */ -#include "neigh-utils.h" +#include <netlink/cli/utils.h> +#include <netlink/cli/neigh.h> +#include <netlink/cli/link.h> static int quiet = 0; @@ -50,10 +52,10 @@ int main(int argc, char *argv[]) }; int err, ok = 0, nlflags = NLM_F_REPLACE | NLM_F_CREATE; - sock = nlt_alloc_socket(); - nlt_connect(sock, NETLINK_ROUTE); - link_cache = nlt_alloc_link_cache(sock); - neigh = nlt_alloc_neigh(); + sock = nl_cli_alloc_socket(); + nl_cli_connect(sock, NETLINK_ROUTE); + link_cache = nl_cli_link_alloc_cache(sock); + neigh = nl_cli_neigh_alloc(); for (;;) { int c, optidx = 0; @@ -84,11 +86,11 @@ int main(int argc, char *argv[]) case ARG_CREATE_ONLY: nlflags |= NLM_F_EXCL; break; case 'q': quiet = 1; break; case 'h': print_usage(); break; - case 'v': nlt_print_version(); break; - case 'a': ok++; parse_dst(neigh, optarg); break; - case 'l': parse_lladdr(neigh, optarg); break; - case 'd': parse_dev(neigh, link_cache, optarg); break; - case ARG_STATE: parse_state(neigh, optarg); break; + case 'v': nl_cli_print_version(); break; + case 'a': ok++; nl_cli_neigh_parse_dst(neigh, optarg); break; + case 'l': nl_cli_neigh_parse_lladdr(neigh, optarg); break; + case 'd': nl_cli_neigh_parse_dev(neigh, link_cache, optarg); break; + case ARG_STATE: nl_cli_neigh_parse_state(neigh, optarg); break; } } @@ -96,7 +98,8 @@ int main(int argc, char *argv[]) print_usage(); if ((err = rtnl_neigh_add(sock, neigh, nlflags)) < 0) - fatal(err, "Unable to add neighbour: %s", nl_geterror(err)); + nl_cli_fatal(err, "Unable to add neighbour: %s", + nl_geterror(err)); if (!quiet) { printf("Added "); |