1998-12-02 20:58:08 +01:00
|
|
|
/* tty.c */
|
1999-02-14 12:15:47 +01:00
|
|
|
/* Copyright 1999 - Joseph Pranevich */
|
1998-12-02 20:58:08 +01:00
|
|
|
|
|
|
|
/* This is the console driver for TTY-based consoles, i.e. consoles
|
|
|
|
without cursor placement, etc. It's also a pretty decent starting
|
|
|
|
point for other driers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* When creating new drivers, you need to assign all the functions that
|
|
|
|
that driver supports into the driver struct. If it is a supplementary
|
|
|
|
driver, it should make sure to perserve the old values. */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "console.h"
|
|
|
|
#include "config.h"
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1998-12-02 20:58:08 +01:00
|
|
|
void TTY_Start()
|
|
|
|
{
|
|
|
|
/* This should be the root driver so we can ignore anything
|
|
|
|
already in the struct. */
|
|
|
|
|
|
|
|
driver.norefresh = FALSE;
|
|
|
|
|
|
|
|
driver.write = TTY_Write;
|
|
|
|
driver.getKeystroke = TTY_GetKeystroke;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TTY_Write(char output, int fg, int bg, int attribute)
|
|
|
|
{
|
|
|
|
/* We can discard all extended information. */
|
1998-12-09 16:43:03 +01:00
|
|
|
fprintf(driver.console_out, "%c", output);
|
1998-12-02 20:58:08 +01:00
|
|
|
}
|
|
|
|
|
1999-01-31 10:22:58 +01:00
|
|
|
void TTY_GetKeystroke(char *scan, char *ch)
|
1998-12-02 20:58:08 +01:00
|
|
|
{
|
|
|
|
/* All we have are character input things, nothing for extended */
|
|
|
|
/* This is just the TTY driver, after all. We'll cope. */
|
1998-12-09 16:43:03 +01:00
|
|
|
*ch = fgetc(driver.console_in);
|
1998-12-02 20:58:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|