aboutsummaryrefslogtreecommitdiffstats
path: root/main/cli.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-09 17:11:53 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-09 17:11:53 +0000
commit9f89a65ec1876cf024a4780961d15f13c7f07fde (patch)
tree7ac1a10a7fb6c23213b725ce24cc743c61f7b084 /main/cli.c
parent1b632e51dd7cb4e1abb66dbf372b4b69c7fe3556 (diff)
Re-add CLI command that should have only been deprecated in 1.4.
Thanks kshumard! (reported in person, so no associated issue #) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@50186 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/main/cli.c b/main/cli.c
index c914dd42c..023ca4bc8 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -541,10 +541,25 @@ static void print_uptimestr(int fd, time_t timeval, const char *prefix, int prin
ast_cli(fd, "%s: %s\n", prefix, timestr);
}
-static int handle_showuptime(int fd, int argc, char *argv[])
+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[])
+{
+ /* 'core show uptime [seconds]' */
+ time_t curtime = time(NULL);
int printsec = (argc == 4 && !strcasecmp(argv[3],"seconds"));
if (argc != 3 && !printsec)
@@ -1388,6 +1403,11 @@ static struct ast_cli_entry cli_module_unload_deprecated = {
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 @@ static struct ast_cli_entry cli_cli[] = {
{ { "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",