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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Shaun McCance <shaunm@gnome.org
29 #include "yelp-magic-decompressor.h"
32 main (int argc
, char **argv
)
34 GConverter
*converter
;
36 GFileInputStream
*file_stream
;
42 g_printerr ("Usage: test-magic FILE\n");
48 file
= g_file_new_for_path (argv
[1]);
49 file_stream
= g_file_read (file
, NULL
, NULL
);
50 converter
= yelp_magic_decompressor_new ();
51 stream
= g_converter_input_stream_new (file_stream
, converter
);
53 while ((bytes
= g_input_stream_read (stream
, buf
, 1024, NULL
, NULL
)) > 0) {
54 gchar
*out
= g_strndup (buf
, bytes
);