diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-04-10 20:18:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:51:11 -0500 |
commit | ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5 (patch) | |
tree | bcd9a0afdc2996df4a56479932b7d36d32c50f8d /source4/lib/ldb/tools/ldbsearch.c | |
parent | 91b30df39bfaec8bfa32be40a13fd62008f66b9e (diff) | |
download | samba-ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5.tar.gz samba-ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5.tar.bz2 samba-ac193579e7db00c7a2ea0aadaaf0d34c10dcf1a5.zip |
r152: a quick airport commit ....
added ldbedit, a _really_ useful command
added ldbadd, ldbdel, ldbsearch and ldbmodify to build
solved lots of timezone issues, we now pass the torture tests with
client and server in different zones
fixed several build issues
I know this breaks the no-LDAP build. Wait till I arrive in San Jose for that
fix.
(This used to be commit af34710d4da1841653624fe304b1c8d812c0fdd9)
Diffstat (limited to 'source4/lib/ldb/tools/ldbsearch.c')
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index f4eb8f00db..327feb28ef 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -33,26 +33,32 @@ */ #include "includes.h" -#include <getopt.h> + +static void usage(void) +{ + printf("Usage: ldbsearch <options> <expression> <attrs...>\n"); + printf("Options:\n"); + printf(" -H ldb_url choose the database (or $LDB_URL)\n"); + printf(" -s base|sub|one choose search scope\n"); + printf(" -b basedn choose baseDN\n"); + exit(1); +} int main(int argc, char * const argv[]) { - static struct ldb_context *ldb; + struct ldb_context *ldb; struct ldb_message **msgs; int ret, i; const char *expression; - const char * const *attrs = NULL; + char * const *attrs = NULL; const char *ldb_url; const char *basedn = NULL; int opt; enum ldb_scope scope = LDB_SCOPE_SUBTREE; ldb_url = getenv("LDB_URL"); - if (!ldb_url) { - ldb_url = "tdb://test.ldb"; - } - while ((opt = getopt(argc, argv, "b:H:s:")) != EOF) { + while ((opt = getopt(argc, argv, "b:H:s:h")) != EOF) { switch (opt) { case 'b': basedn = optarg; @@ -71,14 +77,24 @@ scope = LDB_SCOPE_ONELEVEL; } break; + + case 'h': + default: + usage(); + break; } } + if (!ldb_url) { + fprintf(stderr, "You must specify a ldb URL\n"); + exit(1); + } + argc -= optind; argv += optind; if (argc < 1) { - printf("Usage: ldbsearch <expression> [attrs...]\n"); + usage(); exit(1); } |