master
Daniel Kolesa 2015-10-18 01:01:11 +02:00
parent 6a965ab8f2
commit e348f58108
1 changed files with 8 additions and 5 deletions

13
main.cc
View File

@ -59,6 +59,10 @@ static bool ob_check_exec(ConstCharRange tname,
return ob_check_ts(tname, deps); return ob_check_ts(tname, deps);
} }
static ConstCharRange ob_get_env(ConstCharRange ename) {
return getenv(ostd::String(ename).data());
}
/* this lets us properly match % patterns in target names */ /* this lets us properly match % patterns in target names */
static ConstCharRange ob_compare_subst(ConstCharRange expanded, static ConstCharRange ob_compare_subst(ConstCharRange expanded,
ConstCharRange toexpand) { ConstCharRange toexpand) {
@ -425,12 +429,11 @@ int main(int argc, char **argv) {
cs.result->set_cstr(""); cs.result->set_cstr("");
return; return;
} }
const char *ret = getenv(args[0].get_str().data()); auto ret = ob_get_env(args[0].get_str());
if (!ret || !ret[0]) { if (ret.empty())
cs.result->set_cstr(""); cs.result->set_cstr("");
return; else
} cs.result->set_str_dup(ret);
cs.result->set_str_dup(ret);
}); });
cs_register_globs(os.cs); cs_register_globs(os.cs);