Make channel variables inheritable by _ (bug #928)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4141 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-11-01 02:23:28 +00:00
parent a872c59003
commit 668001f9c8
4 changed files with 99 additions and 54 deletions

View File

@@ -69,6 +69,25 @@ void ast_var_delete(struct ast_var_t *var)
}
char *ast_var_name(struct ast_var_t *var)
{
char *name;
if (var == NULL)
return NULL;
if (var->name == NULL)
return NULL;
/* Return the name without the initial underscores */
if ((strlen(var->name) > 0) && (var->name[0] == '_')) {
if ((strlen(var->name) > 1) && (var->name[1] == '_'))
name = (char*)&(var->name[2]);
else
name = (char*)&(var->name[1]);
} else
name = var->name;
return name;
}
char *ast_var_full_name(struct ast_var_t *var)
{
return (var != NULL ? var->name : NULL);
}