From 2b88931e03742318246b1275df9570853bcbfb89 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Thu, 8 Aug 2013 16:20:20 +0200 Subject: [PATCH] Unquote values of requested variables --- pkg.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg.c b/pkg.c index 66cd515..3697fec 100644 --- a/pkg.c +++ b/pkg.c @@ -1042,6 +1042,7 @@ packages_get_var (GList *pkgs, GList *tmp; GString *str; char *retval; + GError *error = NULL; str = g_string_new (""); @@ -1049,14 +1050,25 @@ packages_get_var (GList *pkgs, while (tmp != NULL) { Package *pkg = tmp->data; - char *var; + char *var, *unquoted_var; var = package_get_var (pkg, varname); - if (var) { - g_string_append (str, var); - g_string_append_c (str, ' '); + unquoted_var = g_shell_unquote (var, &error); + if (unquoted_var != NULL) + { + g_string_append (str, unquoted_var); + g_string_append_c (str, ' '); + g_free (unquoted_var); + } + else + { + verbose_error ("Couldn't unquote value of \"%s\": %s\n", + varname, error ? error->message : "unknown"); + g_clear_error (&error); + } + g_free (var); } -- 1.8.3.1