libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / system / libroot / posix / stdlib / pty.cpp
blob78c43bcb99e205a9b683f6ae826dd235c4aa74d7
1 /*
2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
6 #include <stdlib.h>
8 #include <fcntl.h>
9 #include <stdio.h>
11 #include <SupportDefs.h>
13 #include <tty.h>
16 int
17 posix_openpt(int openFlags)
19 return open("/dev/ptmx", openFlags);
23 int
24 grantpt(int masterFD)
26 return ioctl(masterFD, B_IOCTL_GRANT_TTY);
30 char*
31 ptsname(int masterFD)
33 int32 index;
34 if (ioctl(masterFD, B_IOCTL_GET_TTY_INDEX, &index, sizeof(index)) < 0)
35 return NULL;
37 static char buffer[32];
39 char letter = 'p';
40 snprintf(buffer, sizeof(buffer), "/dev/tt/%c%" B_PRIx32,
41 char(letter + index / 16), index % 16);
43 return buffer;
47 int
48 unlockpt(int masterFD)
50 // Noting to do ATM.
51 return 0;