gpsd/gpsd-2.95-gpscatnoarg.patch

67 lines
1.9 KiB
Diff
Raw Normal View History

From ba90cdad2cc759e2b5ebb91fa374e57a868f142c Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 13 Sep 2010 15:16:17 +0200
Subject: [PATCH 1/2] Don't crash in gpscat when started without arguments.
---
gpscat | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/gpscat b/gpscat
index f51cacb..1fe98dd 100755
--- a/gpscat
+++ b/gpscat
@@ -31,6 +31,9 @@ def reporter(errlevel, msg):
if errlevel <= debuglevel:
sys.stdout.write(msg)
+def printusage():
+ sys.stderr.write("usage: gpscat [-s speed] serial-port\n")
+
if __name__ == '__main__':
buf = ""
try:
@@ -60,9 +63,13 @@ if __name__ == '__main__':
elif switch == '-D':
debuglevel = BASELEVEL + int(val)
elif switch == '-h':
- sys.stderr.write("usage: gpscat [-s speed] serial-port\n")
+ printusage()
raise SystemExit, 0
+ if (len(arguments) != 1):
+ printusage()
+ raise SystemExit, 1
+
if "rfcomm" in arguments[0]: # Bluetooth special case
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
s.connect((arguments[0], 1))
--
1.7.2
From 65a5b756eff38741cdb41851f8a2eaeaae1a0094 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon, 13 Sep 2010 15:19:00 +0200
Subject: [PATCH 2/2] Update gpscat usage text.
---
gpscat | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gpscat b/gpscat
index 1fe98dd..9e02084 100755
--- a/gpscat
+++ b/gpscat
@@ -32,7 +32,7 @@ def reporter(errlevel, msg):
sys.stdout.write(msg)
def printusage():
- sys.stderr.write("usage: gpscat [-s speed] serial-port\n")
+ sys.stderr.write("usage: gpscat [-s speed] [-p] [-t] [-D debuglevel] serial-port\n")
if __name__ == '__main__':
buf = ""
--
1.7.2