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-qdisc-delete.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-qdisc-delete.c')
-rw-r--r-- | src/nl-qdisc-delete.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/nl-qdisc-delete.c b/src/nl-qdisc-delete.c index e0c82a27..5cb7aa35 100644 --- a/src/nl-qdisc-delete.c +++ b/src/nl-qdisc-delete.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 "qdisc-utils.h" +#include <netlink/cli/utils.h> +#include <netlink/cli/qdisc.h> +#include <netlink/cli/link.h> static int quiet = 0, default_yes = 0, deleted = 0, interactive = 0; struct nl_sock *sock; @@ -45,11 +47,11 @@ static void delete_cb(struct nl_object *obj, void *arg) }; int err; - if (interactive && !nlt_confirm(obj, ¶ms, default_yes)) + if (interactive && !nl_cli_confirm(obj, ¶ms, default_yes)) return; if ((err = rtnl_qdisc_delete(sock, qdisc)) < 0) - fatal(err, "Unable to delete qdisc: %s\n", nl_geterror(err)); + nl_cli_fatal(err, "Unable to delete qdisc: %s\n", nl_geterror(err)); if (!quiet) { printf("Deleted "); @@ -64,11 +66,11 @@ int main(int argc, char *argv[]) struct rtnl_qdisc *qdisc; struct nl_cache *link_cache, *qdisc_cache; - sock = nlt_alloc_socket(); - nlt_connect(sock, NETLINK_ROUTE); - link_cache = nlt_alloc_link_cache(sock); - qdisc_cache = nlt_alloc_qdisc_cache(sock); - qdisc = nlt_alloc_qdisc(); + sock = nl_cli_alloc_socket(); + nl_cli_connect(sock, NETLINK_ROUTE); + link_cache = nl_cli_link_alloc_cache(sock); + qdisc_cache = nl_cli_qdisc_alloc_cache(sock); + qdisc = nl_cli_qdisc_alloc(); for (;;) { int c, optidx = 0; @@ -97,11 +99,11 @@ int main(int argc, char *argv[]) case ARG_YES: default_yes = 1; break; case 'q': quiet = 1; break; case 'h': print_usage(); break; - case 'v': nlt_print_version(); break; - case 'd': parse_dev(qdisc, link_cache, optarg); break; - case 'p': parse_parent(qdisc, optarg); break; - case 'H': parse_handle(qdisc, optarg); break; - case 'k': parse_kind(qdisc, optarg); break; + case 'v': nl_cli_print_version(); break; + case 'd': nl_cli_qdisc_parse_dev(qdisc, link_cache, optarg); break; + case 'p': nl_cli_qdisc_parse_parent(qdisc, optarg); break; + case 'H': nl_cli_qdisc_parse_handle(qdisc, optarg); break; + case 'k': nl_cli_qdisc_parse_kind(qdisc, optarg); break; } } |