1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
27 #include "yelp-magic-decompressor.h"
30 main (int argc
, char **argv
)
32 GConverter
*converter
;
34 GFileInputStream
*file_stream
;
40 g_printerr ("Usage: test-magic FILE\n");
44 file
= g_file_new_for_path (argv
[1]);
45 file_stream
= g_file_read (file
, NULL
, NULL
);
46 converter
= G_CONVERTER (yelp_magic_decompressor_new ());
47 stream
= g_converter_input_stream_new (G_INPUT_STREAM (file_stream
),
50 while ((bytes
= g_input_stream_read (stream
, buf
, 1024, NULL
, NULL
)) > 0) {
51 gchar
*out
= g_strndup (buf
, bytes
);