aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/script/script.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-04-20 22:48:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-04-21 17:15:28 +0300
commit09c231965f9f8e8f1e86f127a22f112d63ef4d9b (patch)
treee1a8689a0053099719722ba45d35aa33d229fc1e /libbuild2/script/script.cxx
parent30da2a90b3d433160c06643fb7ca51722fbae6b8 (diff)
Add buildscript depdb builtin 'env' command
Diffstat (limited to 'libbuild2/script/script.cxx')
-rw-r--r--libbuild2/script/script.cxx28
1 files changed, 22 insertions, 6 deletions
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,