From a7eb973ed219f9c6962018d34f9aec261d48dc73 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 26 Dec 2017 20:15:58 -0500 Subject: Add serdi option to write ASCII output --- src/serdi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/serdi.c b/src/serdi.c index 59dbaf35..e1a53845 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -83,6 +83,7 @@ print_usage(const char* name, bool error) fprintf(os, "Usage: %s [OPTION]... INPUT [BASE_URI]\n", name); fprintf(os, "Read and write RDF syntax.\n"); fprintf(os, "Use - for INPUT to read from standard input.\n\n"); + fprintf(os, " -a Write ASCII output if possible.\n"); fprintf(os, " -b Fast bulk output for large serialisations.\n"); fprintf(os, " -c PREFIX Chop PREFIX from matching blank node IDs.\n"); fprintf(os, " -e Eat input one character at a time.\n"); @@ -123,6 +124,7 @@ main(int argc, char** argv) SerdSyntax input_syntax = (SerdSyntax)0; SerdSyntax output_syntax = (SerdSyntax)0; bool from_file = true; + bool ascii = false; bool bulk_read = true; bool bulk_write = false; bool full_uris = false; @@ -138,6 +140,8 @@ main(int argc, char** argv) in_name = (const uint8_t*)"(stdin)"; in_fd = stdin; break; + } else if (argv[a][1] == 'a') { + ascii = true; } else if (argv[a][1] == 'b') { bulk_write = true; } else if (argv[a][1] == 'e') { @@ -230,7 +234,8 @@ main(int argc, char** argv) SerdEnv* env = serd_env_new(&base); int output_style = 0; - if (output_syntax == SERD_NTRIPLES || output_syntax == SERD_NQUADS) { + if (output_syntax == SERD_NTRIPLES || output_syntax == SERD_NQUADS || + ascii) { output_style |= SERD_STYLE_ASCII; } else if (output_syntax == SERD_TURTLE) { output_style |= SERD_STYLE_ABBREVIATED; -- cgit v1.2.1