about summary refs log tree commit diff
path: root/src/misc/ptsname.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/ptsname.c')
-rw-r--r--src/misc/ptsname.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/misc/ptsname.c b/src/misc/ptsname.c
new file mode 100644
index 00000000..4f56781d
--- /dev/null
+++ b/src/misc/ptsname.c
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+
+int __ptsname_r(int, char *, size_t);
+
+char *ptsname(int fd)
+{
+	static char buf[9 + sizeof(int)*3 + 1];
+	return __ptsname_r(fd, buf, sizeof buf) < 0 ? 0 : buf;
+}