diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index cf688f32d4..d35413d281 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -99,16 +99,16 @@ bool should_analyze(const ScriptFuncPtr& f, const StmtPtr& body) if ( ofiles.empty() && ofuncs.empty() ) return true; - auto fn = f->Name(); + auto fun = f->Name(); for ( auto& o : ofuncs ) - if ( std::regex_match(fn, o) ) + if ( std::regex_match(fun, o) ) return true; - fn = body->GetLocationInfo()->filename; + auto fin = util::detail::normalize_path(body->GetLocationInfo()->filename); for ( auto& o : ofiles ) - if ( std::regex_match(fn, o) ) + if ( std::regex_match(fin, o) ) return true; return false; @@ -296,7 +296,14 @@ static void init_options() if ( analysis_options.only_funcs.empty() ) { - auto zo = getenv("ZEEK_ONLY"); + auto zo = getenv("ZEEK_FUNC_ONLY"); + if ( zo ) + add_func_analysis_pattern(analysis_options, zo); + } + + if ( analysis_options.only_files.empty() ) + { + auto zo = getenv("ZEEK_FILE_ONLY"); if ( zo ) add_file_analysis_pattern(analysis_options, zo); }