diff options
author | Dan Winship <danw@gnome.org> | 2012-07-02 09:34:18 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-07-13 14:18:35 -0400 |
commit | 04ee1a5d069fd3d212f510f6ce42afb66202c3ab (patch) | |
tree | 0b7fa764c75d6f4ede832a8acb58f3f9a184240f /tests | |
parent | 4d14f1393adaf3dbb00649624a565e801938f243 (diff) | |
download | libsoup-04ee1a5d069fd3d212f510f6ce42afb66202c3ab.tar.gz libsoup-04ee1a5d069fd3d212f510f6ce42afb66202c3ab.tar.bz2 libsoup-04ee1a5d069fd3d212f510f6ce42afb66202c3ab.zip |
Remove an unnecessary old demo program that doesn't work any more
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/getbug.c | 153 |
2 files changed, 0 insertions, 155 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 37db420b..995196c3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,7 +22,6 @@ noinst_PROGRAMS = \ dns \ forms-test \ get \ - getbug \ header-parsing \ misc-test \ ntlm-test \ @@ -56,7 +55,6 @@ get_SOURCES = get.c if BUILD_LIBSOUP_GNOME get_LDADD = $(top_builddir)/libsoup/libsoup-gnome-2.4.la endif -getbug_SOURCES = getbug.c header_parsing_SOURCES = header-parsing.c $(TEST_SRCS) misc_test_SOURCES = misc-test.c $(TEST_SRCS) ntlm_test_SOURCES = ntlm-test.c $(TEST_SRCS) diff --git a/tests/getbug.c b/tests/getbug.c deleted file mode 100644 index 1af3f53b..00000000 --- a/tests/getbug.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2001-2003, Ximian, Inc. - */ - -#include <ctype.h> -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <libsoup/soup.h> - -static GMainLoop *loop; - -static void -print_value (GValue *value) -{ -#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -#endif - if (G_VALUE_HOLDS_STRING (value)) - printf ("%s", g_value_get_string (value)); - else if (G_VALUE_HOLDS_INT (value)) - printf ("%d", g_value_get_int (value)); - else if (G_VALUE_HOLDS_DOUBLE (value)) - printf ("%f", g_value_get_double (value)); - else if (G_VALUE_TYPE (value) == G_TYPE_VALUE_ARRAY) { - GValueArray *array = g_value_get_boxed (value); - int i; - printf ("[ "); - for (i = 0; i < array->n_values; i++) { - if (i != 0) - printf (", "); - print_value (&array->values[i]); - } - printf (" ]"); - } else - printf ("(%s)", g_type_name (G_VALUE_TYPE (value))); -#ifdef G_GNUC_END_IGNORE_DEPRECATIONS -G_GNUC_END_IGNORE_DEPRECATIONS -#endif -} - -static void -print_struct_field (gpointer key, gpointer value, gpointer data) -{ - printf ("%s: ", (char *)key); - print_value (value); - printf ("\n"); -} - -static void -got_response (SoupSession *session, SoupMessage *msg, gpointer user_data) -{ - GHashTable *hash; - GError *error = NULL; - - if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { - fprintf (stderr, "%d %s\n", msg->status_code, msg->reason_phrase); - exit (1); - } - - if (!soup_xmlrpc_extract_method_response (msg->response_body->data, - msg->response_body->length, - &error, - G_TYPE_HASH_TABLE, &hash)) { - if (!error) { - fprintf (stderr, "Could not parse XMLRPC response:\n%d %s\n\n", - msg->status_code, msg->reason_phrase); - fprintf (stderr, "%s\n", msg->response_body->data); - } else { - fprintf (stderr, "XML-RPC error: %d %s", - error->code, error->message); - } - exit (1); - } - - g_hash_table_foreach (hash, print_struct_field, NULL); - g_hash_table_destroy (hash); - - g_main_loop_quit (loop); -} - -static void -usage (void) -{ - fprintf (stderr, "Usage: getbug [-p proxy_uri] [bugzilla-uri] bug-number\n"); - exit (1); -} - -int -main (int argc, char **argv) -{ - SoupSession *session; - SoupURI *proxy = NULL; - SoupMessage *msg; - const char *uri = "http://bugzilla.redhat.com/bugzilla/xmlrpc.cgi"; - int opt, bug; - - g_type_init (); - - while ((opt = getopt (argc, argv, "p:")) != -1) { - switch (opt) { - case 'p': - proxy = soup_uri_new (optarg); - if (!proxy) { - fprintf (stderr, "Could not parse %s as URI\n", - optarg); - exit (1); - } - break; - - case '?': - usage (); - break; - } - } - argc -= optind; - argv += optind; - - if (argc > 1) { - uri = argv[0]; - argc--; - argv++; - } - - if (argc != 1 || (bug = atoi (argv[0])) == 0) - usage (); - - session = soup_session_async_new_with_options ( - SOUP_SESSION_PROXY_URI, proxy, - NULL); - - msg = soup_xmlrpc_request_new (uri, "bugzilla.getBug", - G_TYPE_INT, bug, - G_TYPE_INVALID); - if (!msg) { - fprintf (stderr, "Could not create web service request to '%s'\n", uri); - exit (1); - } - soup_session_queue_message (session, SOUP_MESSAGE (msg), - got_response, NULL); - - loop = g_main_loop_new (NULL, TRUE); - g_main_loop_run (loop); - g_main_loop_unref (loop); - - return 0; -} |