input/zeek-setup: Track parse_only globally

For easier access in scan.l
This commit is contained in:
Arne Welzel 2025-03-04 10:14:33 +01:00
parent 376913b509
commit e14f54b474
2 changed files with 3 additions and 0 deletions

View file

@ -42,6 +42,7 @@ class Stmt;
extern int zeek_argc; extern int zeek_argc;
extern char** zeek_argv; extern char** zeek_argv;
extern const char* prog; extern const char* prog;
extern bool parse_only;
extern std::vector<std::string> zeek_script_prefixes; // -p flag extern std::vector<std::string> zeek_script_prefixes; // -p flag
extern const char* command_line_policy; // -e flag extern const char* command_line_policy; // -e flag

View file

@ -218,6 +218,7 @@ zeek::OpaqueTypePtr histogram_metric_family_type;
// Keep copy of command line // Keep copy of command line
int zeek::detail::zeek_argc; int zeek::detail::zeek_argc;
char** zeek::detail::zeek_argv; char** zeek::detail::zeek_argv;
bool zeek::detail::parse_only = false;
namespace zeek { namespace zeek {
@ -483,6 +484,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
auto options = zopts ? *zopts : parse_cmdline(argc, argv); auto options = zopts ? *zopts : parse_cmdline(argc, argv);
run_state::detail::bare_mode = options.bare_mode; run_state::detail::bare_mode = options.bare_mode;
detail::parse_only = options.parse_only;
// Set up the global that facilitates access to analysis/optimization // Set up the global that facilitates access to analysis/optimization
// options from deep within some modules. // options from deep within some modules.