[asterisk-commits] qwell: branch 1.4 r50186 - /branches/1.4/main/cli.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 9 10:11:54 MST 2007


Author: qwell
Date: Tue Jan  9 11:11:53 2007
New Revision: 50186

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50186
Log:
Re-add CLI command that should have only been deprecated in 1.4.

Thanks kshumard!  (reported in person, so no associated issue #)

Modified:
    branches/1.4/main/cli.c

Modified: branches/1.4/main/cli.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/cli.c?view=diff&rev=50186&r1=50185&r2=50186
==============================================================================
--- branches/1.4/main/cli.c (original)
+++ branches/1.4/main/cli.c Tue Jan  9 11:11:53 2007
@@ -541,9 +541,24 @@
 		ast_cli(fd, "%s: %s\n", prefix, timestr);
 }
 
+static int handle_showuptime_deprecated(int fd, int argc, char *argv[])
+{
+	/* 'show uptime [seconds]' */
+	time_t curtime = time(NULL);
+	int printsec = (argc == 3 && !strcasecmp(argv[2],"seconds"));
+
+	if (argc != 2 && !printsec)
+		return RESULT_SHOWUSAGE;
+	if (ast_startuptime)
+		print_uptimestr(fd, curtime - ast_startuptime, "System uptime", printsec);
+	if (ast_lastreloadtime)
+		print_uptimestr(fd, curtime - ast_lastreloadtime, "Last reload", printsec);
+	return RESULT_SUCCESS;
+}
+
 static int handle_showuptime(int fd, int argc, char *argv[])
 {
-	/* 'show uptime [seconds]' */
+	/* 'core show uptime [seconds]' */
 	time_t curtime = time(NULL);
 	int printsec = (argc == 4 && !strcasecmp(argv[3],"seconds"));
 
@@ -1388,6 +1403,11 @@
 	handle_unload_deprecated, NULL,
 	NULL, complete_mod_2 };
 
+static struct ast_cli_entry cli_show_uptime_deprecated = {
+	{ "show", "uptime", NULL },
+	handle_showuptime_deprecated, "Show uptime information",
+	NULL };
+
 static struct ast_cli_entry cli_cli[] = {
 	/* Deprecated, but preferred command is now consolidated (and already has a deprecated command for it). */
 	{ { "no", "debug", "channel", NULL },
@@ -1452,7 +1472,7 @@
 
  	{ { "core", "show", "uptime", NULL },
 	handle_showuptime, "Show uptime information",
-	uptime_help },
+	uptime_help, NULL, &cli_show_uptime_deprecated },
 
 	{ { "soft", "hangup", NULL },
 	handle_softhangup, "Request a hangup on a given channel",



More information about the asterisk-commits mailing list