From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- 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 0000000..0f3e114 --- /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.3