summaryrefslogtreecommitdiff
path: root/nmea_parse.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-01-09 18:11:32 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-01-09 18:11:32 +0000
commiteceec9cfdafa4bec20f079c6646f27fdadf84130 (patch)
treef5e35d643bc000cc0420cb53aced45cb0e7d39d2 /nmea_parse.c
parent45905e5e528df766f4a58cf9fc8f5530a337e236 (diff)
downloadgpsd-eceec9cfdafa4bec20f079c6646f27fdadf84130.tar.gz
Skip checksum before splitting.
Diffstat (limited to 'nmea_parse.c')
-rw-r--r--nmea_parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/nmea_parse.c b/nmea_parse.c
index 50c5505e..91bfdfd1 100644
--- a/nmea_parse.c
+++ b/nmea_parse.c
@@ -482,6 +482,12 @@ int nmea_parse(char *sentence, struct gps_data_t *outdata)
#else
s = strdup(sentence); /* make a copy before we edit it. */
#endif
+
+ /* Find checksum part, and make sure we skip it when splitting. */
+ p = s;
+ while ((*p != '*') && (*p >= ' ')) ++p;
+ *p = '\0';
+
for (i = 0, p = s; p != NULL && *p != 0; ++i, p = strchr (p, ',')) {
*p = 0;
field[i] = ++p;