[PATCH 1/3] vty: Use new vty_install_default() function

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Mon Nov 11 13:13:12 UTC 2013


This patch removes the local 'end' and 'exit' implementations and
uses the generic ones provided by libosmocore instead, which are
enabled automatically when vty_install_default() is used.
---
 src/e1_input_vty.c |    2 ++
 src/ipa_proxy.c    |   26 +-------------------------
 2 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index b6e1438..faaebd8 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -276,6 +276,8 @@ int e1inp_vty_init(void)
 {
 	install_element(CONFIG_NODE, &cfg_e1inp_cmd);
 	install_node(&e1inp_node, e1inp_config_write);
+
+	vty_install_default(L_E1INP_NODE);
 	install_element(L_E1INP_NODE, &cfg_e1_line_driver_cmd);
 	install_element(L_E1INP_NODE, &cfg_e1_line_port_cmd);
 	install_element(L_E1INP_NODE, &cfg_e1_line_name_cmd);
diff --git a/src/ipa_proxy.c b/src/ipa_proxy.c
index 74cf427..a394b8c 100644
--- a/src/ipa_proxy.c
+++ b/src/ipa_proxy.c
@@ -644,28 +644,6 @@ static int ipa_cfg_write(struct vty *vty)
 	return CMD_SUCCESS;
 }
 
-DEFUN(ournode_exit,
-      ournode_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
-{
-        switch (vty->node) {
-        case L_IPA_NODE:
-                vty->node = CONFIG_NODE;
-                vty->index = NULL;
-                break;
-	}
-	return CMD_SUCCESS;
-}
-
-DEFUN(ournode_end,
-      ournode_end_cmd, "end", "End current mode and change to enable mode.\n")
-{
-	switch (vty->node) {
-	case L_IPA_NODE:
-		break;
-	}
-	return CMD_SUCCESS;
-}
-
 void ipa_proxy_vty_init(void)
 {
 	tall_ipa_proxy_ctx =
@@ -681,9 +659,7 @@ void ipa_proxy_vty_init(void)
 
 	install_element(CONFIG_NODE, &ipa_cfg_cmd);
 	install_node(&ipa_node, ipa_cfg_write);
-	install_default(L_IPA_NODE);
-	install_element(L_IPA_NODE, &ournode_exit_cmd);
-	install_element(L_IPA_NODE, &ournode_end_cmd);
+	vty_install_default(L_IPA_NODE);
 	install_element(L_IPA_NODE, &ipa_instance_cfg_add_cmd);
 	install_element(L_IPA_NODE, &ipa_route_cfg_add_cmd);
 }
-- 
1.7.9.5





More information about the OpenBSC mailing list