Path: blob/main/vendor/github.com/chzyer/readline/term_bsd.go
2875 views
// Copyright 2013 The Go Authors. All rights reserved.1// Use of this source code is governed by a BSD-style2// license that can be found in the LICENSE file.34// +build darwin dragonfly freebsd netbsd openbsd56package readline78import (9"syscall"10"unsafe"11)1213func getTermios(fd int) (*Termios, error) {14termios := new(Termios)15_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCGETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)16if err != 0 {17return nil, err18}19return termios, nil20}2122func setTermios(fd int, termios *Termios) error {23_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCSETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)24if err != 0 {25return err26}27return nil28}293031