diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-02-25 00:01:11 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-02-25 00:01:11 -0500 |
commit | 14f96471e0206287729b85e084592e8f8bd9bf04 (patch) | |
tree | 37522c0f3733b35e84e0e07b923791a56e0482f2 /gpsdecode.c | |
parent | c6db088ca0b2869eea573931f0bb73eec5222376 (diff) | |
download | gpsd-14f96471e0206287729b85e084592e8f8bd9bf04.tar.gz |
Minor bug fix: packet echo shouldn't be pinned to stdout.
All regressions tests pass.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r-- | gpsdecode.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gpsdecode.c b/gpsdecode.c index 134dd232..57f88b0b 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -359,7 +359,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen) #endif /*@ -compdestroy -compdef -usedef -uniondef @*/ -static void decode(FILE * fpin, FILE * fpout) +static void decode(FILE *fpin, FILE *fpout) /* sensor data on fpin to dump format on fpout */ { struct gps_device_t session; @@ -367,12 +367,13 @@ static void decode(FILE * fpin, FILE * fpout) struct policy_t policy; char buf[GPS_JSON_RESPONSE_MAX * 4]; + memset(&policy, '\0', sizeof(policy)); + policy.json = json; + gps_context_init(&context); gpsd_init(&session, &context, NULL); gpsd_clear(&session); - memset(&policy, '\0', sizeof(policy)); session.gpsdata.gps_fd = fileno(fpin); - policy.json = json; for (;;) { @@ -381,7 +382,7 @@ static void decode(FILE * fpin, FILE * fpout) if (changed == ERROR_IS || changed == NODATA_IS) break; if (verbose >= 1 && TEXTUAL_PACKET_TYPE(session.packet.type)) - (void)fputs((char *)session.packet.outbuffer, stdout); + (void)fputs((char *)session.packet.outbuffer, fpout); if ((changed & (REPORT_IS|AIS_IS|RTCM2_IS|RTCM3_IS)) == 0) continue; /* |