2016-07-21 19:31:42 +03:00
|
|
|
// Copyright 2013 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2023-10-24 23:00:38 +03:00
|
|
|
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
|
2016-07-21 19:31:42 +03:00
|
|
|
// +build darwin dragonfly freebsd netbsd openbsd
|
|
|
|
|
|
|
|
package readline
|
|
|
|
|
2017-03-13 02:57:45 +03:00
|
|
|
import (
|
2023-10-24 23:00:38 +03:00
|
|
|
"golang.org/x/sys/unix"
|
2017-03-13 02:57:45 +03:00
|
|
|
)
|
2016-07-21 19:31:42 +03:00
|
|
|
|
2017-03-13 02:57:45 +03:00
|
|
|
func getTermios(fd int) (*Termios, error) {
|
2023-10-24 23:00:38 +03:00
|
|
|
termios, err := unix.IoctlGetTermios(fd, unix.TIOCGETA)
|
|
|
|
return (*Termios)(termios), err
|
2017-03-13 02:57:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func setTermios(fd int, termios *Termios) error {
|
2023-10-24 23:00:38 +03:00
|
|
|
return unix.IoctlSetTermios(fd, unix.TIOCSETA, (*unix.Termios)(termios))
|
2017-03-13 02:57:45 +03:00
|
|
|
}
|