aboutsummaryrefslogtreecommitdiffstats
path: root/src/raw.c
blob: 5e6b5868843ade0c295aae7c0b704a0caa107ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * raw.c:
 *
 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
 * All rights reserved.
 *
 */

static char rcsid[] = "$Id$";

/*
 * $Log$
 * 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;
}