From fd2d8c2d7353292d99a8ae926cedd70339b9d393 Mon Sep 17 00:00:00 2001 From: etienne Date: Fri, 30 Nov 2007 09:46:26 +0000 Subject: --- FugueConfig.pm | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'FugueConfig.pm') diff --git a/FugueConfig.pm b/FugueConfig.pm index dfda1b0..9d74e5f 100644 --- a/FugueConfig.pm +++ b/FugueConfig.pm @@ -10,21 +10,32 @@ $rsh = "rsh" unless defined $rsh; # apply cpp to a fugue config file and open resulting pipe sub open { - my $file = shift; - my @cppopts = @_; - if (system("which cpp > /dev/null")) { - print "cpp command can't be located\n"; - return undef; - } elsif (not -f $file) { - print "No such file '$file'\n"; - return undef; - } elsif (not -r $file) { - print "'$file' is unreadable\n"; - return undef; - } - my $cppcmd = "cpp -traditional ".join(' ', @cppopts)." $file"; - open (FD, "$cppcmd |") or return undef; - return \*FD; + my $file = shift; + my @cppopts = @_; + if (system("which cpp > /dev/null")) { + print "cpp command can't be located\n"; + return undef; + } elsif (not -f $file) { + print "No such file '$file'\n"; + return undef; + } elsif (not -r $file) { + print "'$file' is unreadable\n"; + return undef; + } + my $cpp_options = join(' ', @cppopts); + open (FD, "$file") or return undef; + while() { + chomp; + if (/^#cpp_options\s*:\s*(.*)/) { + $cpp_options = $1; + last; + } + } + close(FD); + print "in ivylaunch, cpp options are [$cpp_options]\n"; + my $cppcmd = "cpp $file $cpp_options"; + open (FD, "$cppcmd |") or return undef; + return \*FD; } # end open -- cgit v1.1