diff options
author | David Robillard <d@drobilla.net> | 2017-12-26 20:15:58 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-12-29 10:56:53 -0500 |
commit | a7eb973ed219f9c6962018d34f9aec261d48dc73 (patch) | |
tree | 42a30a1b481aa6123cfc7f2a4372fbb7ae5a9a8b /src | |
parent | 5d1b33259ae5ea31a71d0ec4ef9a4b546a771564 (diff) | |
download | serd-a7eb973ed219f9c6962018d34f9aec261d48dc73.tar.gz serd-a7eb973ed219f9c6962018d34f9aec261d48dc73.tar.bz2 serd-a7eb973ed219f9c6962018d34f9aec261d48dc73.zip |
Add serdi option to write ASCII output
Diffstat (limited to 'src')
-rw-r--r-- | src/serdi.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; |