diff options
| author | Petr Mrázek | 2011-08-01 03:31:52 +0200 |
|---|---|---|
| committer | Petr Mrázek | 2011-08-01 03:31:52 +0200 |
| commit | 331ada8f91008cd0232fedeb610e745a966dbae5 (patch) | |
| tree | d6557b51ff0743434a281c6063424216131bca9c /library/Console-linux.cpp | |
| parent | a36d8b0619abb824a0adcc38ab9d3f5a167d1b41 (diff) | |
| download | dfhack-331ada8f91008cd0232fedeb610e745a966dbae5.tar.gz dfhack-331ada8f91008cd0232fedeb610e745a966dbae5.tar.bz2 dfhack-331ada8f91008cd0232fedeb610e745a966dbae5.tar.xz | |
Don't take over console in TEXT mode.
Diffstat (limited to 'library/Console-linux.cpp')
| -rw-r--r-- | library/Console-linux.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/library/Console-linux.cpp b/library/Console-linux.cpp index c32a9065..e9dce679 100644 --- a/library/Console-linux.cpp +++ b/library/Console-linux.cpp @@ -601,7 +601,7 @@ Console::Console():std::ostream(0), std::ios(0) d = 0; inited = false; // we can't create the mutex at this time. the SDL functions aren't hooked yet. - wlock = 0; + wlock = new mutex(); } Console::~Console() { @@ -613,12 +613,18 @@ Console::~Console() delete d; } -bool Console::init(void) +bool Console::init(bool sharing) { + if(sharing) + { + inited = false; + return false; + } + freopen("stdout.log", "w", stdout); + freopen("stderr.log", "w", stderr); d = new Private(); // make our own weird streams so our IO isn't redirected d->dfout_C = fopen("/dev/tty", "w"); - wlock = new mutex(); rdbuf(d); std::cin.tie(this); clear(); @@ -628,6 +634,8 @@ bool Console::init(void) bool Console::shutdown(void) { + if(!d) + return true; lock_guard <mutex> g(*wlock); if(d->rawmode) d->disable_raw(); |
