From 09c231965f9f8e8f1e86f127a22f112d63ef4d9b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 20 Apr 2021 22:48:59 +0300 Subject: Add buildscript depdb builtin 'env' command --- libbuild2/script/script.cxx | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'libbuild2/script/script.cxx') diff --git a/libbuild2/script/script.cxx b/libbuild2/script/script.cxx index db53418..298d71f 100644 --- a/libbuild2/script/script.cxx +++ b/libbuild2/script/script.cxx @@ -818,18 +818,34 @@ namespace build2 // void verify_environment_var_name (const string& name, - const char* opt, const char* prefix, - const location& l) + const location& l, + const char* opt) { if (name.empty ()) - fail (l) << prefix << "empty value for option " << opt; + { + diag_record dr (fail (l)); + dr << prefix << "empty "; + + if (opt == nullptr) + dr << "variable name"; + else + dr << "value for option " << opt; + } if (name.find ('=') != string::npos) - fail (l) << prefix << "invalid value '" << name << "' for option " - << opt << ": contains '='"; - } + { + diag_record dr (fail (l)); + dr << prefix << "invalid "; + + if (opt == nullptr) + dr << "variable name '" << name << "'"; + else + dr << "value '" << name << "' for option " << opt; + dr << ": contains '='"; + } + } void verify_environment_var_assignment (const string& var, -- cgit v1.1