diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2015-09-21 11:24:49 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2015-09-22 18:08:00 -0700 |
commit | c1bd3b5824027f23b41bbac77c5e28f856c5dc18 (patch) | |
tree | f406ad2f859df99f65c059f8c4019d5a2db1e459 /src/builtin_test.cpp | |
parent | fb615843b329b4d3c303b9cebe2af134a52b5bfd (diff) |
Eliminate global variables associated with builtin IO
This change eliminates global variables like stdout_buffer. Instead we wrap up
the IO information into a new struct io_streams_t, and thread that through
every builtin. This makes the intent clearer, gives us a place to hang new IO
data, and eliminates the ugly global state management like builtin_push_io.
Diffstat (limited to 'src/builtin_test.cpp')
-rw-r--r-- | src/builtin_test.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/builtin_test.cpp b/src/builtin_test.cpp index 84d5fa9c..e80d06ec 100644 --- a/src/builtin_test.cpp +++ b/src/builtin_test.cpp @@ -23,7 +23,7 @@ enum }; -int builtin_test(parser_t &parser, wchar_t **argv); +int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv); namespace test_expressions { @@ -887,7 +887,7 @@ static bool unary_primary_evaluate(test_expressions::token_t token, const wcstri * Return status is the final shell status, i.e. 0 for true, * 1 for false and 2 for error. */ -int builtin_test(parser_t &parser, wchar_t **argv) +int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv) { using namespace test_expressions; @@ -912,7 +912,7 @@ int builtin_test(parser_t &parser, wchar_t **argv) } else { - builtin_show_error(L"[: the last argument must be ']'\n"); + streams.err.append(L"[: the last argument must be ']'\n"); return BUILTIN_TEST_FAIL; } @@ -948,7 +948,7 @@ int builtin_test(parser_t &parser, wchar_t **argv) } printf("and returned parse error: %ls\n", err.c_str()); #endif - builtin_show_error(err); + streams.err.append(err); return BUILTIN_TEST_FAIL; } else |