Add -c option to preserve comments from GENERIC in the output.

This commit is contained in:
Dag-Erling Smørgrav 2004-08-29 19:45:50 +00:00
parent bed2969d74
commit 4d7bee151a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134494

View File

@ -30,8 +30,12 @@
#
use strict;
use Getopt::Std;
MAIN:{
my %opts;
getopts('c', \%opts);
my %config;
my $machine;
my $ident;
@ -62,6 +66,14 @@ MAIN:{
while (<GENERIC>) {
my $line = $_;
chomp();
if ($opts{'c'} && m/^\#/) {
if ($blank) {
print "\n";
$blank = 0;
}
print $line;
next;
}
++$blank unless $_;
s/\s*(\#.*)?$//;
next unless $_;
@ -69,10 +81,6 @@ MAIN:{
if ($keyword eq 'machine') {
die("$generic is for $value, not $machine\n")
unless ($value eq $machine);
if ($blank) {
print "\n";
$blank = 0;
}
} elsif ($keyword eq 'ident') {
$line =~ s/$value/$ident/;
} elsif ($config{$keyword}->{$value}) {