format-options.pl revision bf8267aa453e5d2a735ed732a043b77a0b355b20
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews#!/usr/bin/perl
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews#
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# Copyright (C) 2001 Internet Software Consortium.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews#
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# Permission to use, copy, modify, and/or distribute this software for any
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# purpose with or without fee is hereby granted, provided that the above
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# copyright notice and this permission notice appear in all copies.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews#
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# PERFORMANCE OF THIS SOFTWARE.
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews# $Id: format-options.pl,v 1.5 2007/09/24 04:21:59 marka Exp $
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrewsprint <<END;
7867d18ce0ffa93055fbda3b9d2be8b168d898fcMark Andrews
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark AndrewsThis is a summary of the named.conf options supported by
this version of BIND 9.
END
# Break long lines
while (<>) {
chomp;
s/\t/ /g;
my $line = $_;
m!^( *)!;
my $indent = $1;
my $comment = "";
if ( $line =~ m!//.*! ) {
$comment = $&;
$line =~ s!//.*!!;
}
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";
}