From: John Darrington Date: Wed, 14 Mar 2012 18:56:30 +0000 (+0100) Subject: Recode Dialog: Stringify the variable label X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c63b9114455a67a23986fb62035a1ff2a0573588;p=pspp Recode Dialog: Stringify the variable label Ensure that the generated syntax has quotes around the variable label, in case the label happens to contain spaces or other metacharacters. --- diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c index 97a25cf232..012b2f26c1 100644 --- a/src/ui/gui/recode-dialog.c +++ b/src/ui/gui/recode-dialog.c @@ -1078,8 +1078,15 @@ generate_syntax (const struct recode_dialog *rd) while (g_hash_table_iter_next (&iter, (void**) &var, (void**) &nlp)) { if (nlp->label) - g_string_append_printf (str, "\nVARIABLE LABELS %s %s.", - nlp->name, nlp->label); + { + struct string sl; + ds_init_empty (&sl); + syntax_gen_string (&sl, ss_cstr (nlp->label)); + g_string_append_printf (str, "\nVARIABLE LABELS %s %s.", + nlp->name, ds_cstr (&sl)); + + ds_destroy (&sl); + } } }