termios

package
v6.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package termios implements basic termios operations including getting a tty struct, termio struct, a winsize struct, and setting raw mode. To get a TTY, call termios.New. To get a Termios, call tty.Get(); to set it, call tty.Set(*Termios) To set raw mode and then restore, one can do: tty := termios.NewTTY() restorer, err := tty.Raw() do things tty.Set(restorer)

Index

Constants

View Source
const (
	I = iota // Input control
	O        // Output control
	C        // Control
	L        // Line control
)

These consts describe the offsets into the termios struct of various elements.

Variables

This section is empty.

Functions

func GTTY

func GTTY(fd int) (*tty, error)

GTTY returns the tty struct for a given fd. It is like a New in many packages but the name GTTY is a tradition.

func GetTermios

func GetTermios(fd uintptr) (*unix.Termios, error)

func GetWinSize

func GetWinSize(fd uintptr) (*unix.Winsize, error)

func MakeRaw

func MakeRaw(term *unix.Termios) *unix.Termios

func Raw

func Raw(fd int) (*tty, error)

Raw sets a tty into raw more, returning a tty struct

func SetTermios

func SetTermios(fd uintptr, ti *unix.Termios) error

func SetWinSize

func SetWinSize(fd uintptr, w *unix.Winsize) error

Types

type TTY

type TTY struct {
	// contains filtered or unexported fields
}

TTY is a wrapper that only allows Read and Write.

func New

func New() (*TTY, error)

func (*TTY) Get

func (t *TTY) Get() (*unix.Termios, error)

func (*TTY) GetWinSize

func (t *TTY) GetWinSize() (*unix.Winsize, error)

func (*TTY) Raw

func (t *TTY) Raw() (*unix.Termios, error)

func (*TTY) Read

func (t *TTY) Read(b []byte) (int, error)

func (*TTY) Set

func (t *TTY) Set(ti *unix.Termios) error

func (*TTY) SetWinSize

func (t *TTY) SetWinSize(w *unix.Winsize) error

func (*TTY) Write

func (t *TTY) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL