# Get command line options
use Getopt::Long;
+require "./Porting/manifest_lib.pl";
my $outfile;
my $check_only = 0;
my $quiet = 0;
close($IN) or die($!);
chomp(@manifest);
-# Sort by dictionary order (ignore-case and
-# consider whitespace and alphanumeric only)
-my @sorted = sort {
- (my $aa = $a) =~ s/[^\s\da-zA-Z]//g;
- (my $bb = $b) =~ s/[^\s\da-zA-Z]//g;
- uc($aa) cmp uc($bb)
- } @manifest;
+my %seen= ( '' => 1 ); # filter out blank lines
+my @sorted = grep { !$seen{$_}++ }
+ sort_manifest(@manifest)
+;
# Check if the file is sorted or not
my $exit_code = 0;
if (defined($outfile)) {
open(my $OUT, '>', $outfile)
or die("Can't open output file '$outfile': $!");
+ binmode($OUT);
print($OUT join("\n", @sorted), "\n");
close($OUT) or die($!);
}