[asterisk-commits] dhubbard: branch dhubbard/named_processors r109715 - /team/dhubbard/named_pro...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 18 16:03:46 CDT 2008


Author: dhubbard
Date: Tue Mar 18 16:03:45 2008
New Revision: 109715

URL: http://svn.digium.com/view/asterisk?view=rev&rev=109715
Log:
taskprocessor ping tab completion.  W00t bkruse, thanks for the patch

Modified:
    team/dhubbard/named_processors/main/taskprocessor.c

Modified: team/dhubbard/named_processors/main/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/team/dhubbard/named_processors/main/taskprocessor.c?view=diff&rev=109715&r1=109714&r2=109715
==============================================================================
--- team/dhubbard/named_processors/main/taskprocessor.c (original)
+++ team/dhubbard/named_processors/main/taskprocessor.c Tue Mar 18 16:03:45 2008
@@ -192,12 +192,30 @@
 	return 0;
 }
 
+static char *complete_taskprocessor_ping(struct taskprocessor_singleton_info *p, struct ast_cli_args *a) {
+	int tklen;
+	int wordnum = 0;
+
+	if(a->pos != 2)
+		return NULL;
+
+	tklen = strlen(a->word);
+	AST_LIST_LOCK(&_taskprocessor_singletons);
+	AST_LIST_TRAVERSE(&_taskprocessor_singletons, p, list) {
+		if (!strncasecmp(a->word, p->_name, tklen) && ++wordnum > a->n) {
+			return ast_strdup(p->_name);
+		break;
+		}
+	}
+	AST_LIST_UNLOCK(&_taskprocessor_singletons);
+	return NULL;
+}
 
 static char *cli_taskprocessor_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	int found = 0;
 	struct a_task* t = NULL;
-	struct taskprocessor_singleton_info* p = NULL;
+	struct taskprocessor_singleton_info *p = NULL;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -207,7 +225,7 @@
 			"	Displays the time required for a processor to deliver a task\n";
 		return NULL;
 	case CLI_GENERATE:
-		return NULL;	
+		return complete_taskprocessor_ping(p, a);
 	}
 
 	if (a->argc != 3)




More information about the asterisk-commits mailing list