diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-08-26 08:44:50 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-08-26 08:44:50 -0400 |
commit | 810cc324b32a8647d86ef25458161d7c3a9b3588 (patch) | |
tree | f56507e6e499dbd81622f1b1713bb0c05e9709f9 /gpsdecode.c | |
parent | 8acece355d43923fd6c57de4b8357644f56b5a9d (diff) | |
download | gpsd-810cc324b32a8647d86ef25458161d7c3a9b3588.tar.gz |
A step towards fixing the socket_export=no build.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r-- | gpsdecode.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gpsdecode.c b/gpsdecode.c index 529f180a..7649518b 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -423,10 +423,13 @@ static void decode(FILE *fpin, FILE*fpout) if ((changed & PASSTHROUGH_IS) != 0) { (void)fputs((char *)session.packet.outbuffer, fpout); (void)fputs("\n", fpout); - } else + } +#ifdef SOCKET_EXPORT_ENABLE + else json_data_report(changed, &session.gpsdata, &policy, buf, sizeof(buf)); +#endif /* SOCKET_EXPORT_ENABLE */ (void)fputs(buf, fpout); #ifdef AIVDM_ENABLE } else if (session.packet.type == AIVDM_PACKET) { @@ -439,6 +442,7 @@ static void decode(FILE *fpin, FILE*fpout) } } +#ifdef SOCKET_EXPORT_ENABLE static void encode(FILE *fpin, FILE *fpout) /* JSON format on fpin to JSON on fpout - idempotency test */ { @@ -470,6 +474,7 @@ static void encode(FILE *fpin, FILE *fpout) } } /*@ +compdestroy +compdef +usedef @*/ +#endif /* SOCKET_EXPORT_ENABLE */ int main(int argc, char **argv) { @@ -535,9 +540,14 @@ int main(int argc, char **argv) //argc -= optind; //argv += optind; - if (mode == doencode) + if (mode == doencode) { +#ifdef SOCKET_EXPORT_ENABLE encode(stdin, stdout); - else +#else + (void)fprintf(stderr, "gpsdecode: encoding support isn't compiled.\n"); + exit(1); +#endif /* SOCKET_EXPORT_ENABLE */ + } else decode(stdin, stdout); exit(0); } |