aboutsummaryrefslogtreecommitdiffstats
path: root/config.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-11 20:09:45 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-11 20:09:45 +0000
commit201849f9224ef840d3701ae6e92f3b71ab63f47b (patch)
treebb6f591206d4f084be79aa7a13122fde495ccbed /config.c
parent721ff08a5ddc15f8b7605a34005aabaf9034155e (diff)
Version 0.1.1 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@134 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'config.c')
-rwxr-xr-xconfig.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/config.c b/config.c
index 58a2741f4..3d81ebda7 100755
--- a/config.c
+++ b/config.c
@@ -3,7 +3,7 @@
*
* Configuration File Parser
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
@@ -95,11 +95,25 @@ struct ast_variable *ast_variable_browse(struct ast_config *config, char *catego
char *ast_variable_retrieve(struct ast_config *config, char *category, char *value)
{
struct ast_variable *v;
- v = ast_variable_browse(config, category);
- while (v) {
- if (!strcasecmp(value, v->name))
- return v->value;
- v=v->next;
+ if (category) {
+ v = ast_variable_browse(config, category);
+ while (v) {
+ if (!strcasecmp(value, v->name))
+ return v->value;
+ v=v->next;
+ }
+ } else {
+ struct ast_category *cat;
+ cat = config->root;
+ while(cat) {
+ v = cat->root;
+ while (v) {
+ if (!strcasecmp(value, v->name))
+ return v->value;
+ v=v->next;
+ }
+ cat = cat->next;
+ }
}
return NULL;
}