github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/pkg/termios/var_darwin.go (about)

     1  // Copyright 2021 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package termios
     6  
     7  import (
     8  	"syscall"
     9  
    10  	"golang.org/x/sys/unix"
    11  )
    12  
    13  // baud2unixB convert a baudrate to the corresponding unix const.
    14  var baud2unixB = map[int]uint64{
    15  	50:     unix.B50,
    16  	75:     unix.B75,
    17  	110:    unix.B110,
    18  	134:    unix.B134,
    19  	150:    unix.B150,
    20  	200:    unix.B200,
    21  	300:    unix.B300,
    22  	600:    unix.B600,
    23  	1200:   unix.B1200,
    24  	1800:   unix.B1800,
    25  	2400:   unix.B2400,
    26  	4800:   unix.B4800,
    27  	9600:   unix.B9600,
    28  	19200:  unix.B19200,
    29  	38400:  unix.B38400,
    30  	57600:  unix.B57600,
    31  	115200: unix.B115200,
    32  	230400: unix.B230400,
    33  }
    34  
    35  // init adds constants that are darwin-specific
    36  func init() {
    37  	extra := map[string]*bit{
    38  		// not in FreeBSD
    39  		"iutf8": {word: I, mask: syscall.IUTF8},
    40  		"ofill": {word: O, mask: syscall.OFILL},
    41  		"ofdel": {word: O, mask: syscall.OFDEL},
    42  	}
    43  	for k, v := range extra {
    44  		boolFields[k] = v
    45  	}
    46  }
    47  
    48  func toTermiosCflag(r uint64) uint64 { return r }