aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/console.c')
-rw-r--r--tools/console.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/console.c b/tools/console.c
index f07573fa..d0e6aaef 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -63,6 +63,25 @@ serd_set_base_uri_from_path(SerdEnv* const env, const char* const path)
return SERD_SUCCESS;
}
+SerdSyntax
+serd_choose_syntax(const SerdSyntax requested, const char* const filename)
+{
+ if (requested) {
+ return requested;
+ }
+
+ const SerdSyntax guessed = serd_guess_syntax(filename);
+ if (guessed != SERD_SYNTAX_EMPTY) {
+ return guessed;
+ }
+
+ fprintf(stderr,
+ "warning: unable to determine syntax of \"%s\", trying TriG\n",
+ filename);
+
+ return SERD_TRIG;
+}
+
/// Wrapper for getc that is compatible with SerdReadFunc but faster than fread
static size_t
serd_file_read_byte(void* buf, size_t size, size_t nmemb, void* stream)