use app arg parsing macros (issue #5678)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2005-11-30 20:15:36 +00:00
parent db755f9035
commit 0d341e060f

View File

@@ -70,8 +70,12 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
int res=-1, inuse=-1, option_state=0, priority_jump=0; int res=-1, inuse=-1, option_state=0, priority_jump=0;
int status; int status;
struct localuser *u; struct localuser *u;
char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur, *options, *stringp; char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur;
struct ast_channel *tempchan; struct ast_channel *tempchan;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(reqchans);
AST_APP_ARG(options);
);
if (ast_strlen_zero(data)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ChanIsAvail requires an argument (Zap/1&Zap/2)\n"); ast_log(LOG_WARNING, "ChanIsAvail requires an argument (Zap/1&Zap/2)\n");
@@ -81,16 +85,16 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);
info = ast_strdupa(data); info = ast_strdupa(data);
stringp = info;
strsep(&stringp, "|"); AST_STANDARD_APP_ARGS(args, info);
options = strsep(&stringp, "|");
if (options) { if (args.options) {
if (strchr(options, 's')) if (strchr(args.options, 's'))
option_state = 1; option_state = 1;
if (strchr(options, 'j')) if (strchr(args.options, 'j'))
priority_jump = 1; priority_jump = 1;
} }
peers = info; peers = args.reqchans;
if (peers) { if (peers) {
cur = peers; cur = peers;
do { do {