2 // Copyright (C) 2008 by Martin Moracek
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "vfs/console.h"
34 #include "vfs/vario.h"
38 bool ConsoleStream::ready
= false;
40 // write one character
41 int ConsoleBuffer::overflow(int c
)
45 sq_
.front().push_back(c
);
47 sq_
.push_front(std::string());
54 // write multiple characters
55 std::streamsize
ConsoleBuffer::xsputn(const char * s
, std::streamsize num
)
57 const char * sptr
= s
, * eptr
;
60 while((eptr
= strchr(sptr
, '\n'))) {
61 sq_
.push_front(std::string(sptr
, eptr
- sptr
));
65 sq_
.push_front(std::string(sptr
));
70 ConsoleStream::ConsoleStream(uint lines
/*=defConsoleLines*/)
71 : std::iostream(&buf_
), buf_(lines
)
76 ConsoleStream::~ConsoleStream()
81 int ConsoleStream::format(const char * fmt
, ...)
89 int t
= StreamPrintf(*this, fmt
, l_va
);