/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Copyright (C) 2009 Shaun McCance . * * Author: Shaun McCance #include #include #include #include "yelp-bz2-decompressor.h" int main (int argc, char **argv) { GConverter *converter; GFile *file; GFileInputStream *file_stream; GInputStream *stream; gchar buf[1024]; gssize bytes; if (argc < 2) { g_printerr ("Usage: test-bz2 FILE\n"); return 1; } file = g_file_new_for_path (argv[1]); file_stream = g_file_read (file, NULL, NULL); converter = G_CONVERTER (yelp_bz2_decompressor_new ()); stream = g_converter_input_stream_new (G_INPUT_STREAM (file_stream), converter); while ((bytes = g_input_stream_read (stream, buf, 1024, NULL, NULL)) > 0) { gchar *out = g_strndup (buf, bytes); puts (out); g_free (out); } return 0; }