Skip to content
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
@swsnr

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions