Fixed typo in Czech translation
[yelp.git] / tests / test-lzma.c
blob32a143153518862f5236248eb4ac65c6979ffcd2
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Copyright (C) 2009 Shaun McCance <shaunm@gnome.org
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
18 * Author: Shaun McCance <shaunm@gnome.org
21 #include <config.h>
22 #include <stdio.h>
23 #include <string.h>
25 #include <gio/gio.h>
27 #include "yelp-lzma-decompressor.h"
29 int
30 main (int argc, char **argv)
32 GConverter *converter;
33 GFile *file;
34 GFileInputStream *file_stream;
35 GInputStream *stream;
36 gchar buf[1024];
37 gssize bytes;
39 if (argc < 2) {
40 g_printerr ("Usage: test-lzma FILE\n");
41 return 1;
44 file = g_file_new_for_path (argv[1]);
45 file_stream = g_file_read (file, NULL, NULL);
46 converter = G_CONVERTER (yelp_lzma_decompressor_new ());
47 stream = g_converter_input_stream_new (G_INPUT_STREAM (file_stream),
48 converter);
50 while ((bytes = g_input_stream_read (stream, buf, 1024, NULL, NULL)) > 0) {
51 gchar *out = g_strndup (buf, bytes);
52 puts (out);
53 g_free (out);
56 return 0;