problems: asort() is not available in all awk implementations

This commit is contained in:
Pierangelo Masarati 2004-08-25 11:43:21 +00:00
parent e745d15f02
commit 2aacf1d353
4 changed files with 3 additions and 74 deletions

View File

@ -1,18 +0,0 @@
#! /bin/sh
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2004 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
#
# Strip comments
#
egrep -iv '^#' | awk -f $LDIFSORT

View File

@ -93,8 +93,6 @@ CLIENTDIR=../clients/tools
LDIFFILTER=$SRCDIR/scripts/acfilter.sh
CONFFILTER=$SRCDIR/scripts/conf.sh
LDIFFILTERSORT=$SRCDIR/scripts/acfiltersort.sh
LDIFSORT=$SRCDIR/scripts/ldifsort.awk
SLAPADD="../servers/slapd/slapd -Ta $LDAP_VERBOSE"
SLAPCAT="../servers/slapd/slapd -Tc $LDAP_VERBOSE"

View File

@ -1,51 +0,0 @@
# Parses LDIF files, eliminating contnuations, and sorts
# Author: Pierangelo Masarati <ando@sys-net.it>
func parse_line( line ) {
getline;
while ($0 != "") {
c = substr($0, 1, 1);
if (c == "#") {
continue;
}
if (c != " ") {
break;
}
line = line substr($0, 2, length($0));
getline;
}
return line;
}
/^dn: / {
/* FIXME: works only if DN is on one line... */
dn = $0;
dn = parse_line(dn);
while (1) {
if ($0 == "") {
break;
}
line = $0;
line = parse_line(line);
attrs[line] = line
}
entry[dn] = dn "\n";
n = asort(attrs);
for (i = 1; i <= n; i++) {
entry[dn] = entry[dn] attrs[i] "\n"
}
delete attrs
}
END {
n = asort(entry);
for (i = 1; i <= n; i++) {
print entry[i];
}
}

View File

@ -304,7 +304,7 @@ EOMODS
fi
echo "Using ldapsearch to retrieve all the entries..."
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
"objectClass=*" > $SEARCHOUT 2>&1
RC=$?
@ -315,9 +315,9 @@ EOMODS
fi
echo "Filtering ldapsearch results..."
. $LDIFFILTERSORT < $SEARCHOUT > $SEARCHFLT
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering modified ldif..."
. $LDIFFILTERSORT < $SQLWRITE > $LDIFFLT
. $LDIFFILTER < $SQLWRITE > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT