mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Make it possible to pass command line options through to scripts.
The feature is documented with the zeek_script_args variable in init-bare.zeek.
This commit is contained in:
parent
6902b645ba
commit
2bdc56dfcd
5 changed files with 69 additions and 2 deletions
|
@ -660,6 +660,16 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
|||
init_net_var();
|
||||
run_bif_initializers();
|
||||
|
||||
// Assign the script_args for command line processing in Zeek scripts.
|
||||
if ( ! options.script_args.empty() )
|
||||
{
|
||||
auto script_args_val = zeek::id::find_val("zeek_script_args")->AsVectorVal();
|
||||
for ( const string& script_arg: options.script_args )
|
||||
{
|
||||
script_args_val->Assign(script_args_val->Size(), zeek::make_intrusive<zeek::StringVal>(script_arg));
|
||||
}
|
||||
}
|
||||
|
||||
// Must come after plugin activation (and also after hash
|
||||
// initialization).
|
||||
binpac::FlowBuffer::Policy flowbuffer_policy;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue