[Asterisk-cvs] asterisk/channels chan_zap.c,1.455,1.456

kpfleming at lists.digium.com kpfleming at lists.digium.com
Thu Jun 2 23:21:35 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv5362/channels

Modified Files:
	chan_zap.c 
Log Message:
use ast_cli_register_multiple() for chan_zap CLI commands


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.455
retrieving revision 1.456
diff -u -d -r1.455 -r1.456
--- chan_zap.c	2 Jun 2005 17:16:49 -0000	1.455
+++ chan_zap.c	3 Jun 2005 03:24:37 -0000	1.456
@@ -8974,27 +8974,22 @@
 	"Usage: pri show span <span>\n"
 	"       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_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_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_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_4 };
-
-static struct ast_cli_entry pri_show_debug= {
-	{ "pri", "show", "debug", NULL }, handle_pri_show_debug, "Displays current PRI debug settings", NULL, NULL };
-
-static struct ast_cli_entry pri_set_debug_file = {
-	{ "pri", "set", "debug", "file", NULL }, handle_pri_set_debug_file, "Sends PRI debug output to the specified file", NULL, NULL };
-
-static struct ast_cli_entry pri_unset_debug_file = {
-	{ "pri", "unset", "debug", "file", NULL }, handle_pri_set_debug_file, "Ends PRI debug output to file", NULL, NULL };
-
+static struct ast_cli_entry zap_pri_cli[] = {
+	{ { "pri", "debug", "span", NULL }, handle_pri_debug,
+	  "Enables PRI debugging on a span", pri_debug_help, complete_span_4 },
+	{ { "pri", "no", "debug", "span", NULL }, handle_pri_no_debug,
+	  "Disables PRI debugging on a span", pri_no_debug_help, complete_span_5 },
+	{ { "pri", "intense", "debug", "span", NULL }, handle_pri_really_debug,
+	  "Enables REALLY INTENSE PRI debugging", pri_really_debug_help, complete_span_5 },
+	{ { "pri", "show", "span", NULL }, handle_pri_show_span,
+	  "Displays PRI Information", pri_show_span_help, complete_span_4 },
+	{ { "pri", "show", "debug", NULL }, handle_pri_show_debug,
+	  "Displays current PRI debug settings" },
+	{ { "pri", "set", "debug", "file", NULL }, handle_pri_set_debug_file,
+	  "Sends PRI debug output to the specified file" },
+	{ { "pri", "unset", "debug", "file", NULL }, handle_pri_set_debug_file,
+	  "Ends PRI debug output to file" },
+};
 
 #endif /* ZAPATA_PRI */
 
@@ -9068,11 +9063,12 @@
 	"Usage: r2 no debug channel <channel>\n"
 	"       Enables R2 protocol level debugging on a given channel\n";
 
-static struct ast_cli_entry r2_debug = {
-	{ "r2", "debug", "channel", NULL }, handle_r2_debug, "Enables R2 debugging on a channel", r2_debug_help };
-
-static struct ast_cli_entry r2_no_debug = {
-	{ "r2", "no", "debug", "channel", NULL }, handle_r2_no_debug, "Disables R2 debugging on a channel", r2_no_debug_help };
+static struct ast_cli_entry zap_r2_cli[] = {
+	{ { "r2", "debug", "channel", NULL }, handle_r2_debug,
+	  "Enables R2 debugging on a channel", r2_debug_help },
+	{ { "r2", "no", "debug", "channel", NULL }, handle_r2_no_debug,
+	  "Disables R2 debugging on a channel", r2_no_debug_help },
+};
 
 #endif
 
@@ -9391,13 +9387,6 @@
 	return RESULT_SUCCESS;
 }
 
-
-
-static struct ast_cli_entry zap_show_cadences_cli =
-	{ { "zap", "show", "cadences", NULL },
-	handle_zap_show_cadences, "List cadences",
-	zap_show_cadences_help, NULL };
-
 static char show_channels_usage[] =
 	"Usage: zap show channels\n"
 	"	Shows a list of available channels\n";
@@ -9414,17 +9403,18 @@
 	"Usage: zap destroy channel <chan num>\n"
 	"	DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.  Immediately removes a given channel, whether it is in use or not\n";
 
