Merged revisions 89586 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89586 | kpfleming | 2007-11-26 11:20:36 -0600 (Mon, 26 Nov 2007) | 2 lines

when parsing application options that take arguments, don't indicate that the option was supplied unless a non-zero-length argument was found for it

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89588 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Kevin P. Fleming 18 years ago
parent 2ec4b57622
commit 721b3c8a0e

@ -124,7 +124,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
if (args.options) { if (args.options) {
ast_app_parse_options(cpb_opts, &opts, opt_args, args.options); ast_app_parse_options(cpb_opts, &opts, opt_args, args.options);
if (ast_test_flag(&opts, OPT_OFFSET) && !ast_strlen_zero(opt_args[OPT_ARG_OFFSET])) if (ast_test_flag(&opts, OPT_OFFSET))
offsetms = atol(opt_args[OPT_ARG_OFFSET]); offsetms = atol(opt_args[OPT_ARG_OFFSET]);
} }

@ -1608,7 +1608,6 @@ int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags
s = optstr; s = optstr;
while (*s) { while (*s) {
curarg = *s++ & 0x7f; /* the array (in app.h) has 128 entries */ curarg = *s++ & 0x7f; /* the array (in app.h) has 128 entries */
ast_set_flag(flags, options[curarg].flag);
argloc = options[curarg].arg_index; argloc = options[curarg].arg_index;
if (*s == '(') { if (*s == '(') {
/* Has argument */ /* Has argument */
@ -1625,6 +1624,8 @@ int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags
} else if (argloc) { } else if (argloc) {
args[argloc - 1] = NULL; args[argloc - 1] = NULL;
} }
if (!argloc || !ast_strlen_zero(args[argloc - 1]))
ast_set_flag(flags, options[curarg].flag);
} }
return res; return res;

Loading…
Cancel
Save