From 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 12 Feb 2011 00:22:29 -0500 Subject: initial check-in, version 0.5.0 --- src/unistd/ttyname.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/unistd/ttyname.c (limited to 'src/unistd/ttyname.c') diff --git a/src/unistd/ttyname.c b/src/unistd/ttyname.c new file mode 100644 index 00000000..0f3e1141 --- /dev/null +++ b/src/unistd/ttyname.c @@ -0,0 +1,14 @@ +#include +#include +#include + +char *ttyname(int fd) +{ + static char buf[TTY_NAME_MAX]; + int result; + if ((result = ttyname_r(fd, buf, sizeof buf))) { + errno = result; + return NULL; + } + return buf; +} -- cgit v1.2.1