diff options
author | des <des@FreeBSD.org> | 2004-08-29 19:45:50 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-08-29 19:45:50 +0000 |
commit | ff465de13abe12f499370e2521140187f7f4a89d (patch) | |
tree | fe37d6ef4e2defaf4d3fd39e5c3f81f616fe7f0f /tools | |
parent | b19763a3ea7eae146859a7b79cd22f6cbb52540b (diff) | |
download | FreeBSD-src-ff465de13abe12f499370e2521140187f7f4a89d.zip FreeBSD-src-ff465de13abe12f499370e2521140187f7f4a89d.tar.gz |
Add -c option to preserve comments from GENERIC in the output.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/tools/genericize/genericize.pl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/tools/genericize/genericize.pl b/tools/tools/genericize/genericize.pl index 3cef7b1..9a14543 100755 --- a/tools/tools/genericize/genericize.pl +++ b/tools/tools/genericize/genericize.pl @@ -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}) { |