75{
78 char *parse;
80 int index = 0;
83 int ix = 0;
89 );
90
93 return -1;
94 }
95
98
101 return -1;
102 }
103
106 return -1;
107 }
108
111 return -1;
112 }
113
115 if (!sscanf(
args.index,
"%d", &index)) {
117 return -1;
118 }
119 }
120
122 return -1;
123 }
124
126
129 if (!strcmp(cur->filename,
args.filename)) {
130 break;
131 }
132 }
133
134 if (!cur) {
135
138 if (!(cur =
ast_calloc(1,
sizeof(*cur) + strlen(
args.filename) + 1))) {
140 return -1;
141 }
142
143 strcpy(cur->filename,
args.filename);
144
149 return -1;
150 }
151
152 cur->cfg = cfg;
154 }
155
156 cfg = cur->cfg;
157 } else {
158
161 if (!strcmp(cur->filename,
args.filename)) {
162 break;
163 }
164 }
165
166 if (!cur) {
167 if (!(cur =
ast_calloc(1,
sizeof(*cur) + strlen(
args.filename) + 1))) {
169 return -1;
170 }
171
172 strcpy(cur->filename,
args.filename);
173 cur->cfg = cfg;
174
176 } else {
178 cur->cfg = cfg;
179 }
180 }
181
183 if (strcasecmp(
args.variable,
var->name)) {
184 continue;
185 }
187 if (index == -1) {
188 continue;
189 }
190 if (ix == index) {
191 break;
192 }
194 ix++;
195 }
196
197 if (!found) {
198 ast_debug(1,
"'%s' not found at index %d in [%s] of '%s'. Maximum index found: %d\n",
199 args.variable, index,
args.category,
args.filename, ix);
201 return -1;
202 }
203
205
206
208
209 return 0;
210}
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_config_load(filename, flags)
Load a config file.
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
struct ast_variable * ast_category_root(struct ast_config *config, char *cat)
returns the root ast_variable of a config
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
@ CONFIG_FLAG_FILEUNCHANGED
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_RWLIST_TRAVERSE
#define AST_RWLIST_INSERT_TAIL
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure used to handle boolean flags.
Structure for variables, used for configurations and for channel variables.
#define ast_clear_flag(p, flag)