diff options
| -rw-r--r-- | autorun.sh | 2 | ||||
| -rw-r--r-- | cmd/ipp/main.go | 15 |
2 files changed, 6 insertions, 11 deletions
@@ -1,3 +1,3 @@ #!/bin/bash -x cd "$(dirname "$0")" -exec ./bin/ipp -f +exec ./bin/ipp diff --git a/cmd/ipp/main.go b/cmd/ipp/main.go index 85207a8..16317e0 100644 --- a/cmd/ipp/main.go +++ b/cmd/ipp/main.go @@ -28,9 +28,6 @@ func main() { panic(err) } defer cv.Close() - if flag.NArg() == 0 { - select {} - } for i := 0; i < flag.NArg(); i += 2 { var msgType byte var msgData []byte @@ -39,12 +36,10 @@ func main() { } else { msgType = byte(n) } - if flag.NArg() >= i { - if bs, err := hex.DecodeString(flag.Arg(i + 1)); err != nil { - panic(err) - } else { - msgData = bs - } + if bs, err := hex.DecodeString(flag.Arg(i + 1)); err != nil { + panic(err) + } else { + msgData = bs } if err := cv.SendIPP(msgType, msgData); err != nil { panic(err) @@ -56,7 +51,7 @@ func main() { } } } - if *follow { + if *follow || flag.NArg() == 0 { select {} } } |