[PATCH 1/5] bts/vty: Use new vty_install_default() function, adjust prompts

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
Fri Feb 21 14:09:11 UTC 2014


This patch removes the local 'end' and 'exit' implementations (which
aren't used anyway) and uses the generic ones provided by libosmocore
instead, which are enabled automatically when vty_install_default()
is used.

The prompt strings are modified to match those in
libosmocore/openbsc.

Ticket: OW#952
Sponsored-by: On-Waves ehf
---
 src/common/vty.c |   39 ++++-----------------------------------
 1 file changed, 4 insertions(+), 35 deletions(-)

diff --git a/src/common/vty.c b/src/common/vty.c
index 5eddc8d..d818f3f 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -71,37 +71,6 @@ int bts_vty_is_config_node(struct vty *vty, int node)
 	}
 }
 
-gDEFUN(ournode_exit, ournode_exit_cmd, "exit",
-	"Exit current node, go down to provious node")
-{
-	switch (vty->node) {
-	case TRX_NODE:
-		vty->node = BTS_NODE;
-		{
-			struct gsm_bts_trx *trx = vty->index;
-			vty->index = trx->bts;
-		}
-		break;
-	default:
-		break;
-	}
-	return CMD_SUCCESS;
-}
-
-gDEFUN(ournode_end, ournode_end_cmd, "end",
-	"End current mode and change to enable mode")
-{
-	switch (vty->node) {
-	default:
-		vty_config_unlock(vty);
-		vty->node = ENABLE_NODE;
-		vty->index = NULL;
-		vty->index_sub = NULL;
-		break;
-	}
-	return CMD_SUCCESS;
-}
-
 static const char osmobts_copyright[] =
 	"Copyright (C) 2010, 2011 by Harald Welte, Andreas Eversberg and On-Waves\r\n"
 	"License AGPLv3+: GNU AGPL version 3 or later <http://gnu.org/licenses/agpl-3.0.html>\r\n"
@@ -140,13 +109,13 @@ struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
 
 static struct cmd_node bts_node = {
 	BTS_NODE,
-	"%s(bts)#",
+	"%s(config-bts)# ",
 	1,
 };
 
 static struct cmd_node trx_node = {
 	TRX_NODE,
-	"%s(trx)#",
+	"%s(config-bts-trx)# ",
 	1,
 };
 
@@ -509,7 +478,7 @@ int bts_vty_init(const struct log_info *cat)
 
 	install_node(&bts_node, config_write_bts);
 	install_element(CONFIG_NODE, &cfg_bts_cmd);
-	install_default(BTS_NODE);
+	vty_install_default(BTS_NODE);
 	install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
 	install_element(BTS_NODE, &cfg_bts_oml_ip_cmd);
 	install_element(BTS_NODE, &cfg_bts_rtp_bind_ip_cmd);
@@ -523,7 +492,7 @@ int bts_vty_init(const struct log_info *cat)
 	/* add and link to TRX config node */
 	install_element(BTS_NODE, &cfg_bts_trx_cmd);
 	install_node(&trx_node, config_write_dummy);
-	install_default(TRX_NODE);
+	vty_install_default(TRX_NODE);
 
 	install_element(ENABLE_NODE, &bts_t_t_l_jitter_buf_cmd);
 
-- 
1.7.9.5





More information about the OpenBSC mailing list