1 /* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
26 /* Prefix for master pseudo terminal nodes. */
27 #define _PATH_PTY "/dev/pty"
30 /* Letters indicating a series of pseudo terminals. */
32 #define PTYNAME1 "pqrsPQRS"
34 const char _ptyname1[] = PTYNAME1;
36 /* Letters indicating the position within a series. */
38 #define PTYNAME2 "0123456789abcdefghijklmnopqrstuv";
40 const char _ptyname2[] = PTYNAME2;
43 /* Open a master pseudo terminal and return its file descriptor. */
47 char buf[sizeof (_PATH_PTY) + 2];
51 __memcpy (buf, _PATH_PTY, sizeof (_PATH_PTY));
52 s = buf + __strlen (buf);
54 /* s[0] and s[1] will be filled in the loop. */
57 for (p = _ptyname1; *p != '\0'; ++p)
61 for (q = _ptyname2; *q != '\0'; ++q)
67 fd = __open (buf, O_RDWR);