164{
165 char *parse, ds[2], *var_expr;
166 size_t delim_consumed;
172 );
173
175
177
178
181 }
183
184
185 snprintf(var_expr, strlen(
args.varname) + 4,
"${%s}",
args.varname);
188
189
192 }
193 ds[1] = '\0';
194
196 int curfieldnum = 1;
198 int out_field_count = 0;
199
201 char *next_range =
strsep(&(
args.field),
"&");
202 int start_field, stop_field;
203 char trashchar;
204
205 if (sscanf(next_range, "%30d-%30d", &start_field, &stop_field) == 2) {
206
207 } else if (sscanf(next_range, "-%30d", &stop_field) == 1) {
208
209 start_field = 1;
210 } else if ((sscanf(next_range, "%30d%1c", &start_field, &trashchar) == 2) && (trashchar == '-')) {
211
212 stop_field = INT_MAX;
213 } else if (sscanf(next_range, "%30d", &start_field) == 1) {
214
215 stop_field = start_field;
216 } else {
217
220 }
221
222
223 while (curfieldptr !=
NULL && curfieldnum < start_field) {
225 curfieldnum++;
226 }
227
228
229 if (curfieldnum > start_field) {
231 }
232
233
234 while (curfieldptr !=
NULL && curfieldnum <= stop_field) {
235 char *field_value =
strsep(&curfieldptr, ds);
237 curfieldnum++;
238 }
239 }
240 }
242 return 0;
243}
char * strsep(char **str, const char *delims)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define AST_APP_ARG(name)
Define an application argument.
int ast_get_encoded_char(const char *stream, char *result, size_t *consumed)
Decode an encoded control or extended ASCII character.
#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.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
size_t attribute_pure ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.