aboutsummaryrefslogtreecommitdiff
path: root/lp.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-15 17:41:19 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-15 17:41:19 +0200
commit9a65aafab104564fb64e5b97f9628ef809a10379 (patch)
tree0eed6c1db0ba6aa0f781a3883ed5566d908ae3a7 /lp.go
parente2640ff058e077bf9de9a80394e649bbd819586c (diff)
Refactor Devicer
Diffstat (limited to 'lp.go')
-rw-r--r--lp.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/lp.go b/lp.go
index da0dfd0..2a36f07 100644
--- a/lp.go
+++ b/lp.go
@@ -5,20 +5,20 @@ import (
"os"
)
-type LPDevice struct {
+type LP struct {
*os.File
}
-func NewLPDevice(path string) (Devicer, error) {
+func NewLP(path string) (Devicer, error) {
f, err := os.OpenFile(path, os.O_RDWR, 0666)
- return LPDevice{f}, err
+ return LP{f}, err
}
-func (d LPDevice) Close() {
+func (d LP) Close() {
d.File.Close()
}
-func (d LPDevice) Handle() *bufio.ReadWriter {
+func (d LP) Handle() *bufio.ReadWriter {
r := bufio.NewReader(d.File)
w := bufio.NewWriter(d.File)
return bufio.NewReadWriter(r, w)