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/ldbdel.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/ldbdel.c')
-rw-r--r-- | source4/lib/ldb/tools/ldbdel.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index 177279d47a..0e50a68532 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -34,20 +34,48 @@ #include "includes.h" - int main(int argc, const char *argv[]) +static void usage(void) { - static struct ldb_context *ldb; + printf("Usage: ldbdel <options> <DN...>\n"); + printf("Options:\n"); + printf(" -H ldb_url choose the database (or $LDB_URL)\n"); + printf("\n"); + printf("Deletes records from a ldb\n\n"); + exit(1); +} + + int main(int argc, char * const argv[]) +{ + struct ldb_context *ldb; int ret, i; const char *ldb_url; + int opt; ldb_url = getenv("LDB_URL"); + + while ((opt = getopt(argc, argv, "hH:")) != EOF) { + switch (opt) { + case 'H': + ldb_url = optarg; + break; + + case 'h': + default: + usage(); + break; + } + } + if (!ldb_url) { - ldb_url = "tdb://test.ldb"; + fprintf(stderr, "You must specify a ldb URL\n"); + exit(1); } + argc -= optind; + argv += optind; - if (argc < 2) { - printf("Usage: ldbdel <dn...>\n"); + if (argc < 1) { + usage(); exit(1); } @@ -57,7 +85,7 @@ exit(1); } - for (i=1;i<argc;i++) { + for (i=0;i<argc;i++) { ret = ldb_delete(ldb, argv[i]); if (ret != 0) { printf("delete of '%s' failed\n", argv[i]); @@ -65,5 +93,6 @@ } ldb_close(ldb); + return 0; } |