diff options
Diffstat (limited to 'FugueConfig.pm')
-rw-r--r-- | FugueConfig.pm | 41 |
1 files changed, 26 insertions, 15 deletions
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(<FD>) { + 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 |