From 66d90dd412cd102879a1ceff83df5aad9f08a21c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 15 Dec 2013 17:12:43 +0100 Subject: test/*: use fprintf(stderr,...) and Log() instead of g_printerr() Avoid GLib. --- test/read_conf.cxx | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'test/read_conf.cxx') diff --git a/test/read_conf.cxx b/test/read_conf.cxx index d5eacec67..1f137e9a2 100644 --- a/test/read_conf.cxx +++ b/test/read_conf.cxx @@ -21,40 +21,26 @@ #include "ConfigGlobal.hxx" #include "fs/Path.hxx" #include "util/Error.hxx" - -#include +#include "Log.hxx" #include -static void -my_log_func(gcc_unused const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, gcc_unused gpointer user_data) -{ - if (log_level > G_LOG_LEVEL_WARNING) - return; - - g_printerr("%s\n", message); -} - int main(int argc, char **argv) { if (argc != 3) { - g_printerr("Usage: read_conf FILE SETTING\n"); - return 1; + fprintf(stderr, "Usage: read_conf FILE SETTING\n"); + return EXIT_FAILURE; } const Path config_path = Path::FromFS(argv[1]); const char *name = argv[2]; - g_log_set_default_handler(my_log_func, NULL); - config_global_init(); Error error; if (!ReadConfigFile(config_path, error)) { - g_printerr("%s:", error.GetMessage()); - return 1; + LogError(error); + return EXIT_FAILURE; } ConfigOption option = ParseConfigOptionName(name); @@ -63,11 +49,11 @@ int main(int argc, char **argv) : nullptr; int ret; if (value != NULL) { - g_print("%s\n", value); - ret = 0; + printf("%s\n", value); + ret = EXIT_SUCCESS; } else { - g_printerr("No such setting: %s\n", name); - ret = 2; + fprintf(stderr, "No such setting: %s\n", name); + ret = EXIT_FAILURE; } config_global_finish(); -- cgit v1.2.3