/* * raw.c: * * Copyright (c) 2008 James McKenzie , * All rights reserved. * */ static char rcsid[] = "$Id$"; /* * $Log$ * Revision 1.2 2008/03/06 16:49:39 james * *** empty log message *** * * Revision 1.1 2008/03/06 16:49:05 james * *** empty log message *** * * */ #include "project.h" typedef struct { RX_SIGNATURE; int rfd; int wfd; } RX_Raw; static int rx_raw_rx (RX * _r, int ch) { RX_Raw *r = (RX_Raw *) _r; uint8_t c = ch; return (write (r->wfd, &c, 1) == 1) ? 0 : -1; } static void rx_raw_close (RX * r) { free (r); } RX * rx_new_raw (int rfd, int wfd) { RX_Raw *ret; ret = malloc (sizeof (RX_Raw)); memset (ret, 0, sizeof (RX_Raw)); ret->rx = rx_raw_rx; ret->close = rx_raw_close; ret->rfd = rfd; ret->wfd = wfd; return (RX *) ret; } TTY * terminal_new_raw (int rfd, int wfd) { //FIXME return NULL; } static void ansi_raw_one_shot (ANSI * a, CRT * c) { } static void ansi_raw_free (ANSI * a) { free (a); } ANSI * ansi_new_raw (int rfd, int wfd) { ANSI *ret; ret = malloc (sizeof (ANSI)); memset (ret, 0, sizeof (ANSI)); ret->terminal = terminal_new_raw (rfd, wfd); ret->close = ansi_raw_free; return ret; }