instance method
MakeMakefile#egrep_cpp
egrep_cpp(pat, src, opt = "", &b)
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/mkmf.rb, line 923
def egrep_cpp(pat, src, opt = "", &b)
src = create_tmpsrc(src, &b)
xpopen(cpp_command('', opt)) do |f|
if Regexp === pat
puts(" ruby -ne 'print if #{pat.inspect}'")
f.grep(pat) {|l|
puts "#{f.lineno}: #{l}"
return true
}
false
else
puts(" egrep '#{pat}'")
begin
stdin = $stdin.dup
$stdin.reopen(f)
system("egrep", pat)
ensure
$stdin.reopen(stdin)
end
end
end
ensure
MakeMakefile.rm_f "#{CONFTEST}*"
log_src(src)
end
Returns whether or not the src can be preprocessed with the C preprocessor and matches with pat.
If a block given, it is called with the source before compilation. You can modify the source in the block.
NOTE: When pat is a Regexp the matching will be checked in process, otherwise egrep(1) will be invoked to check it.