From 8a5c13cf786d75da71fd9d85a108dbb07be7b3d8 Mon Sep 17 00:00:00 2001 From: Curtis Gagliardi Date: Fri, 26 Jun 2015 12:27:29 -0700 Subject: [PATCH] Add support for DragonflyBSD and NetBSD. This merges all the bsd (including darwin) support into terminal_bsd.go Cross-compiling works for all of them in that they all compile, but I've only actually tested the binary on dragonflybsd. I don't see why this wouldn't work on the others since I don't think they'd compile if they didn't support TIOCGETA and Termios, but just a heads up. --- terminal_openbsd.go => terminal_bsd.go | 2 ++ terminal_darwin.go | 12 ------------ terminal_freebsd.go | 20 -------------------- terminal_notwindows.go | 2 +- 4 files changed, 3 insertions(+), 33 deletions(-) rename terminal_openbsd.go => terminal_bsd.go (67%) delete mode 100644 terminal_darwin.go delete mode 100644 terminal_freebsd.go diff --git a/terminal_openbsd.go b/terminal_bsd.go similarity index 67% rename from terminal_openbsd.go rename to terminal_bsd.go index af609a5..71f8d67 100644 --- a/terminal_openbsd.go +++ b/terminal_bsd.go @@ -1,3 +1,5 @@ +// +build darwin freebsd openbsd netbsd dragonfly + package logrus import "syscall" diff --git a/terminal_darwin.go b/terminal_darwin.go deleted file mode 100644 index 8fe02a4..0000000 --- a/terminal_darwin.go +++ /dev/null @@ -1,12 +0,0 @@ -// Based on ssh/terminal: -// 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. - -package logrus - -import "syscall" - -const ioctlReadTermios = syscall.TIOCGETA - -type Termios syscall.Termios diff --git a/terminal_freebsd.go b/terminal_freebsd.go deleted file mode 100644 index 0428ee5..0000000 --- a/terminal_freebsd.go +++ /dev/null @@ -1,20 +0,0 @@ -/* - Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. -*/ -package logrus - -import ( - "syscall" -) - -const ioctlReadTermios = syscall.TIOCGETA - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/terminal_notwindows.go b/terminal_notwindows.go index b8bebc1..4bb5376 100644 --- a/terminal_notwindows.go +++ b/terminal_notwindows.go @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux darwin freebsd openbsd +// +build linux darwin freebsd openbsd netbsd dragonfly package logrus