summaryrefslogtreecommitdiffstats
path: root/src/vty/command.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther2010-08-26 08:37:10 +0200
committerHolger Hans Peter Freyther2010-08-26 09:00:52 +0200
commit3e85e8dba9d039d6d5b4dd48d636535c92966d90 (patch)
tree2332311046888a0a25962e58c9ccb86648dd20f1 /src/vty/command.c
parentvty: Add a new callback to let code decide if it is a config node or not (diff)
downloadlibosmocore-3e85e8dba9d039d6d5b4dd48d636535c92966d90.tar.gz
libosmocore-3e85e8dba9d039d6d5b4dd48d636535c92966d90.tar.xz
libosmocore-3e85e8dba9d039d6d5b4dd48d636535c92966d90.zip
vty: Handle nodes part of the lib in the lib, for the rest call the callback
Diffstat (limited to 'src/vty/command.c')
-rw-r--r--src/vty/command.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/vty/command.c b/src/vty/command.c
index 6a52321..c55e164 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -141,12 +141,14 @@ static int cmp_desc(const void *p, const void *q)
static int is_config(struct vty *vty)
{
- /* ask the application */
- if (host.app_info->is_config_node)
+ if (vty->node < CONFIG_NODE)
+ return 0;
+ else if (vty->node >= CONFIG_NODE && vty->node < _LAST_OSMOVTY_NODE)
+ return 1;
+ else if (host.app_info->is_config_node)
return host.app_info->is_config_node(vty, vty->node);
-
- /* Assume that everything above CONFIG_NODE is a config node */
- return vty->node > CONFIG_NODE;
+ else
+ return vty->node > CONFIG_NODE;
}
/* Sort each node's command element according to command string. */