aboutsummaryrefslogtreecommitdiffstats
path: root/src/serdi.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-21 01:48:53 +0000
committerDavid Robillard <d@drobilla.net>2011-01-21 01:48:53 +0000
commit235eef1849b96bad3697f44c022f7a4e986299ff (patch)
treeb181c227bdc2c12e18a0df9a10bd0e36a9ded96a /src/serdi.c
parent8e86488fb0b644f95925d97dc8f25774e60da4c5 (diff)
downloadserd-235eef1849b96bad3697f44c022f7a4e986299ff.tar.gz
serd-235eef1849b96bad3697f44c022f7a4e986299ff.tar.bz2
serd-235eef1849b96bad3697f44c022f7a4e986299ff.zip
Make writer write to any sink passed in by the user.
git-svn-id: http://svn.drobilla.net/serd/trunk@20 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serdi.c')
-rw-r--r--src/serdi.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 549bf2bd..5db96388 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -123,6 +123,13 @@ print_usage(const char* name, bool error)
return error ? 1 : 0;
}
+static size_t
+file_sink(const void* buf, size_t len, void* stream)
+{
+ FILE* file = (FILE*)stream;
+ return fwrite(buf, 1, len, file);
+}
+
int
main(int argc, char** argv)
{
@@ -168,10 +175,10 @@ main(int argc, char** argv)
}
SerdNamespaces ns = serd_namespaces_new();
- State state = { serd_writer_new(SERD_NTRIPLES, ns, out_fd, &base_uri),
- ns,
- base_uri_str,
- base_uri };
+ State state = {
+ serd_writer_new(SERD_NTRIPLES, ns, &base_uri, file_sink, out_fd),
+ ns, base_uri_str, base_uri
+ };
SerdReader reader = serd_reader_new(
SERD_TURTLE, &state, event_base, event_prefix, event_statement);