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
{{ message }}
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
Currently term_size queries the standard streams to get the terminal size which fails if all are redirected.
However POSIX also provides means to directly get hold of the underlying terminal even if all streams are redirected, via ctermid. This function returns the path to the terminal device which we can then open() to get a file description for ioctl. While man 3 ctermid warns that open may fail, practically it never does, whereas redirection is somewhat common.
Would you mind to add a function which gets the terminal size from the controlling terminal?
The text was updated successfully, but these errors were encountered:
Currently term_size queries the standard streams to get the terminal size which fails if all are redirected.
However POSIX also provides means to directly get hold of the underlying terminal even if all streams are redirected, via
ctermid
. This function returns the path to the terminal device which we can thenopen()
to get a file description forioctl
. Whileman 3 ctermid
warns thatopen
may fail, practically it never does, whereas redirection is somewhat common.Would you mind to add a function which gets the terminal size from the controlling terminal?
The text was updated successfully, but these errors were encountered: