diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2006-05-09 21:40:16 +0000 |
---|---|---|
committer | Chris Kuethe <chris.kuethe@gmail.com> | 2006-05-09 21:40:16 +0000 |
commit | 0af8a52b5d6157ca2d16626c1a1535717db6f437 (patch) | |
tree | 06d5ea7cd051b5c8a1ead851af8da1df839cb9d4 /libgps.c | |
parent | e704f4b076f8a011d26ee996547e577c1d202424 (diff) | |
download | gpsd-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.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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': |