[asterisk-commits] trunk r23229 - in /trunk: asterisk.c cli.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Apr 28 17:15:29 MST 2006


Author: russell
Date: Fri Apr 28 19:15:28 2006
New Revision: 23229

URL: http://svn.digium.com/view/asterisk?rev=23229&view=rev
Log:
move the "show version" CLI command from cli.c to asterisk.c so that only one
file depends on version.h, and thus, only one file has to be rebuilt when
version.h gets regenerated (issue #6942)

Modified:
    trunk/asterisk.c
    trunk/cli.c

Modified: trunk/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/asterisk.c?rev=23229&r1=23228&r2=23229&view=diff
==============================================================================
--- trunk/asterisk.c (original)
+++ trunk/asterisk.c Fri Apr 28 19:15:28 2006
@@ -223,6 +223,13 @@
 char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH] = "\0";
 char ast_config_AST_CTL[AST_CONFIG_MAX_PATH] = "asterisk.ctl";
 char ast_config_AST_SYSTEM_NAME[20] = "";
+
+extern const char *ast_build_hostname;
+extern const char *ast_build_kernel;
+extern const char *ast_build_machine;
+extern const char *ast_build_os;
+extern const char *ast_build_date;
+extern const char *ast_build_user;
 
 static char *_argv[256];
 static int shuttingdown = 0;
@@ -1271,6 +1278,20 @@
 "Usage: show license\n"
 "	Shows the license(s) for this copy of Asterisk.\n";
 
+static char version_help[] =
+"Usage: show version\n"
+"       Shows Asterisk version information.\n";
+
+static int handle_version(int fd, int argc, char *argv[])
+{
+	if (argc != 2)
+		return RESULT_SHOWUSAGE;
+	ast_cli(fd, "Asterisk %s built by %s @ %s on a %s running %s on %s\n",
+		ASTERISK_VERSION, ast_build_user, ast_build_hostname,
+		ast_build_machine, ast_build_os, ast_build_date);
+	return RESULT_SUCCESS;
+}
+
 #if 0
 static int handle_quit(int fd, int argc, char *argv[])
 {
@@ -1431,6 +1452,8 @@
 	  "Show the warranty (if any) for this copy of Asterisk", show_warranty_help },
 	{ { "show", "license", NULL }, show_license,
 	  "Show the license(s) for this copy of Asterisk", show_license_help },
+	{ { "show", "version", NULL }, handle_version, 
+	  "Display version info", version_help },
 	{ { "!", NULL }, handle_bang,
 	  "Execute a shell command", bang_help },
 #if !defined(LOW_MEMORY)

Modified: trunk/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/cli.c?rev=23229&r1=23228&r2=23229&view=diff
==============================================================================
--- trunk/cli.c (original)
+++ trunk/cli.c Fri Apr 28 19:15:28 2006
@@ -51,14 +51,6 @@
 /* For rl_filename_completion */
 #include "editline/readline/readline.h"
 /* For module directory */
-#include "asterisk/version.h"
-
-extern const char *ast_build_hostname;
-extern const char *ast_build_kernel;
-extern const char *ast_build_machine;
-extern const char *ast_build_os;
-extern const char *ast_build_date;
-extern const char *ast_build_user;
 
 extern unsigned long global_fin, global_fout;
 	
@@ -292,10 +284,6 @@
 "Usage: show modules [like keyword]\n"
 "       Shows Asterisk modules currently in use, and usage statistics.\n";
 
-static char version_help[] =
-"Usage: show version\n"
-"       Shows Asterisk version information.\n";
-
 static char uptime_help[] =
 "Usage: show uptime [seconds]\n"
 "       Shows Asterisk uptime information.\n"
@@ -389,16 +377,6 @@
 }
 #undef MODLIST_FORMAT
 #undef MODLIST_FORMAT2
-
-static int handle_version(int fd, int argc, char *argv[])
-{
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
-	ast_cli(fd, "Asterisk %s built by %s @ %s on a %s running %s on %s\n",
-		ASTERISK_VERSION, ast_build_user, ast_build_hostname,
-		ast_build_machine, ast_build_os, ast_build_date);
-	return RESULT_SUCCESS;
-}
 
 static int handle_chanlist(int fd, int argc, char *argv[])
 {
@@ -941,7 +919,6 @@
 	{ { "show", "modules", NULL }, handle_modlist, "List modules and info", modlist_help },
 	{ { "show", "modules", "like", NULL }, handle_modlist, "List modules and info", modlist_help, complete_mod_4 },
  	{ { "show", "uptime", NULL }, handle_showuptime, "Show uptime information", uptime_help },
-	{ { "show", "version", NULL }, handle_version, "Display version info", version_help },
 	{ { "soft", "hangup", NULL }, handle_softhangup, "Request a hangup on a given channel", softhangup_help, complete_ch_3 },
 	{ { "unload", NULL }, handle_unload, "Unload a dynamic module by name", unload_help, complete_fn },
 	{ { NULL }, NULL, NULL, NULL }



More information about the asterisk-commits mailing list