put ignore_env into ObState

master
Daniel Kolesa 2015-10-16 00:09:16 +02:00
parent 4028bdef7d
commit 080153a373
1 changed files with 3 additions and 4 deletions

View File

@ -157,6 +157,7 @@ struct ObState {
CsState cs; CsState cs;
ConstCharRange progname; ConstCharRange progname;
int jobs = 1; int jobs = 1;
bool ignore_env = false;
struct SubRule { struct SubRule {
ConstCharRange sub; ConstCharRange sub;
@ -322,8 +323,6 @@ static int ob_print_help(ConstCharRange a0, ostd::Stream &os, int v) {
return v; return v;
} }
static bool ignore_env = false;
static void rule_add(const char *tgt, const char *dep, ostd::Uint32 *body) { static void rule_add(const char *tgt, const char *dep, ostd::Uint32 *body) {
auto targets = cscript::util::list_explode(tgt); auto targets = cscript::util::list_explode(tgt);
auto deps = dep ? cscript::util::list_explode(dep) auto deps = dep ? cscript::util::list_explode(dep)
@ -385,7 +384,7 @@ int main(int argc, char **argv) {
break; break;
} }
case 'E': case 'E':
ignore_env = true; os.ignore_env = true;
break; break;
default: default:
return ob_print_help(argv[0], ostd::err, 1); return ob_print_help(argv[0], ostd::err, 1);
@ -421,7 +420,7 @@ int main(int argc, char **argv) {
}); });
os.cs.add_commandn("getenv", "s", [](CsState &cs, TvalRange args) { os.cs.add_commandn("getenv", "s", [](CsState &cs, TvalRange args) {
if (ignore_env) { if (((ObState &)cs).ignore_env) {
cs.result->set_cstr(""); cs.result->set_cstr("");
return; return;
} }