This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
Get size from controlling terminal? #34
Open
Description
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?
Metadata
Assignees
Labels
No labels