annotate lib/pty.c @ 146:782f84694489

2003-4-25 Brian Masney <masneyb@gftp.org> * lib/rfc959.c - added IPV6 support (RFC2428). The only part of the project that isn't IPV6 ready is the proxy comparsion functions. * lib/protocols.c - change the hints.ai_family paramater from AF_INET to PF_UNSPEC * lib/gftp.h lib/misc.c lib/pty.c - moved the functionality of pty[ms]_open() to pty.c. Combined these 2 functions into open_ptys(), and there is one defined for each system type (lots of #define's in this file!) * lib/Makefile.am po/POTFILES.in - added pty.c * lib/sshv2.c - when searching for the password prompt, omit the first character in case it is capitalized. Also, use the new function open_ptys() * configure.in - search for openpty in -lutil. Also, define HAVE_OPENPTY if this function is present on the system
author masneyb
date Sat, 26 Apr 2003 15:26:42 +0000
parents
children 8beb7bfca92b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
146
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1 /*****************************************************************************/
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2 /* pty.c - general purpose routines */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4 /* */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5 /* This program is free software; you can redistribute it and/or modify */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6 /* it under the terms of the GNU General Public License as published by */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7 /* the Free Software Foundation; either version 2 of the License, or */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
8 /* (at your option) any later version. */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
9 /* */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
10 /* This program is distributed in the hope that it will be useful, */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
13 /* GNU General Public License for more details. */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
14 /* */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
15 /* You should have received a copy of the GNU General Public License */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
16 /* along with this program; if not, write to the Free Software */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
18 /*****************************************************************************/
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
19
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
20 static const char cvsid[] = "$Id$";
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
21
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
22 #include "gftp.h"
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
23
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
24
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
25 #ifdef __sgi
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
26
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
27 int
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
28 open_ptys (gftp_request * request, int *fdm, int *fds)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
29 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
30 char *pts_name;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
31
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
32 if ((pts_name = _getpty (fdm, O_RDWR, 0600, 0)) == NULL)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
33 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
34
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
35 if ((*fds = open (pts_name, O_RDWR)) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
36 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
37 close (*fdm);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
38 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
39 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
40
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
41 return (0);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
42 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
43
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
44 #else /* !__sgi */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
45
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
46 #ifdef HAVE_GRANTPT
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
47
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
48 int
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
49 open_ptys (gftp_request * request, int *fdm, int *fds)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
50 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
51 char *pts_name;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
52
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
53 if ((*fdm = open ("/dev/ptmx", O_RDWR)) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
54 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
55
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
56 if (grantpt (*fdm) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
57 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
58 close (*fdm);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
59 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
60 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
61
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
62 if (unlockpt (*fdm) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
63 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
64 close (*fdm);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
65 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
66 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
67
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
68 if ((pts_name = ptsname (*fdm)) == NULL)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
69 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
70 close (*fdm);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
71 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
72 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
73
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
74 if ((*fds = open (pts_name, O_RDWR)) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
75 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
76 close (*fdm);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
77 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
78 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
79
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
80 /* I intentionally ignore these errors */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
81 ioctl (*fds, I_PUSH, "ptem");
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
82 ioctl (*fds, I_PUSH, "ldterm");
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
83 ioctl (*fds, I_PUSH, "ttcompat");
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
84
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
85 return (0);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
86 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
87
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
88 #else /* !HAVE_GRANTPT */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
89
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
90 #ifdef HAVE_OPENPTY
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
91
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
92 int
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
93 open_ptys (gftp_request * request, int *fdm, int *fds)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
94 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
95 char *pts_name;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
96
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
97 if (openpty (fdm, fds, &pts_name, NULL, NULL ) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
98 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
99
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
100 ioctl (*fds, TIOCSCTTY, NULL);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
101
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
102 return (0);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
103 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
104
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
105 #else /* !HAVE_OPENPTY */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
106
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
107 /* Fall back to *BSD... */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
108
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
109 int
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
110 open_ptys (gftp_request * request, int *fdm, int *fds)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
111 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
112 char pts_name[20], *pos1, *pos2;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
113
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
114 strncpy (pts_name, "/dev/ptyXY", sizeof (pts_name));
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
115 for (pos1 = "pqrstuvwxyzPQRST"; *pos1 != '\0'; pos1++)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
116 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
117 pts_name[8] = *pos1;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
118 for (pos2 = "0123456789abcdef"; *pos2 != '\0'; pos2++)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
119 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
120 pts_name[9] = *pos2;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
121 if ((*fdm = open (pts_name, O_RDWR)) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
122 continue;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
123
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
124 pts_name[5] = 't';
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
125 chmod (pts_name, S_IRUSR | S_IWUSR);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
126 chown (pts_name, getuid (), -1);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
127
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
128 if ((*fds = open (pts_name, O_RDWR)) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
129 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
130 pts_name[5] = 'p';
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
131 continue;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
132 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
133
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
134 #if defined(TIOCSCTTY) && !defined(CIBAUD)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
135 ioctl (*fds, TIOCSCTTY, NULL);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
136 #endif
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
137
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
138 return (0);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
139 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
140 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
141
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
142 return (GFTP_ERETRYABLE);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
143 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
144
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
145 #endif /* HAVE_OPENPTY */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
146
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
147 #endif /* HAVE_GRANTPT */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
148
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
149 #endif /* __sgi */
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
150
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
151
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
152 int
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
153 tty_raw (int fd)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
154 {
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
155 struct termios buf;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
156
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
157 if (tcgetattr (fd, &buf) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
158 return (-1);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
159
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
160 buf.c_iflag |= IGNPAR;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
161 buf.c_iflag &= ~(ICRNL | ISTRIP | IXON | IGNCR | IXANY | IXOFF | INLCR);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
162 buf.c_lflag &= ~(ECHO | ICANON | ISIG | ECHOE | ECHOK | ECHONL);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
163 #ifdef IEXTEN
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
164 buf.c_lflag &= ~(IEXTEN);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
165 #endif
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
166
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
167 buf.c_oflag &= ~(OPOST);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
168 buf.c_cc[VMIN] = 1;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
169 buf.c_cc[VTIME] = 0;
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
170
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
171 if (tcsetattr (fd, TCSADRAIN, &buf) < 0)
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
172 return (-1);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
173 return (0);
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
174 }
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
175
782f84694489 2003-4-25 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
176