From ccb6b0065d16cda426ed671920a63bd3e9e0d996 Mon Sep 17 00:00:00 2001 From: Jason Parker Date: Mon, 10 Sep 2007 16:24:29 +0000 Subject: [PATCH] Add counter to 'database show' CLI command. (also a minor whitespace change that I found along the way) Closes issue #10683, patch by junky git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82125 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/db.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/db.c b/main/db.c index a088a803ff..292e7af86c 100644 --- a/main/db.c +++ b/main/db.c @@ -306,6 +306,7 @@ static int database_show(int fd, int argc, char *argv[]) char *keys, *values; int res; int pass; + int counter = 0; if (argc == 4) { /* Family and key tree */ @@ -342,10 +343,12 @@ static int database_show(int fd, int argc, char *argv[]) values = ""; } if (keymatch(keys, prefix)) { - ast_cli(fd, "%-50s: %-25s\n", keys, values); + ast_cli(fd, "%-50s: %-25s\n", keys, values); + counter++; } } ast_mutex_unlock(&dblock); + ast_cli(fd, "%d results found.\n", counter); return RESULT_SUCCESS; } @@ -387,8 +390,8 @@ static int database_showkey(int fd, int argc, char *argv[]) values = ""; } if (subkeymatch(keys, suffix)) { - ast_cli(fd, "%-50s: %-25s\n", keys, values); - counter++; + ast_cli(fd, "%-50s: %-25s\n", keys, values); + counter++; } } ast_mutex_unlock(&dblock);