[asterisk-commits] trunk r15857 - in /trunk/channels: chan_iax2.c
chan_oss.c iax2-provision.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Mar 28 16:33:04 MST 2006
Author: rizzo
Date: Tue Mar 28 17:33:02 2006
New Revision: 15857
URL: http://svn.digium.com/view/asterisk?rev=15857&view=rev
Log:
another batch of cli simplifications
Modified:
trunk/channels/chan_iax2.c
trunk/channels/chan_oss.c
trunk/channels/iax2-provision.c
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=15857&r1=15856&r2=15857&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue Mar 28 17:33:02 2006
@@ -2116,11 +2116,9 @@
if (pos == 3) {
ast_mutex_lock(&peerl.lock);
for (p = peerl.peers ; p ; p = p->next) {
- if (!strncasecmp(p->name, word, wordlen)) {
- if (++which > state) {
- res = ast_strdup(p->name);
- break;
- }
+ if (!strncasecmp(p->name, word, wordlen) && ++which > state) {
+ res = ast_strdup(p->name);
+ break;
}
}
ast_mutex_unlock(&peerl.lock);
Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?rev=15857&r1=15856&r2=15857&view=diff
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Tue Mar 28 17:33:02 2006
@@ -1035,19 +1035,9 @@
static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
{
- int l = strlen(word);
-
- switch(state) {
- case 0:
- if (l && !strncasecmp(word, "on", MIN(l, 2)))
- return ast_strdup("on");
- case 1:
- if (l && !strncasecmp(word, "off", MIN(l, 3)))
- return ast_strdup("off");
- default:
- return NULL;
- }
- return NULL;
+ static char *choices[] = { "on", "off", NULL };
+
+ return (pos != 1) ? NULL : ast_cli_complete(word, choices, state);
}
static char autoanswer_usage[] =
Modified: trunk/channels/iax2-provision.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/iax2-provision.c?rev=15857&r1=15856&r2=15857&view=diff
==============================================================================
--- trunk/channels/iax2-provision.c (original)
+++ trunk/channels/iax2-provision.c Tue Mar 28 17:33:02 2006
@@ -164,11 +164,9 @@
ast_mutex_lock(&provlock);
for (c = templates; c; c = c->next) {
- if (!strncasecmp(word, c->name, wordlen)) {
- if (++which > state) {
- ret = strdup(c->name);
- break;
- }
+ if (!strncasecmp(word, c->name, wordlen) && ++which > state) {
+ ret = strdup(c->name);
+ break;
}
}
ast_mutex_unlock(&provlock);
More information about the asterisk-commits
mailing list