summaryrefslogtreecommitdiff
path: root/gpsdecode.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-27 20:54:50 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-27 20:54:50 +0000
commit2fd85e7925b5cc7bb94ed9183004cd0b975a61d1 (patch)
tree1cbfb12fffe10fa6242075cb7311f4dbb52db85a /gpsdecode.c
parent195c8ccbd426de1163768c3d2f6a7dccc82844a6 (diff)
downloadgpsd-2fd85e7925b5cc7bb94ed9183004cd0b975a61d1.tar.gz
Allow RTCM2 encoder to ignore comments.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r--gpsdecode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gpsdecode.c b/gpsdecode.c
index d5a8f851..055706ca 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -128,13 +128,17 @@ static void encode(FILE *fpin, FILE *fpout)
char buf[BUFSIZ];
struct gps_packet_t lexer;
struct rtcm2_t rtcm;
+ int lineno = 0;
memset(&lexer, 0, sizeof(lexer));
while (fgets(buf, (int)sizeof(buf), fpin) != NULL) {
int status;
char dummypath[PATH_MAX];
- if (buf[0] == '{')
+ ++lineno;
+ if (buf[0] == '#')
+ continue;
+ else if (buf[0] == '{')
status = json_rtcm2_read(buf,
dummypath, sizeof(dummypath),
&rtcm,
@@ -150,7 +154,7 @@ static void encode(FILE *fpin, FILE *fpout)
(void) fprintf(stderr, "gpsdecode: report write failed.\n");
memset(&lexer, 0, sizeof(lexer));
} else if (status < 0) {
- (void) fprintf(stderr, "gpsdecode: bailing out with status %d\n", status);
+ (void) fprintf(stderr, "gpsdecode: bailing out with status %d on line %d\n", status, lineno);
exit(1);
}
}