summaryrefslogtreecommitdiffabout
path: root/src/gdbmtool.c
Unidiff
Diffstat (limited to 'src/gdbmtool.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/gdbmtool.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 33bdf93..9c6eebe 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -552,7 +552,7 @@ err_printer (void *data GDBM_ARG_UNUSED, char const *fmt, ...)
552 fprintf (stderr, "\n"); 552 fprintf (stderr, "\n");
553} 553}
554 554
555/* recover verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */ 555/* recover sumamry verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */
556void 556void
557recover_handler (struct handler_param *param) 557recover_handler (struct handler_param *param)
558{ 558{
@@ -561,8 +561,9 @@ recover_handler (struct handler_param *param)
561 int rc; 561 int rc;
562 int i; 562 int i;
563 char *p; 563 char *p;
564 int summary = 0;
564 565
565 for (i = 1; i < param->argc; i++) 566 for (i = 0; i < param->argc; i++)
566 { 567 {
567 char *arg = PARAM_STRING (param, i); 568 char *arg = PARAM_STRING (param, i);
568 if (strcmp (arg, "verbose") == 0) 569 if (strcmp (arg, "verbose") == 0)
@@ -570,6 +571,10 @@ recover_handler (struct handler_param *param)
570 rcvr.errfun = err_printer; 571 rcvr.errfun = err_printer;
571 flags |= GDBM_RCVR_ERRFUN; 572 flags |= GDBM_RCVR_ERRFUN;
572 } 573 }
574 else if (strcmp (arg, "summary") == 0)
575 {
576 summary = 1;
577 }
573 else if (strcmp (arg, "backup") == 0) 578 else if (strcmp (arg, "backup") == 0)
574 { 579 {
575 rcvr.errfun = err_printer; 580 rcvr.errfun = err_printer;
@@ -617,6 +622,19 @@ recover_handler (struct handler_param *param)
617 if (rc == 0) 622 if (rc == 0)
618 { 623 {
619 fprintf (param->fp, _("Recovery succeeded.\n")); 624 fprintf (param->fp, _("Recovery succeeded.\n"));
625 if (summary)
626 {
627 fprintf (param->fp,
628 _("Keys recovered: %lu, failed: %lu, duplicate: %lu\n"),
629 (unsigned long) rcvr.recovered_keys,
630 (unsigned long) rcvr.failed_keys,
631 (unsigned long) rcvr.duplicate_keys);
632 fprintf (param->fp,
633 _("Buckets recovered: %lu, failed: %lu\n"),
634 (unsigned long) rcvr.recovered_buckets,
635 (unsigned long) rcvr.failed_buckets);
636 }
637
620 if (rcvr.backup_name) 638 if (rcvr.backup_name)
621 { 639 {
622 fprintf (param->fp, 640 fprintf (param->fp,
@@ -925,7 +943,7 @@ export_handler (struct handler_param *param)
925 int i; 943 int i;
926 int filemode; 944 int filemode;
927 945
928 for (i = 1; i < param->argc; i++) 946 for (i = 0; i < param->argc; i++)
929 { 947 {
930 if (strcmp (PARAM_STRING (param, i), "truncate") == 0) 948 if (strcmp (PARAM_STRING (param, i), "truncate") == 0)
931 flags = GDBM_NEWDB; 949 flags = GDBM_NEWDB;
@@ -959,7 +977,7 @@ import_handler (struct handler_param *param)
959 int i; 977 int i;
960 int rc; 978 int rc;
961 979
962 for (i = 1; i < param->argc; i++) 980 for (i = 0; i < param->argc; i++)
963 { 981 {
964 if (strcmp (PARAM_STRING (param, i), "replace") == 0) 982 if (strcmp (PARAM_STRING (param, i), "replace") == 0)
965 flag = GDBM_REPLACE; 983 flag = GDBM_REPLACE;
@@ -1220,6 +1238,7 @@ struct command command_tab[] = {
1220 { S(recover), T_CMD, 1238 { S(recover), T_CMD,
1221 checkdb, recover_handler, NULL, 1239 checkdb, recover_handler, NULL,
1222 { { "[verbose]", GDBM_ARG_STRING }, 1240 { { "[verbose]", GDBM_ARG_STRING },
1241 { "[summary]", GDBM_ARG_STRING },
1223 { "[backup]", GDBM_ARG_STRING }, 1242 { "[backup]", GDBM_ARG_STRING },
1224 { "[max-failed-keys=N]", GDBM_ARG_STRING }, 1243 { "[max-failed-keys=N]", GDBM_ARG_STRING },
1225 { "[max-failed-buckets=N]", GDBM_ARG_STRING }, 1244 { "[max-failed-buckets=N]", GDBM_ARG_STRING },

Return to:

Send suggestions and report system problems to the System administrator.