2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 18:19:42 +00:00
bind/doc/misc/sort-options.pl

35 lines
546 B
Perl
Raw Normal View History

#!/bin/perl
sub sortlevel() {
my @options = ();
my $fin = "";
my $i = 0;
while (<>) {
if (/^\s*};$/) {
$fin = $_;
# print 2, $_;
last;
}
next if (/^$/);
if (/{$/) {
# print 3, $_;
my $sec = $_;
push(@options, $sec . sortlevel());
} else {
push(@options, $_);
# print 1, $_;
}
$i++;
}
my $result = "";
foreach my $i (sort @options) {
$result = ${result}.${i};
$result = $result."\n" if ($i =~ /^[a-z]/i);
# print 5, ${i};
}
$result = ${result}.${fin};
return ($result);
}
print sortlevel();