s4-ldb: when -v is specified, show progress of ldbadd/ldbmodify
authorAndrew Tridgell <tridge@samba.org>
Fri, 20 Nov 2009 00:34:24 +0000 (11:34 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 20 Nov 2009 00:34:39 +0000 (11:34 +1100)
This is useful for speed tests with large numbers of records.

source4/lib/ldb/tools/ldbadd.c
source4/lib/ldb/tools/ldbmodify.c

index f022486db882788133d12b237484bb604ff24de1..a87c99aaee4dc6dddb9e89af6dfb6eab6436df31 100644 (file)
@@ -35,6 +35,7 @@
 #include "tools/cmdline.h"
 
 static int failures;
+static struct ldb_cmdline *options;
 
 static void usage(void)
 {
@@ -69,6 +70,9 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
                        failures++;
                } else {
                        (*count)++;
+                       if (options->verbose) {
+                               printf("Added %s\n", ldb_dn_get_linearized(ldif->msg->dn));
+                       }
                }
                ldb_ldif_read_free(ldb, ldif);
        }
@@ -82,7 +86,6 @@ int main(int argc, const char **argv)
 {
        struct ldb_context *ldb;
        int i, ret=0, count=0;
-       struct ldb_cmdline *options;
 
        ldb = ldb_init(NULL, NULL);
 
index d0bca0479bdbc2700ec62e24cb764840702737ec..4936880d09d2a77e3ceb0e340a6b5863e0a41470 100644 (file)
@@ -35,6 +35,7 @@
 #include "tools/cmdline.h"
 
 static int failures;
+static struct ldb_cmdline *options;
 
 static void usage(void)
 {
@@ -71,6 +72,9 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count)
                        failures++;
                } else {
                        (*count)++;
+                       if (options->verbose) {
+                               printf("Modified %s\n", ldb_dn_get_linearized(ldif->msg->dn));
+                       }
                }
                ldb_ldif_read_free(ldb, ldif);
        }
@@ -83,7 +87,6 @@ int main(int argc, const char **argv)
        struct ldb_context *ldb;
        int count=0;
        int i, ret=LDB_SUCCESS;
-       struct ldb_cmdline *options;
 
        ldb = ldb_init(NULL, NULL);