summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-01 18:45:25 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-01 18:55:20 +1100
commit6f2c4abadd6097d949b388cc4d9c4ebd77f0df10 (patch)
tree591f61a1a94fb7070065351a4f90987ea2d3e45d /source4/lib/ldb/tools
parentf924a022cbc973ae646bff5119a1784e979a052f (diff)
downloadsamba-6f2c4abadd6097d949b388cc4d9c4ebd77f0df10.tar.gz
samba-6f2c4abadd6097d949b388cc4d9c4ebd77f0df10.tar.bz2
samba-6f2c4abadd6097d949b388cc4d9c4ebd77f0df10.zip
s4-ldb: convert existing ldb tools to use new command line hooks
the usage() function needs to take a ldb context, as the popt_options is specific to the ldb context Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/lib/ldb/tools')
-rw-r--r--source4/lib/ldb/tools/ldbadd.c4
-rw-r--r--source4/lib/ldb/tools/ldbdel.c6
-rw-r--r--source4/lib/ldb/tools/ldbedit.c11
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c4
-rw-r--r--source4/lib/ldb/tools/ldbrename.c6
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c10
-rw-r--r--source4/lib/ldb/tools/ldbtest.c5
7 files changed, 15 insertions, 31 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index 42470656fb..ab456f3d33 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -38,11 +38,11 @@
static unsigned int failures;
static struct ldb_cmdline *options;
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbadd <options> <ldif...>\n");
printf("Adds records to a ldb, reading ldif the specified list of files\n\n");
- ldb_cmdline_help("ldbadd", stdout);
+ ldb_cmdline_help(ldb, "ldbadd", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index 6994b3ddb6..6f7c8ae4a3 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -73,11 +73,11 @@ static int ldb_delete_recursive(struct ldb_context *ldb, struct ldb_dn *dn,struc
return 0;
}
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbdel <options> <DN...>\n");
printf("Deletes records from a ldb\n\n");
- ldb_cmdline_help("ldbdel", stdout);
+ ldb_cmdline_help(ldb, "ldbdel", stdout);
exit(1);
}
@@ -94,7 +94,7 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc < 1) {
- usage();
+ usage(ldb);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 4deeb30ee9..b311073b05 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -31,13 +31,8 @@
* Author: Andrew Tridgell
*/
-#ifdef _SAMBA_BUILD_
-#include "includes.h"
-#include <system/filesys.h>
-#else
#include "ldb_includes.h"
-#endif
-
+#include "system/filesys.h"
#include "ldb.h"
#include "tools/cmdline.h"
#include "tools/ldbutil.h"
@@ -287,10 +282,10 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1,
return merge_edits(ldb, msgs1, count1, msgs2, count2);
}
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbedit <options> <expression> <attributes ...>\n");
- ldb_cmdline_help("ldbedit", stdout);
+ ldb_cmdline_help(ldb, "ldbedit", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index ecbdadfd65..d5252dc206 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -38,11 +38,11 @@
static int failures;
static struct ldb_cmdline *options;
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbmodify <options> <ldif...>\n");
printf("Modifies a ldb based upon ldif change records\n\n");
- ldb_cmdline_help("ldbmodify", stdout);
+ ldb_cmdline_help(ldb, "ldbmodify", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c
index e0f258ce85..7473a77fda 100644
--- a/source4/lib/ldb/tools/ldbrename.c
+++ b/source4/lib/ldb/tools/ldbrename.c
@@ -36,11 +36,11 @@
#include "ldb.h"
#include "tools/cmdline.h"
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbrename [<options>] <olddn> <newdn>\n");
printf("Renames records in a ldb\n\n");
- ldb_cmdline_help("ldbmodify", stdout);
+ ldb_cmdline_help(ldb, "ldbmodify", stdout);
exit(1);
}
@@ -58,7 +58,7 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc < 2) {
- usage();
+ usage(ldb);
}
dn1 = ldb_dn_new(ldb, ldb, options->argv[0]);
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 55144a7a8c..458d7115ed 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -31,20 +31,14 @@
* Author: Andrew Tridgell
*/
-#ifdef _SAMBA_BUILD_
-#include "includes.h"
-#include <ldb.h>
-#else
#include "ldb_includes.h"
#include "ldb.h"
-#endif
-
#include "tools/cmdline.h"
-static void usage(void)
+static void usage(struct ldb_context *ldb)
{
printf("Usage: ldbsearch <options> <expression> <attrs...>\n");
- ldb_cmdline_help("ldbsearch", stdout);
+ ldb_cmdline_help(ldb, "ldbsearch", stdout);
exit(1);
}
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 94dd2c696d..c8d35732f8 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -31,12 +31,7 @@
* Author: Andrew Tridgell
*/
-#ifdef _SAMBA_BUILD_
-#include "includes.h"
-#else
#include "ldb_includes.h"
-#endif
-
#include "ldb.h"
#include "tools/cmdline.h"