]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2247. [doc] Sort doc/misc/options. [RT #17067]
authorMark Andrews <marka@isc.org>
Mon, 24 Sep 2007 04:21:59 +0000 (04:21 +0000)
committerMark Andrews <marka@isc.org>
Mon, 24 Sep 2007 04:21:59 +0000 (04:21 +0000)
CHANGES
doc/misc/Makefile.in
doc/misc/format-options.pl
doc/misc/sort-options.pl [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index 3a185d5bbf86ac0f12bc5507ac207c65e3a32a9d..f7bbc72fe65eac82696cb6478afea7333d81ceb2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+2247.  [doc]           Sort doc/misc/options. [RT #17067]
+
 2246.  [bug]           Make the startup of test servers (ans.pl) more
                        robust. [RT #17147]
 
index 5cdce626e88071e875861e34d89bd2296593f751..501e3befd5220ed001e08bae3936b9d0b07b1dec 100644 (file)
@@ -13,7 +13,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: Makefile.in,v 1.6 2007/06/18 23:47:34 tbox Exp $
+# $Id: Makefile.in,v 1.7 2007/09/24 04:21:59 marka Exp $
 
 srcdir =       @srcdir@
 VPATH =                @srcdir@
@@ -40,6 +40,7 @@ CFG_TEST = ../../bin/tests/cfg_test
 options: FORCE
        if test -x ${CFG_TEST} && \
           ${CFG_TEST} --named --grammar | \
+          ${PERL} ${srcdir}/sort-options.pl | \
           ${PERL} ${srcdir}/format-options.pl >$@.new ; then \
                mv -f $@.new $@ ; \
        else \
index 470190b9960e196e3d7b69591cfaddeb734442a0..b0b8d5232bb234b671f7edc728f74df2a48c29e5 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: format-options.pl,v 1.4 2007/06/19 23:47:13 tbox Exp $
+# $Id: format-options.pl,v 1.5 2007/09/24 04:21:59 marka Exp $
 
 print <<END;
 
@@ -26,11 +26,24 @@ END
 
 # Break long lines
 while (<>) {
+       chomp;
        s/\t/        /g;
-       if (length >= 79) {
-               m!^( *)!;
-               my $indent = $1;
-               s!^(.{0,75}) (.*)$!\1\n$indent    \2!;
+       my $line = $_;
+       m!^( *)!;
+       my $indent = $1;
+       my $comment = "";
+       if ( $line =~ m!//.*! ) {
+               $comment = $&;
+               $line =~ s!//.*!!;
        }
-       print;
+       my $start = "";
+       while (length($line) >= 79 - length($comment)) {
+               $_ = $line;
+               # this makes sure that the comment has something in front of it
+               $len = 75 - length($comment);
+               m!^(.{0,$len}) (.*)$!;
+               $start = $start.$1."\n";
+               $line = $indent."    ".$2;
+       }
+       print $start.$line.$comment."\n";
 }
diff --git a/doc/misc/sort-options.pl b/doc/misc/sort-options.pl
new file mode 100644 (file)
index 0000000..88a2290
--- /dev/null
@@ -0,0 +1,34 @@
+#!/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();