[Asterisk-cvs] asterisk/channels chan_zap.c,1.319,1.320

markster at lists.digium.com markster at lists.digium.com
Sat Aug 7 15:41:55 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv1037/channels

Modified Files:
	chan_zap.c 
Log Message:
Fix a couple minor command line completion issues


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.319
retrieving revision 1.320
diff -u -d -r1.319 -r1.320
--- chan_zap.c	1 Aug 2004 02:39:32 -0000	1.319
+++ chan_zap.c	7 Aug 2004 19:27:54 -0000	1.320
@@ -7790,10 +7790,12 @@
 	return 0;
 }
 
-static char *complete_span(char *line, char *word, int pos, int state)
+static char *complete_span_helper(char *line, char *word, int pos, int state, int rpos)
 {
 	int span=1;
 	char tmp[50];
+	if (pos != rpos)
+		return 0;
 	while(span <= NUM_SPANS) {
 		if (span > state && pris[span-1].pri)
 			break;
@@ -7806,6 +7808,16 @@
 		return NULL;
 }
 
+static char *complete_span_4(char *line, char *word, int pos, int state)
+{
+	return complete_span_helper(line,word,pos,state,3);
+}
+
+static char *complete_span_5(char *line, char *word, int pos, int state)
+{
+	return complete_span_helper(line,word,pos,state,4);
+}
+
 static int handle_pri_debug(int fd, int argc, char *argv[])
 {
 	int span;
@@ -7944,16 +7956,16 @@
 	"       Displays PRI Information\n";
 
 static struct ast_cli_entry pri_debug = {
-	{ "pri", "debug", "span", NULL }, handle_pri_debug, "Enables PRI debugging on a span", pri_debug_help, complete_span };
+	{ "pri", "debug", "span", NULL }, handle_pri_debug, "Enables PRI debugging on a span", pri_debug_help, complete_span_4 };
 
 static struct ast_cli_entry pri_no_debug = {
-	{ "pri", "no", "debug", "span", NULL }, handle_pri_no_debug, "Disables PRI debugging on a span", pri_no_debug_help, complete_span };
+	{ "pri", "no", "debug", "span", NULL }, handle_pri_no_debug, "Disables PRI debugging on a span", pri_no_debug_help, complete_span_5 };
 
 static struct ast_cli_entry pri_really_debug = {
-	{ "pri", "intense", "debug", "span", NULL }, handle_pri_really_debug, "Enables REALLY INTENSE PRI debugging", pri_really_debug_help, complete_span };
+	{ "pri", "intense", "debug", "span", NULL }, handle_pri_really_debug, "Enables REALLY INTENSE PRI debugging", pri_really_debug_help, complete_span_5 };
 
 static struct ast_cli_entry pri_show_span = {
-	{ "pri", "show", "span", NULL }, handle_pri_show_span, "Displays PRI Information", pri_show_span_help, complete_span };
+	{ "pri", "show", "span", NULL }, handle_pri_show_span, "Displays PRI Information", pri_show_span_help, complete_span_4 };
 
 #endif /* ZAPATA_PRI */
 




More information about the svn-commits mailing list