From 4d7bee151a03776a57db1fe0047de4214fb1b95d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 29 Aug 2004 19:45:50 +0000 Subject: [PATCH] Add -c option to preserve comments from GENERIC in the output. --- tools/tools/genericize/genericize.pl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/tools/genericize/genericize.pl b/tools/tools/genericize/genericize.pl index 3cef7b1f6cd8..9a1454318b8e 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 () { 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}) {