From 318e830463596dca396d2a99add7100926c1eb78 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 22 Feb 2011 15:52:08 +0100 Subject: vty: Always work through the linkset number for the commands --- src/vty_interface.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/src/vty_interface.c b/src/vty_interface.c index 3bf2b15..244fd0a 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -410,26 +410,14 @@ DEFUN(show_msc, show_msc_cmd, return CMD_SUCCESS; } -static struct mtp_link_set *find_link_set(struct llist_head *head, - const char *name) -{ - struct mtp_link_set *set; - - llist_for_each_entry(set, head, entry) - if (strcmp(name, set->name) == 0) - return set; - - return NULL; -} - DEFUN(show_slc, show_slc_cmd, - "show link-set NAME slc", - SHOW_STR "LinkSet\n" "Linkset name\n" "SLS to SLC\n") + "show link-set <0-100> slc", + SHOW_STR "LinkSet\n" "Linkset nr\n" "SLS to SLC\n") { struct mtp_link_set *set = NULL; int i; - set = find_link_set(&bsc->linksets, argv[0]); + set = mtp_link_set_num(bsc, atoi(argv[0])); if (!set) { vty_out(vty, "Failed to find linkset.%s", VTY_NEWLINE); @@ -450,13 +438,13 @@ DEFUN(show_slc, show_slc_cmd, } DEFUN(pcap_set, pcap_set_cmd, - "trace-pcap set NAME FILE", - "Trace to a PCAP file\n" "Trace a linkset\n" + "trace-pcap <0-100> NAME FILE", + "Trace to a PCAP file\n" "Linkset nr.\n" "Trace Linkset\n" "Filename to trace\n") { struct mtp_link_set *set = NULL; - set = find_link_set(&bsc->linksets, argv[0]); + set = mtp_link_set_num(bsc, atoi(argv[0])); if (!set) { vty_out(vty, "Failed to find linkset.%s", VTY_NEWLINE); @@ -478,13 +466,13 @@ DEFUN(pcap_set, pcap_set_cmd, } DEFUN(pcap_set_stop, pcap_set_stop_cmd, - "trace-pcap set NAME stop", - "Trace to a PCAP file\n" "Trace a linkset\n" + "trace-pcap <0-100> NAME stop", + "Trace to a PCAP file\n" "Linkset nr\n" "Trace Linkset\n" "Stop the tracing\n") { struct mtp_link_set *set = NULL; - set = find_link_set(&bsc->linksets, argv[0]); + set = mtp_link_set_num(bsc, atoi(argv[0])); if (!set) { vty_out(vty, "Failed to find linkset.%s", VTY_NEWLINE); -- cgit v1.2.3