diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-08-14 16:10:21 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-08-14 16:10:21 +0200 |
commit | a5f8783bda10fe444bd70f61e404a21b226d82f7 (patch) | |
tree | 9d3e14065c911db26504f5f6c7e30bd2f66dd33e /examples/c-json-stdout | |
parent | 37e46a506ace9f010601a0429685c9c5eb4408b6 (diff) |
minor improvments
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/c-json-stdout')
-rw-r--r-- | examples/c-json-stdout/c-json-stdout.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/c-json-stdout/c-json-stdout.c b/examples/c-json-stdout/c-json-stdout.c index c6594588b..183d072ee 100644 --- a/examples/c-json-stdout/c-json-stdout.c +++ b/examples/c-json-stdout/c-json-stdout.c @@ -56,6 +56,7 @@ int main(void) if (bytes_read <= 0 || errno != 0) { + fprintf(stderr, "Remote end disconnected.\n"); break; } @@ -64,7 +65,7 @@ int main(void) { if (buf[nDPIsrvd_JSON_BYTES] != '{') { - fprintf(stderr, "BUG: JSON invalid opening character: '%c'", buf[nDPIsrvd_JSON_BYTES]); + fprintf(stderr, "BUG: JSON invalid opening character: '%c'\n", buf[nDPIsrvd_JSON_BYTES]); exit(1); } @@ -75,17 +76,17 @@ int main(void) if (errno == ERANGE) { - fprintf(stderr, "BUG: Size of JSON exceeds limit"); + fprintf(stderr, "BUG: Size of JSON exceeds limit\n"); exit(1); } if ((uint8_t *)json_str_start == buf) { - fprintf(stderr, "BUG: Missing size before JSON string: \"%.*s\"", nDPIsrvd_JSON_BYTES, buf); + fprintf(stderr, "BUG: Missing size before JSON string: \"%.*s\"\n", nDPIsrvd_JSON_BYTES, buf); exit(1); } if (json_bytes > sizeof(buf)) { - fprintf(stderr, "BUG: JSON string too big: %llu > %zu", json_bytes, sizeof(buf)); + fprintf(stderr, "BUG: JSON string too big: %llu > %zu\n", json_bytes, sizeof(buf)); exit(1); } if (json_bytes > buf_used) @@ -95,7 +96,7 @@ int main(void) if (buf[json_bytes - 1] != '}') { - fprintf(stderr, "BUG: Invalid JSON string: %.*s", (int)json_bytes, buf); + fprintf(stderr, "BUG: Invalid JSON string: %.*s\n", (int)json_bytes, buf); exit(1); } |