diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-08-07 19:27:54 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-08-07 19:27:54 +0000 |
commit | a295786986ca9c87e61e068c4d5be7f6d46558ff (patch) | |
tree | 79cbf52a9fe03c877e6db13ffd0760179a1d49c2 /channels | |
parent | 34d1b5a68bc3e3f1e2c2748c69f24acbe02f90f7 (diff) |
Fix a couple minor command line completion issues
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3593 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_zap.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index a5b0f2bb3..e97620ed0 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -7790,10 +7790,12 @@ static int start_pri(struct zt_pri *pri) 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 @@ static char *complete_span(char *line, char *word, int pos, int state) 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 @@ static char pri_show_span_help[] = " 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 */ |