mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Some small layout tweaks that didn't get committed with the last merge.
This commit is contained in:
parent
eb1e76600c
commit
1a46d78584
4 changed files with 38 additions and 25 deletions
14
src/Net.h
14
src/Net.h
|
@ -96,12 +96,16 @@ struct ScannedFile {
|
|||
ino_t inode;
|
||||
int include_level;
|
||||
string name;
|
||||
string subpath; // path in BROPATH's policy/ containing the file
|
||||
bool skipped; // This ScannedFile was @unload'd
|
||||
bool prefixes_checked; // if loading prefixes for this file has been tried
|
||||
string subpath; // Path in BROPATH's policy/ containing the file.
|
||||
bool skipped; // This ScannedFile was @unload'd.
|
||||
bool prefixes_checked; // If loading prefixes for this file has been tried.
|
||||
|
||||
ScannedFile(ino_t arg_inode, int arg_include_level, string arg_name, string arg_subpath = "", bool arg_skipped = false, bool arg_prefixes_checked = false)
|
||||
: inode(arg_inode), include_level(arg_include_level), name(arg_name), subpath(arg_subpath), skipped(arg_skipped), prefixes_checked(arg_prefixes_checked)
|
||||
ScannedFile(ino_t arg_inode, int arg_include_level, string arg_name,
|
||||
string arg_subpath = "", bool arg_skipped = false,
|
||||
bool arg_prefixes_checked = false)
|
||||
: inode(arg_inode), include_level(arg_include_level),
|
||||
name(arg_name), subpath(arg_subpath), skipped(arg_skipped),
|
||||
prefixes_checked(arg_prefixes_checked)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
@ -962,7 +962,9 @@ int main(int argc, char** argv)
|
|||
// Queue events reporting loaded scripts.
|
||||
for ( std::list<ScannedFile>::iterator i = files_scanned.begin(); i != files_scanned.end(); i++ )
|
||||
{
|
||||
if ( i->skipped ) continue;
|
||||
if ( i->skipped )
|
||||
continue;
|
||||
|
||||
val_list* vl = new val_list;
|
||||
vl->append(new StringVal(i->name.c_str()));
|
||||
vl->append(new Val(i->include_level, TYPE_COUNT));
|
||||
|
|
33
src/scan.l
33
src/scan.l
|
@ -806,34 +806,39 @@ int yywrap()
|
|||
check_capture_filter_changes();
|
||||
check_dpd_config_changes();
|
||||
|
||||
// For each file scanned so far, and for each @prefix, look for
|
||||
// a prefixed and flattened version of the loaded file in BROPATH.
|
||||
// The flattening involves taking the path in BROPATH in which
|
||||
// the scanned file lives and replacing '/' path separators with a '.'
|
||||
// If the scanned file is "__load__.bro", that part of the flattened file
|
||||
// name is discarded.
|
||||
// If the prefix is non-empty, it gets placed in front of the flattened
|
||||
// path, separated with another '.'
|
||||
// For each file scanned so far, and for each @prefix, look for a
|
||||
// prefixed and flattened version of the loaded file in BROPATH. The
|
||||
// flattening involves taking the path in BROPATH in which the
|
||||
// scanned file lives and replacing '/' path separators with a '.' If
|
||||
// the scanned file is "__load__.bro", that part of the flattened
|
||||
// file name is discarded. If the prefix is non-empty, it gets placed
|
||||
// in front of the flattened path, separated with another '.'
|
||||
std::list<ScannedFile>::iterator it;
|
||||
bool found_prefixed_files = false;
|
||||
for ( it = files_scanned.begin(); it != files_scanned.end(); ++it )
|
||||
{
|
||||
if ( it->skipped || it->prefixes_checked ) continue;
|
||||
if ( it->skipped || it->prefixes_checked )
|
||||
continue;
|
||||
|
||||
it->prefixes_checked = true;
|
||||
// prefixes are pushed onto a stack, so iterate backwards
|
||||
// Prefixes are pushed onto a stack, so iterate backwards.
|
||||
for ( int i = prefixes.length() - 1; i >= 0; --i )
|
||||
{
|
||||
// don't look at empty prefixes
|
||||
if ( ! prefixes[i][0] ) continue;
|
||||
// Don't look at empty prefixes.
|
||||
if ( ! prefixes[i][0] )
|
||||
continue;
|
||||
|
||||
string s;
|
||||
s = dot_canon(it->subpath.c_str(), it->name.c_str(), prefixes[i]);
|
||||
FILE* f = search_for_file(s.c_str(), "bro", 0, false, 0);
|
||||
|
||||
//printf("====== prefix search ======\n");
|
||||
//printf("File : %s\n", it->name.c_str());
|
||||
//printf("Path : %s\n", it->subpath.c_str());
|
||||
//printf("Dotted: %s\n", s.c_str());
|
||||
//printf("Found : %s\n", f ? "T" : "F");
|
||||
//printf("===========================\n");
|
||||
|
||||
if ( f )
|
||||
{
|
||||
add_input_file(s.c_str());
|
||||
|
@ -842,7 +847,9 @@ int yywrap()
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( found_prefixed_files ) return 0;
|
||||
|
||||
if ( found_prefixed_files )
|
||||
return 0;
|
||||
|
||||
// Add redef statements for any X=Y command line parameters.
|
||||
if ( params.size() > 0 )
|
||||
|
|
|
@ -972,8 +972,8 @@ FILE* search_for_file(const char* filename, const char* ext,
|
|||
|
||||
char path[1024], full_filename_buf[1024];
|
||||
|
||||
// append the currently loading script's path to BROPATH so that
|
||||
// @loads can be referenced relatively
|
||||
// Append the currently loading script's path to BROPATH so that
|
||||
// @loads can be referenced relatively.
|
||||
if ( current_scanned_file_path != "" )
|
||||
safe_snprintf(path, sizeof(path), "%s:%s", bro_path(),
|
||||
current_scanned_file_path.c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue