From 2bc0c1124aa07cf61f1d1f9d5f41445f18efe3ca Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Wed, 22 Sep 2010 23:01:03 +0200 Subject: [PATCH] Pretty-print for string2index Turns unhelpful wmaker: warning: wrong option value for key "NewStyle". Should be one of new, old, next into helpful wmaker: warning: wrong option value for key "NewStyle". Got "YES", should be one of "new", "old", "next" Signed-off-by: Tamas TEVESZ --- src/defaults.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/defaults.c b/src/defaults.c index 9333e3be..11bf6510 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1206,10 +1206,14 @@ static int string2index(WMPropList * key, WMPropList * val, char *def, WOptionEn if (!v->is_alias) { if (buffer[0] != 0) strcat(buffer, ", "); - strcat(buffer, v->string); + snprintf(buffer+strlen(buffer), + sizeof(buffer)-strlen(buffer)-1, "\"%s\"", v->string); } } - wwarning(_("wrong option value for key \"%s\". Should be one of %s"), WMGetFromPLString(key), buffer); + wwarning(_("wrong option value for key \"%s\". Got \"%s\", should be one of %s"), + WMGetFromPLString(key), + WMIsPLString(val) ? WMGetFromPLString(val) : "(unknown)", + buffer); if (def) { return string2index(key, val, NULL, values);