Rich Felker | 750b738 | 2011-04-13 08:35:32 -0400 | [diff] [blame] | 1 | #include <stdlib.h> |
Rich Felker | c21a19d | 2012-06-20 15:11:27 -0400 | [diff] [blame] | 2 | #include <errno.h> |
Rich Felker | 750b738 | 2011-04-13 08:35:32 -0400 | [diff] [blame] | 3 | |
| 4 | int __ptsname_r(int, char *, size_t); |
| 5 | |
| 6 | char *ptsname(int fd) |
| 7 | { |
| 8 | static char buf[9 + sizeof(int)*3 + 1]; |
Rich Felker | c21a19d | 2012-06-20 15:11:27 -0400 | [diff] [blame] | 9 | int err = __ptsname_r(fd, buf, sizeof buf); |
| 10 | if (err) { |
| 11 | errno = err; |
| 12 | return 0; |
| 13 | } |
| 14 | return buf; |
Rich Felker | 750b738 | 2011-04-13 08:35:32 -0400 | [diff] [blame] | 15 | } |