summaryrefslogtreecommitdiff
path: root/libgps.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2006-05-09 21:40:16 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2006-05-09 21:40:16 +0000
commit0af8a52b5d6157ca2d16626c1a1535717db6f437 (patch)
tree06d5ea7cd051b5c8a1ead851af8da1df839cb9d4 /libgps.c
parente704f4b076f8a011d26ee996547e577c1d202424 (diff)
downloadgpsd-0af8a52b5d6157ca2d16626c1a1535717db6f437.tar.gz
libgps is supposed to support sending and parsing compound queries...
(e.g. "PAMVTQ\n"), but without this patch, it only parses the first response (in the case of this example, it would parse the P value, but ignore the responses for A, M, V, T, and Q). >From Robin L. Darroch
Diffstat (limited to 'libgps.c')
-rw-r--r--libgps.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libgps.c b/libgps.c
index 44ee89fb..e4e73921 100644
--- a/libgps.c
+++ b/libgps.c
@@ -183,10 +183,11 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata)
for (ns = buf; ns; ns = strstr(ns+1, "GPSD")) {
if (/*@i1@*/strncmp(ns, "GPSD", 4) == 0) {
- for (sp = ns + 5; ; sp = tp) {
+ /* the following should execute each time we have a good next sp */
+ for (sp = ns + 5; *sp != '\0'; sp = tp+1) {
tp = sp + strcspn(sp, ",\r\n");
- if (*tp == '\0') break;
- *tp = '\0';
+ if (*tp == '\0') tp--;
+ else *tp = '\0';
switch (*sp) {
case 'A':