78{
81 char *parse;
83 int index = 0;
86 int ix = 0;
92 );
93
96 return -1;
97 }
98
101
104 return -1;
105 }
106
109 return -1;
110 }
111
114 return -1;
115 }
116
118 if (!sscanf(
args.index,
"%d", &index)) {
120 return -1;
121 }
122 }
123
125 return -1;
126 }
127
129
132 if (!strcmp(cur->filename,
args.filename)) {
133 break;
134 }
135 }
136
137 if (!cur) {
138
141 if (!(cur =
ast_calloc(1,
sizeof(*cur) + strlen(
args.filename) + 1))) {
143 return -1;
144 }
145
146 strcpy(cur->filename,
args.filename);
147
152 return -1;
153 }
154
155 cur->cfg = cfg;
157 }
158
159 cfg = cur->cfg;
160 } else {
161
164 if (!strcmp(cur->filename,
args.filename)) {
165 break;
166 }
167 }
168
169 if (!cur) {
170 if (!(cur =
ast_calloc(1,
sizeof(*cur) + strlen(
args.filename) + 1))) {
172 return -1;
173 }
174
175 strcpy(cur->filename,
args.filename);
176 cur->cfg = cfg;
177
179 } else {
181 cur->cfg = cfg;
182 }
183 }
184
186 if (strcasecmp(
args.variable,
var->name)) {
187 continue;
188 }
190 if (index == -1) {
191 continue;
192 }
193 if (ix == index) {
194 break;
195 }
197 ix++;
198 }
199
200 if (!found) {
201 ast_debug(1,
"'%s' not found at index %d in [%s] of '%s'. Maximum index found: %d\n",
202 args.variable, index,
args.category,
args.filename, ix);
204 return -1;
205 }
206
208
209
211
212 return 0;
213}
#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.
@ CONFIG_FLAG_FILEUNCHANGED
#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.
#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)