diff options
Diffstat (limited to 'test/run_input.cxx')
-rw-r--r-- | test/run_input.cxx | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/test/run_input.cxx b/test/run_input.cxx index 3817ed418..0c1ba1d36 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -33,21 +33,13 @@ #include "ArchiveList.hxx" #endif +#ifdef HAVE_GLIB #include <glib.h> +#endif #include <unistd.h> #include <stdlib.h> -static void -my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level, - const gchar *message, gcc_unused gpointer user_data) -{ - if (log_domain != NULL) - g_printerr("%s: %s\n", log_domain, message); - else - g_printerr("%s\n", message); -} - static int dump_input_stream(InputStream *is) { @@ -58,27 +50,17 @@ dump_input_stream(InputStream *is) is->Lock(); - /* wait until the stream becomes ready */ - - is->WaitReady(); - - if (!is->Check(error)) { - LogError(error); - is->Unlock(); - return EXIT_FAILURE; - } - /* print meta data */ if (!is->mime.empty()) - g_printerr("MIME type: %s\n", is->mime.c_str()); + fprintf(stderr, "MIME type: %s\n", is->mime.c_str()); /* read data and tags from the stream */ while (!is->IsEOF()) { Tag *tag = is->ReadTag(); if (tag != NULL) { - g_printerr("Received a tag:\n"); + fprintf(stderr, "Received a tag:\n"); tag_save(stderr, *tag); delete tag; } @@ -114,17 +96,17 @@ int main(int argc, char **argv) int ret; if (argc != 2) { - g_printerr("Usage: run_input URI\n"); - return 1; + fprintf(stderr, "Usage: run_input URI\n"); + return EXIT_FAILURE; } /* initialize GLib */ +#ifdef HAVE_GLIB #if !GLIB_CHECK_VERSION(2,32,0) g_thread_init(NULL); #endif - - g_log_set_default_handler(my_log_func, NULL); +#endif /* initialize MPD */ @@ -147,7 +129,7 @@ int main(int argc, char **argv) Mutex mutex; Cond cond; - is = InputStream::Open(argv[1], mutex, cond, error); + is = InputStream::OpenReady(argv[1], mutex, cond, error); if (is != NULL) { ret = dump_input_stream(is); is->Close(); @@ -155,8 +137,8 @@ int main(int argc, char **argv) if (error.IsDefined()) LogError(error); else - g_printerr("input_stream::Open() failed\n"); - ret = 2; + fprintf(stderr, "input_stream::Open() failed\n"); + ret = EXIT_FAILURE; } /* deinitialize everything */ |