4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.2 2008/02/12 22:36:46 james
14 * *** empty log message ***
16 * Revision 1.1 2008/02/09 15:47:28 james
17 * *** empty log message ***
19 * Revision 1.2 2008/02/07 11:11:14 staffcvs
20 * *** empty log message ***
22 * Revision 1.1 2008/02/07 01:02:52 james
23 * *** empty log message ***
25 * Revision 1.3 2008/02/06 17:53:28 james
26 * *** empty log message ***
28 * Revision 1.2 2008/02/04 02:05:06 james
29 * *** empty log message ***
31 * Revision 1.1 2008/02/04 01:32:39 james
32 * *** empty log message ***
50 PTTY *t = (PTTY *) _t;
62 ptty_read (TTY * _t, void *buf, int len)
64 PTTY *t = (PTTY *) _t;
70 red = wrap_read (t->fd, buf, len);
88 ptty_write (TTY * _t, void *buf, int len)
91 PTTY *t = (PTTY *) _t;
96 writ = wrap_write (t->fd, buf, len);
113 ptty_open (char *path, char *argv[])
118 struct winsize winsize = { 0 };
119 struct termios termios;
121 char *default_argv = { "-", (char *) 0 };
123 child = forkpty (&fd, name, &termios, &winsize);
127 case -1: /*boo hiss */
130 setenv ("TERM", "vt102", 1);
131 setenv ("LANG", "C", 1);
142 set_nonblocking (fd);
144 t = (PTTY *) malloc (sizeof (PTTY));
146 strncpy (t->name, name, sizeof (t->name));
147 t->name[sizeof (t->name) - 1] = 0;
150 t->write = ptty_write;
151 t->close = ptty_close;
153 default_termios (&termios);
155 winsize.ws_row = VT102_ROWS;
156 winsize.ws_col = VT102_COLS;
158 t->fd = open_fd_to_pty (path, argv);