4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.7 2008/02/27 01:31:14 james
14 * *** empty log message ***
16 * Revision 1.6 2008/02/27 00:54:16 james
17 * *** empty log message ***
19 * Revision 1.5 2008/02/24 00:42:53 james
20 * *** empty log message ***
22 * Revision 1.4 2008/02/23 13:05:58 staffcvs
23 * *** empty log message ***
25 * Revision 1.3 2008/02/13 16:57:29 james
26 * *** empty log message ***
28 * Revision 1.2 2008/02/13 09:12:21 james
29 * *** empty log message ***
31 * Revision 1.1 2008/02/13 01:08:38 james
32 * *** empty log message ***
39 wrap_read (int fd, void *buf, int len)
43 red = read (fd, buf, len);
47 if ((red < 0) && (errno == EAGAIN))
54 wrap_write (int fd, void *buf, int len)
60 writ = write (fd, buf, len);
65 if ((writ < 0) && (errno == EAGAIN))
73 set_nonblocking (int fd)
76 arg = fcntl (fd, F_GETFL, arg);
78 fcntl (fd, F_SETFL, arg);
85 arg = fcntl (fd, F_GETFL, arg);
87 fcntl (fd, F_SETFL, arg);
93 default_termios (struct termios *termios)
95 termios->c_iflag = PARMRK | INPCK;
96 termios->c_oflag = NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
98 termios->c_cflag = CS8 | CREAD | CLOCAL;
100 termios->c_cc[VINTR] = 003;
101 termios->c_cc[VQUIT] = 034;
102 termios->c_cc[VERASE] = 0177;
103 termios->c_cc[VKILL] = 025;
104 termios->c_cc[VEOF] = 004;
105 termios->c_cc[VEOL] = 0;
106 termios->c_cc[VEOL2] = 0;
107 termios->c_cc[VSTART] = 021;
108 termios->c_cc[VSTOP] = 023;
109 termios->c_cc[VSUSP] = 032;
110 termios->c_cc[VLNEXT] = 026;
111 termios->c_cc[VWERASE] = 027;
112 termios->c_cc[VREPRINT] = 022;
113 termios->c_cc[VDISCARD] = 017;
119 client_termios (struct termios *termios)
121 memset (termios, 0, sizeof (termios));
123 termios->c_iflag = ICRNL | IXON | PARMRK | INPCK;
124 termios->c_oflag = OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
126 ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
127 termios->c_cflag = CS8 | CREAD | CLOCAL;
129 termios->c_cc[VINTR] = 003;
130 termios->c_cc[VQUIT] = 034;
131 termios->c_cc[VERASE] = 0177;
132 termios->c_cc[VKILL] = 025;
133 termios->c_cc[VEOF] = 004;
134 termios->c_cc[VEOL] = 0;
135 termios->c_cc[VEOL2] = 0;
136 termios->c_cc[VSTART] = 021;
137 termios->c_cc[VSTOP] = 023;
138 termios->c_cc[VSUSP] = 032;
139 termios->c_cc[VLNEXT] = 026;
140 termios->c_cc[VWERASE] = 027;
141 termios->c_cc[VREPRINT] = 022;
142 termios->c_cc[VDISCARD] = 017;
145 cfsetispeed (termios, B9600);
146 cfsetospeed (termios, B9600);
150 fput_cp (FILE * f, uint32_t ch)
154 i = utf8_encode (buf, ch);
159 return fwrite (buf, i, 1, f);