From ee3f4b12d22459405372e1c72efe3079a052601d Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 9 Jun 2005 14:50:32 +0000 Subject: r7438: work in progress (This used to be commit 2fc5343f0637ef3109b079dbc33d6cf4e58c8d5e) --- source4/lib/ldb/tools/ldbsearch.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source4/lib/ldb/tools') diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 26bd198d1d..4bf9db8d90 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -54,6 +54,12 @@ static void usage(void) exit(1); } +static int do_compare_msg(struct ldb_message **el1, + struct ldb_message **el2) +{ + return ldb_dn_cmp((*el1)->dn, (*el2)->dn); +} + static int do_search(struct ldb_context *ldb, const char *basedn, int scope, @@ -72,6 +78,11 @@ static int do_search(struct ldb_context *ldb, printf("# returned %d records\n", ret); + if (sort_attribs) { + qsort(msgs, ret, sizeof(struct ldb_message *), + (comparison_fn_t)do_compare_msg); + } + for (i=0;i