-static struct ast_cli_entry cli_show_channels = { 
-	{"zap", "show", "channels", NULL}, zap_show_channels, "Show active zapata channels", show_channels_usage, NULL };
-
-static struct ast_cli_entry cli_show_channel = { 
-	{"zap", "show", "channel", NULL}, zap_show_channel, "Show information on a channel", show_channel_usage, NULL };
-
-static struct ast_cli_entry cli_destroy_channel = { 
-	{"zap", "destroy", "channel", NULL}, zap_destroy_channel, "Destroy a channel", destroy_channel_usage, NULL };
-
-static struct ast_cli_entry cli_zap_show_status = {
-{"zap", "show", "status", NULL}, zap_show_status, "Show all Zaptel cards status", zap_show_status_usage, NULL };
+static struct ast_cli_entry zap_cli[] = {
+	{ { "zap", "show", "cadences", NULL }, handle_zap_show_cadences,
+	  "List cadences", zap_show_cadences_help },
+	{ {"zap", "show", "channels", NULL}, zap_show_channels,
+	  "Show active zapata channels", show_channels_usage },
+	{ {"zap", "show", "channel", NULL}, zap_show_channel,
+	  "Show information on a channel", show_channel_usage },
+	{ {"zap", "destroy", "channel", NULL}, zap_destroy_channel,
+	  "Destroy a channel", destroy_channel_usage },
+	{ {"zap", "show", "status", NULL}, zap_show_status,
+	  "Show all Zaptel cards status", zap_show_status_usage },
+};
 
 #define TRANSFER	0
 #define HANGUP		1
@@ -9617,23 +9607,12 @@
 		if (pris[i].master != AST_PTHREADT_NULL) 
 			pthread_cancel(pris[i].master);
 	}
-	ast_cli_unregister(&pri_debug);
-	ast_cli_unregister(&pri_no_debug);
-	ast_cli_unregister(&pri_really_debug);
-	ast_cli_unregister(&pri_show_span);
-	ast_cli_unregister(&pri_show_debug);
-	ast_cli_unregister(&pri_set_debug_file);
-	ast_cli_unregister(&pri_unset_debug_file);
+	ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
 #endif
 #ifdef ZAPATA_R2
-	ast_cli_unregister(&r2_debug);
-	ast_cli_unregister(&r2_no_debug);
+	ast_cli_unregister_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
 #endif
-	ast_cli_unregister(&cli_show_channels);
-	ast_cli_unregister(&cli_show_channel);
-	ast_cli_unregister(&cli_destroy_channel);
-	ast_cli_unregister(&zap_show_cadences_cli);
-	ast_cli_unregister(&cli_zap_show_status);
+	ast_cli_unregister_multiple(zap_cli, sizeof(zap_cli) / sizeof(zap_cli[0]));
 	ast_manager_unregister( "ZapDialOffhook" );
 	ast_manager_unregister( "ZapHangup" );
 	ast_manager_unregister( "ZapTransfer" );
@@ -10500,23 +10479,12 @@
 		return -1;
 	}
 #ifdef ZAPATA_PRI
-	ast_cli_register(&pri_debug);
-	ast_cli_register(&pri_no_debug);
-	ast_cli_register(&pri_really_debug);
-	ast_cli_register(&pri_show_span);
-	ast_cli_register(&pri_show_debug);
-	ast_cli_register(&pri_set_debug_file);
-	ast_cli_register(&pri_unset_debug_file);
+	ast_cli_register_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
 #endif	
 #ifdef ZAPATA_R2
-	ast_cli_register(&r2_debug);
-	ast_cli_register(&r2_no_debug);
+	ast_cli_register_multiple(zap_r2_cli, sizeof(zap_r2_cli) / sizeof(zap_r2_cli[0]));
 #endif	
-	ast_cli_register(&cli_show_channels);
-	ast_cli_register(&cli_show_channel);
-	ast_cli_register(&cli_destroy_channel);
-	ast_cli_register(&zap_show_cadences_cli);
-	ast_cli_register(&cli_zap_show_status);
+	ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(zap_cli[0]));
 	
 	memset(round_robin, 0, sizeof(round_robin));
 	ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );




More information about the svn-commits mailing list