1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright (C) 2002-2006 Jody Goldberg (jody@gnome.org)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of version 2.1 of the GNU Lesser General Public
9 * License as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 #include <gsf/gsf-utils.h>
23 #include <gsf/gsf-output-stdio.h>
24 #include <gsf/gsf-output-gzip.h>
29 test (int argc, char *argv[])
36 fprintf (stderr, "Usage : %s outfile\n", argv[0]);
40 output = gsf_output_stdio_new (argv[1], &err);
42 g_return_val_if_fail (err != NULL, 1);
44 g_warning ("'%s' error: %s", argv[1], err->message);
49 gzout = g_object_new (GSF_OUTPUT_GZIP_TYPE,
53 if (gsf_output_error (gzout)) {
54 g_warning ("'%s' error: %s", "gzip output", gsf_output_error (gzout)->message);
55 g_object_unref (gzout);
59 if (!gsf_output_printf (gzout,
60 "The %s sat on the %s.\n", "cat", "mat"))
62 if (!gsf_output_printf (gzout, "%d %ss sat on the %s.\n",
65 if (!gsf_output_puts (gzout,
66 "The quick brown fox is afraid of the cats.\n"))
68 if (!gsf_output_close (gzout))
70 if (!gsf_output_close (output))
72 g_object_unref (G_OBJECT (gzout));
73 g_object_unref (G_OBJECT (output));
79 main (int argc, char *argv[])
84 res = test (argc, argv);