From 0491250ad769448db7ca4d656d3cbfdbb1d6a7d7 Mon Sep 17 00:00:00 2001 From: yosh Date: Sat, 27 Jan 2024 20:16:29 -0500 Subject: [PATCH] void main, clarify readme --- README.md | 4 +++- bson2json.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 24811f8..6eef6d2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ bson2json < bson_file.bson > json_file.json bsonurl=$(curl https://some.server/api.php | jq -r '.link.filter') curl "$bsonurl" | bson2json | jq -r '.filter.to.a.specific.value' ``` -`bson2json` has *very minimal* error checking. it assumes that the bson files you give it will be valid. it doesn't tell you what byte errors occur (that'd be weird). if an unrecoverable error occurs, the exit code will be nonzero. as such, if you're not 100% sure that the bson files you are giving it will be valid, perhaps have a setup like so: +`bson2json` has *very minimal* error checking. it assumes that the bson files you give it will be valid. it doesn't tell you what byte errors occur (that'd be weird). if an unrecoverable error occurs, the exit code will be nonzero. + +additionally, `bson2json` does *not* buffer any input. if an error occurs halfway through, the output will be cut off json. as such, if you're not 100% sure that the bson files you are giving it will be valid, perhaps have a setup like so: ``` bson2json < bson_file.bson >/dev/null && bson2json < bson_file.bson | jq 'some_filter' ``` diff --git a/bson2json.c b/bson2json.c index fb2e066..15853a2 100644 --- a/bson2json.c +++ b/bson2json.c @@ -236,7 +236,7 @@ print_bson(uint8_t is_array) } int -main(int argc, char **argv) +main(void) { print_bson(0); printf("\n");