Added check to fwrite for size == 0.
[wine/gsoc_dplay.git] / console / tty.c
blob278d5f85fbf12cbbd9cdf5e8ce1409590bfa6ab8
1 /*
2 * Copyright 1999 - Joseph Pranevich
4 * This is the console driver for TTY-based consoles, i.e. consoles
5 * without cursor placement, etc. It's also a pretty decent starting
6 * point for other drivers.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /* When creating new drivers, you need to assign all the functions that
24 that driver supports into the driver struct. If it is a supplementary
25 driver, it should make sure to perserve the old values. */
27 #include "config.h"
29 #include <stdio.h>
31 #include "console.h"
32 #include "windef.h"
33 void TTY_Start()
35 /* This should be the root driver so we can ignore anything
36 already in the struct. */
38 driver.norefresh = FALSE;
40 driver.write = TTY_Write;
41 driver.getKeystroke = TTY_GetKeystroke;
44 void TTY_Write(char output, int fg, int bg, int attribute)
46 /* We can discard all extended information. */
47 fprintf(driver.console_out, "%c", output);
50 void TTY_GetKeystroke(char *scan, char *ch)
52 /* All we have are character input things, nothing for extended */
53 /* This is just the TTY driver, after all. We'll cope. */
54 *ch = fgetc(driver.console_in);