You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ttyname_r is a POSIX function for getting the name of any TTY, including a PTY, in an reentrant way. A POSIX (and nix::libc) compliant declaration is found in OpenBSD (bitrig too?), DragonFly, NetBSD, and FreeBSD -- so basically every value of target_os except Windows and the can be covered now.
Pseudocode:
Check via isatty that fd is a tty. If not, error. (ttyname_r will complain later too.)
Use sysconf to get TTY_NAME_MAX as sz. If not present or error, assume a default of 128.
Allocate a buffer of the size sz.
Call ttyname_r(fd, buf, sz).
Tame the C string.
A quick of this thing is that some implementations return the old style /dev/ttyp name.
Don't use it on the mac -- gnulib says Apple fucked the declaration up.
The text was updated successfully, but these errors were encountered:
ttyname_r
is a POSIX function for getting the name of any TTY, including a PTY, in an reentrant way. A POSIX (andnix::libc
) compliant declaration is found in OpenBSD (bitrig too?), DragonFly, NetBSD, and FreeBSD -- so basically every value oftarget_os
except Windows and the can be covered now.Pseudocode:
isatty
thatfd
is a tty. If not, error. (ttyname_r
will complain later too.)sysconf
to getTTY_NAME_MAX
as sz. If not present or error, assume a default of 128.ttyname_r(fd, buf, sz)
.A quick of this thing is that some implementations return the old style
/dev/ttyp
name.Don't use it on the mac -- gnulib says Apple fucked the declaration up.
The text was updated successfully, but these errors were encountered: