From c945112e89222e697c3733c69eab685f606a5be5 Mon Sep 17 00:00:00 2001 From: james <> Date: Fri, 22 Jun 2012 10:22:25 +0000 Subject: *** empty log message *** --- src/raw.c | 63 +++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'src/raw.c') diff --git a/src/raw.c b/src/raw.c index 90960c6..48a1405 100644 --- a/src/raw.c +++ b/src/raw.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.11 2012/06/22 10:22:25 james + * *** empty log message *** + * * Revision 1.10 2011/02/28 18:10:43 james * *** empty log message *** * @@ -45,13 +48,15 @@ static char rcsid[] = "$Id$"; #include "project.h" -typedef struct { +typedef struct +{ RX_SIGNATURE; int rfd; int wfd; } RX_Raw; -typedef struct { +typedef struct +{ TTY_SIGNATURE; } RAW_TERMINAL; @@ -64,6 +69,8 @@ rx_raw_rx (RX * _r, int ch) uint8_t c = ch; set_blocking (r->wfd); ret = (write (r->wfd, &c, 1) == 1) ? 0 : -1; + + return ret; } static void @@ -89,7 +96,8 @@ rx_new_raw (int rfd, int wfd) return (RX *) ret; } -static int my_wrap_read (int fd, void *buf, int len) +static int +my_wrap_read (int fd, void *buf, int len) { int red; @@ -115,18 +123,19 @@ raw_terminal_read (TTY * _t, void *buf, int len) set_nonblocking (t->rfd); - do { + do + { - red = my_wrap_read (t->rfd, buf, len); - if (red < 0) - return done ? done:-1; - if (!red) - return done; + red = my_wrap_read (t->rfd, buf, len); + if (red < 0) + return done ? done : -1; + if (!red) + return done; - buf += red; - len -= red; - done += red; - } + buf += red; + len -= red; + done += red; + } while (len); @@ -134,6 +143,7 @@ raw_terminal_read (TTY * _t, void *buf, int len) } +#if 0 static int raw_terminal_write (TTY * _t, void *buf, int len) { @@ -142,24 +152,26 @@ raw_terminal_write (TTY * _t, void *buf, int len) set_blocking (t->wfd); - do { + do + { - writ = wrap_write (t->wfd, buf, len); - if (writ < 0) - return -1; + writ = wrap_write (t->wfd, buf, len); + if (writ < 0) + return -1; - if (!writ) - usleep (1000); + if (!writ) + usleep (1000); - buf += writ; - len -= writ; - done += writ; - } + buf += writ; + len -= writ; + done += writ; + } while (len); return done; } +#endif @@ -197,10 +209,12 @@ terminal_new_raw (int rfd, int wfd) return (TTY *) t; } +#if 0 static void ansi_raw_one_shot (ANSI * a, CRT * c) { } +#endif static int ansi_raw_key (ANSI * a, Context * c, int key) @@ -228,10 +242,11 @@ ansi_raw_dispatch (ANSI * a, Context * c) if (red <= 0) return red; - ansi_raw_parse (a, c, buf, red); + ansi_raw_parse (a, c, (uint8_t *) buf, red); return 0; } + static void ansi_raw_free (ANSI * a) { -- cgit v1.2.3