ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/src/ptytty.C
(Generate patch)

Comparing libptytty/src/ptytty.C (file contents):
Revision 1.42 by sf-exg, Fri Nov 11 15:15:00 2011 UTC vs.
Revision 1.43 by sf-exg, Sun Nov 20 14:38:44 2011 UTC

76 get_pty (int *fd_tty, char **ttydev) 76 get_pty (int *fd_tty, char **ttydev)
77 { 77 {
78 int pfd; 78 int pfd;
79 79
80# if defined(HAVE_GETPT) 80# if defined(HAVE_GETPT)
81 pfd = getpt(); 81 pfd = getpt ();
82# elif defined(HAVE_POSIX_OPENPT) 82# elif defined(HAVE_POSIX_OPENPT)
83 pfd = posix_openpt (O_RDWR | O_NOCTTY); 83 pfd = posix_openpt (O_RDWR | O_NOCTTY);
84# else 84# else
85# ifdef _AIX 85# ifdef _AIX
86 pfd = open ("/dev/ptc", O_RDWR | O_NOCTTY, 0); 86 pfd = open ("/dev/ptc", O_RDWR | O_NOCTTY, 0);
156 const char *majors = "pqrstuvwxyzabcde"; 156 const char *majors = "pqrstuvwxyzabcde";
157 const char *minors = "0123456789abcdef"; 157 const char *minors = "0123456789abcdef";
158 158
159 for (i = 0; i < 256; i++) 159 for (i = 0; i < 256; i++)
160 { 160 {
161 snprintf(pty_name, 32, "/dev/pty%c%c", majors[i / 16], minors[i % 16]); 161 snprintf (pty_name, 32, "/dev/pty%c%c", majors[i / 16], minors[i % 16]);
162 snprintf(tty_name, 32, "/dev/tty%c%c", majors[i / 16], minors[i % 16]); 162 snprintf (tty_name, 32, "/dev/tty%c%c", majors[i / 16], minors[i % 16]);
163 163
164 if ((pfd = open (pty_name, O_RDWR | O_NOCTTY, 0)) == -1) 164 if ((pfd = open (pty_name, O_RDWR | O_NOCTTY, 0)) == -1)
165 { 165 {
166 snprintf(pty_name, 32, "/dev/ptyp%d", i); 166 snprintf (pty_name, 32, "/dev/ptyp%d", i);
167 snprintf(tty_name, 32, "/dev/ttyp%d", i); 167 snprintf (tty_name, 32, "/dev/ttyp%d", i);
168 if ((pfd = open (pty_name, O_RDWR | O_NOCTTY, 0)) == -1) 168 if ((pfd = open (pty_name, O_RDWR | O_NOCTTY, 0)) == -1)
169 continue; 169 continue;
170 } 170 }
171 171
172 if (access (tty_name, R_OK | W_OK) == 0) 172 if (access (tty_name, R_OK | W_OK) == 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines