[asterisk-commits] russell: trunk r54147 - in /trunk: include/asterisk/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Feb 12 22:57:53 MST 2007


Author: russell
Date: Mon Feb 12 23:57:52 2007
New Revision: 54147

URL: http://svn.digium.com/view/asterisk?view=rev&rev=54147
Log:
- Constify the format string passed to ast_cli()
- Simplify printing out the warranty and license

Modified:
    trunk/include/asterisk/cli.h
    trunk/main/asterisk.c
    trunk/main/cli.c

Modified: trunk/include/asterisk/cli.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/cli.h?view=diff&rev=54147&r1=54146&r2=54147
==============================================================================
--- trunk/include/asterisk/cli.h (original)
+++ trunk/include/asterisk/cli.h Mon Feb 12 23:57:52 2007
@@ -31,7 +31,7 @@
 
 #include "asterisk/linkedlists.h"
 
-void ast_cli(int fd, char *fmt, ...)
+void ast_cli(int fd, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
 
 #define RESULT_SUCCESS		0

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=54147&r1=54146&r2=54147
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Feb 12 23:57:52 2007
@@ -1428,66 +1428,60 @@
 {
 	return RESULT_SUCCESS;
 }
-static const char *warranty_lines[] = {
-	"\n",
-	"			    NO WARRANTY\n",
-	"\n",
-	"BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n",
-	"FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\n",
-	"OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n",
-	"PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n",
-	"OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n",
-	"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\n",
-	"TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\n",
-	"PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n",
-	"REPAIR OR CORRECTION.\n",
-	"\n",
-	"IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n",
-	"WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n",
-	"REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n",
-	"INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n",
-	"OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n",
-	"TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n",
-	"YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n",
-	"PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n",
-	"POSSIBILITY OF SUCH DAMAGES.\n",
+static const char warranty_lines[] = {
+	"\n"
+	"			    NO WARRANTY\n"
+	"\n"
+	"BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n"
+	"FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\n"
+	"OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n"
+	"PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n"
+	"OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n"
+	"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\n"
+	"TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\n"
+	"PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n"
+	"REPAIR OR CORRECTION.\n"
+	"\n"
+	"IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n"
+	"WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n"
+	"REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n"
+	"INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n"
+	"OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n"
+	"TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n"
+	"YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n"
+	"PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n"
+	"POSSIBILITY OF SUCH DAMAGES.\n"
 };
 
 static int show_warranty(int fd, int argc, char *argv[])
 {
-	int x;
-
-	for (x = 0; x < sizeof(warranty_lines) / sizeof(warranty_lines[0]); x++)
-		ast_cli(fd, (char *) warranty_lines[x]);
+	ast_cli(fd, warranty_lines);
 
 	return RESULT_SUCCESS;
 }
 
-static const char *license_lines[] = {
-	"\n",
-	"This program is free software; you can redistribute it and/or modify\n",
-	"it under the terms of the GNU General Public License version 2 as\n",
-	"published by the Free Software Foundation.\n",
-	"\n",
-	"This program also contains components licensed under other licenses.\n",
-	"They include:\n",
-	"\n",
-	"This program is distributed in the hope that it will be useful,\n",
-	"but WITHOUT ANY WARRANTY; without even the implied warranty of\n",
-	"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n",
-	"GNU General Public License for more details.\n",
-	"\n",
-	"You should have received a copy of the GNU General Public License\n",
-	"along with this program; if not, write to the Free Software\n",
-	"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n",
+static const char license_lines[] = {
+	"\n"
+	"This program is free software; you can redistribute it and/or modify\n"
+	"it under the terms of the GNU General Public License version 2 as\n"
+	"published by the Free Software Foundation.\n"
+	"\n"
+	"This program also contains components licensed under other licenses.\n"
+	"They include:\n"
+	"\n"
+	"This program is distributed in the hope that it will be useful,\n"
+	"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+	"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
+	"GNU General Public License for more details.\n"
+	"\n"
+	"You should have received a copy of the GNU General Public License\n"
+	"along with this program; if not, write to the Free Software\n"
+	"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n"
 };
 
 static int show_license(int fd, int argc, char *argv[])
 {
-	int x;
-
-	for (x = 0; x < sizeof(license_lines) / sizeof(license_lines[0]); x++)
-		ast_cli(fd, (char *) license_lines[x]);
+	ast_cli(fd, license_lines);
 
 	return RESULT_SUCCESS;
 }

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=54147&r1=54146&r2=54147
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Mon Feb 12 23:57:52 2007
@@ -54,7 +54,7 @@
 /*! \brief Initial buffer size for resulting strings in ast_cli() */
 #define AST_CLI_INITLEN   256
 
-void ast_cli(int fd, char *fmt, ...)
+void ast_cli(int fd, const char *fmt, ...)
 {
 	int res;
 	struct ast_str *buf;



More information about the asterisk-commits mailing list