[asterisk-commits] qwell: trunk r82154 - /trunk/main/db.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 10 12:39:08 CDT 2007
Author: qwell
Date: Mon Sep 10 12:39:08 2007
New Revision: 82154
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82154
Log:
Add a counter to the 'database deltree' CLI command.
Note: this is slightly different than the initial patch, because I felt
that using res <= 0 would be a change in behavior.
Closes issue #10687, patch by junky
Modified:
trunk/main/db.c
Modified: trunk/main/db.c
URL: http://svn.digium.com/view/asterisk/trunk/main/db.c?view=diff&rev=82154&r1=82153&r2=82154
==============================================================================
--- trunk/main/db.c (original)
+++ trunk/main/db.c Mon Sep 10 12:39:08 2007
@@ -104,6 +104,7 @@
char *keys;
int res;
int pass;
+ int counter = 0;
if (family) {
if (keytree) {
@@ -135,11 +136,12 @@
}
if (keymatch(keys, prefix)) {
astdb->del(astdb, &key, 0);
+ counter++;
}
}
astdb->sync(astdb, 0);
ast_mutex_unlock(&dblock);
- return 0;
+ return counter;
}
int ast_db_put(const char *family, const char *keys, const char *value)
@@ -291,10 +293,10 @@
} else {
res = ast_db_deltree(argv[2], NULL);
}
- if (res) {
+ if (res < 0) {
ast_cli(fd, "Database entries do not exist.\n");
} else {
- ast_cli(fd, "Database entries removed.\n");
+ ast_cli(fd, "%d database entries removed.\n",res);
}
return RESULT_SUCCESS;
}
@@ -629,7 +631,7 @@
else
res = ast_db_deltree(family, NULL);
- if (res)
+ if (res < 0)
astman_send_error(s, m, "Database entry not found");
else
astman_send_ack(s, m, "Key tree deleted successfully");
More information about the asterisk-commits
mailing list