Skip to content

Commit

Permalink
Added -c option to do case-insensitive comparisons on the key attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
kartiksubbarao committed Oct 1, 2004
1 parent 5bf04f2 commit 71a18ff
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions contrib/ldifsort.pl
@@ -1,6 +1,6 @@
#! /usr/bin/perl

# $Id: ldifsort.pl,v 1.2 2003/06/24 21:58:34 kartik_subbarao Exp $
# $Id: ldifsort.pl,v 1.6 2004/09/30 20:13:59 subbarao Exp $

=head1 NAME
Expand All @@ -13,7 +13,7 @@ =head1 DESCRIPTION
=head1 SYNOPSIS
ldifsort.pl B<-k keyattr> [B<-and>] file.ldif
ldifsort.pl B<-k keyattr> [B<-andc>] file.ldif
=over 4
Expand All @@ -40,6 +40,10 @@ =head1 SYNOPSIS
DN-normalized version of attribute values. This is the default
behavior if 'dn' is passed as the argument to B<-k>.
=item B<-c>
Specifies case-insensitive comparisons on the key attribute.
=back
Expand All @@ -57,13 +61,14 @@ =head1 AUTHOR
use strict;

my %args;
getopts("k:and", \%args);
getopts("k:andc", \%args);

my $keyattr = $args{k};
my $sortattrs = $args{a};
my $ciscmp = $args{c};
my $ldiffile = $ARGV[0];

die "usage: $0 -k keyattr [-n] [-d] ldiffile\n"
die "usage: $0 -k keyattr [-n] [-d] [-c] ldiffile\n"
unless $keyattr && $ldiffile;

$/ = "";
Expand All @@ -79,6 +84,7 @@ =head1 AUTHOR
$value = $2;
$value = decode_base64($value) if $1 eq '::';
}
$value = lc($value) if $args{c};
push @valuepos, [ $value, $pos ];
$pos = tell;
}
Expand Down

0 comments on commit 71a18ff

Please sign in to comment.