1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * test-http.c:
4  *
5  * Copyright (C) 2006 Michael Lawrence (lawremi@iastate.edu)
6  *
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.
10  *
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.
15  *
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
19  * USA
20  */
21 
22 #include <gsf/gsf-input-http.h>
23 #include <gsf/gsf-utils.h>
24 
25 #include <stdio.h>
26 
27 static int
test(int argc,char * argv[])28 test (int argc, char *argv[])
29 {
30 	GsfInput *input;
31 	GError   *err = NULL;
32 	int i;
33 
34 	for (i = 1 ; i < argc ; i++) {
35 		puts (argv[i]);
36 		input = gsf_input_http_new (argv[i], &err);
37 		if (input == NULL) {
38 
39 			g_return_val_if_fail (err != NULL, 1);
40 
41 			g_warning ("'%s' error: %s", argv[i], err->message);
42 			g_error_free (err);
43 			err = NULL;
44 			continue;
45 		}
46 
47 		gsf_input_dump (input, FALSE);
48 
49 		g_object_unref (G_OBJECT (input));
50 	}
51 
52 	return 0;
53 }
54 
55 int
main(int argc,char * argv[])56 main (int argc, char *argv[])
57 {
58 	int res;
59 
60 	gsf_init ();
61 	res = test (argc, argv);
62 	gsf_shutdown ();
63 
64 	return res;
65 }
66