summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-08-29 19:45:50 +0000
committerdes <des@FreeBSD.org>2004-08-29 19:45:50 +0000
commitff465de13abe12f499370e2521140187f7f4a89d (patch)
treefe37d6ef4e2defaf4d3fd39e5c3f81f616fe7f0f /tools
parentb19763a3ea7eae146859a7b79cd22f6cbb52540b (diff)
downloadFreeBSD-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-xtools/tools/genericize/genericize.pl16
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}) {
OpenPOWER on IntegriCloud