From 27435c699baee43a12e025d8cfde2ee3cbe0ceb6 Mon Sep 17 00:00:00 2001 From: Keith Rarick Date: Sat, 16 Mar 2013 18:30:08 -0700 Subject: [PATCH] factor out docs --- doc.go | 11 +++++++++++ pty_darwin.go | 3 +-- pty_linux.go | 3 +-- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 doc.go diff --git a/doc.go b/doc.go new file mode 100644 index 0000000..491c060 --- /dev/null +++ b/doc.go @@ -0,0 +1,11 @@ +// Package pty provides functions for working with Unix terminals. +package pty + +import ( + "os" +) + +// Opens a pty and its corresponding tty. +func Open() (pty, tty *os.File, err error) { + return open() +} diff --git a/pty_darwin.go b/pty_darwin.go index c94a208..597bb03 100644 --- a/pty_darwin.go +++ b/pty_darwin.go @@ -10,8 +10,7 @@ import ( // see ioccom.h const sys_IOCPARM_MASK = 0x1fff -// Opens a pty and its corresponding tty. -func Open() (pty, tty *os.File, err error) { +func open() (pty, tty *os.File, err error) { p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0) if err != nil { return nil, nil, err diff --git a/pty_linux.go b/pty_linux.go index cecbbd6..3df1847 100644 --- a/pty_linux.go +++ b/pty_linux.go @@ -12,8 +12,7 @@ const ( sys_TIOCSPTLCK = 0x40045431 ) -// Opens a pty and its corresponding tty. -func Open() (pty, tty *os.File, err error) { +func open() (pty, tty *os.File, err error) { p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0) if err != nil { return nil, nil, err