root / Whitix / branches / hybrid / kernel / print.c

Revision 532, 1.2 kB (checked in by mwhitworth, 3 months ago)

Add KePrint, which redirects output to early console or console (if console exists).

Line 
1/*  This file is part of Whitix.
2 *
3 *  Whitix is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  Whitix is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with Whitix; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 */
18
19#include <module.h>
20#include <stdarg.h>
21#include <string.h>
22#include <typedefs.h>
23
24static void (*ConsoleOutput)(char* message, int length);
25
26void KeSetOutput(void (*newOutput)(char*, int))
27{
28        ConsoleOutput=newOutput;
29}
30
31SYMBOL_EXPORT(KeSetOutput);
32
33void KePrint(const char* message, ...)
34{
35        char buf[2048];
36        int length;
37        va_list args;
38
39        va_start(args, message);
40        length=vsprintf(buf, message, args);
41        va_end(args);
42
43        ConsoleOutput(buf, length);
44}
45
46SYMBOL_EXPORT(KePrint);
Note: See TracBrowser for help on using the browser.