comparison lib/pty.c @ 232:b8d14c2c3097

2003-7-25 Brian Masney <masneyb@gftp.org> * lib/pty.c - prefer to use openpty() instead of grantpt() if it is available (for FreeBSD) * lib/sshv2.c - fixes for FreeBSD password prompt (from Oliver Lehmann <oliver@FreeBSD.ORG>) * src/gtk/gftp-gtk.h src/text/gftp-text.h - added __attribute__((format(printf, 3, 4))) to logging functions (from Oliver Lehmann <oliver@FreeBSD.ORG>)
author masneyb
date Fri, 25 Jul 2003 20:21:26 +0000
parents 82ebd1b05345
children 1638e32e6a35
comparison
equal deleted inserted replaced
231:e599812712f0 232:b8d14c2c3097
57 } 57 }
58 58
59 return (new_fds); 59 return (new_fds);
60 } 60 }
61 61
62 #elif HAVE_OPENPTY
63
64 char *
65 gftp_get_pty_impl (void)
66 {
67 return ("openpty");
68 }
69
70
71 static int
72 _gftp_ptym_open (char *pts_name, size_t len, int *fds)
73 {
74 int fdm;
75
76 if (openpty (&fdm, fds, pts_name, NULL, NULL) < 0)
77 return (GFTP_ERETRYABLE);
78
79 ioctl (*fds, TIOCSCTTY, NULL);
80
81 return (fdm);
82 }
83
84
85 static int
86 _gftp_ptys_open (int fdm, int fds, char *pts_name)
87 {
88 if (login_tty (fds) < 0)
89 return (GFTP_EFATAL);
90
91 return (fds);
92 }
93
62 #elif HAVE_GRANTPT 94 #elif HAVE_GRANTPT
63 95
64 char * 96 char *
65 gftp_get_pty_impl (void) 97 gftp_get_pty_impl (void)
66 { 98 {
120 #endif 152 #endif
121 153
122 return (new_fds); 154 return (new_fds);
123 } 155 }
124 156
125 #elif HAVE_OPENPTY 157 #else /* !HAVE_GRANTPT */
126
127 char *
128 gftp_get_pty_impl (void)
129 {
130 return ("openpty");
131 }
132
133
134 static int
135 _gftp_ptym_open (char *pts_name, size_t len, int *fds)
136 {
137 int fdm;
138
139 if (openpty (&fdm, fds, pts_name, NULL, NULL) < 0)
140 return (GFTP_ERETRYABLE);
141
142 ioctl (*fds, TIOCSCTTY, NULL);
143
144 return (fdm);
145 }
146
147
148 static int
149 _gftp_ptys_open (int fdm, int fds, char *pts_name)
150 {
151 if (login_tty (fds) < 0)
152 return (GFTP_EFATAL);
153
154 return (fds);
155 }
156
157 #else /* !HAVE_OPENPTY */
158 158
159 /* Fall back to *BSD... */ 159 /* Fall back to *BSD... */
160 160
161 char * 161 char *
162 gftp_get_pty_impl (void) 162 gftp_get_pty_impl (void)