tFixed SETPROP() macro behaviour in config.def.h to handle escapes correctly. - surf - customized build of surf, the suckless webkit browser
 (HTM) git clone git://src.adamsgaard.dk/surf
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f6dc8b25418e541f7d7b9c3ce63c763918a15d90
 (DIR) parent 12101938d8df3da51871ed5d1da7c6144c2138cb
 (HTM) Author: Alexander Sedov <alex0player@gmail.com>
       Date:   Thu, 21 Mar 2013 20:49:10 +0400
       
       Fixed SETPROP() macro behaviour in config.def.h to handle escapes correctly.
       
       xprop prints information in format PROPERTY(STRING) = "escaped string",
       which causes problem with repeated Ctrl-F: any non-ascii turns into
       \ooo\ooo, this later turns into \\ooo\\ooo, and so on. To de-escape
       string, printf(1) is used, getting information from xargs -0; without -0
       xargs will try to handle escapes by itself and also do shenanigans
       with quotes, which is totally undesired.
       
       Signed-off-by: Christoph Lohmann <20h@r-36.net>
       
       Diffstat:
         M config.def.h                        |       2 +-
       
       1 file changed, 1 insertion(+), 1 deletion(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       t@@ -23,7 +23,7 @@ static Bool hidebackground  = FALSE;
        
        #define SETPROP(p, q) { \
                .v = (char *[]){ "/bin/sh", "-c", \
       -                "prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | dmenu`\" &&" \
       +                "prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | xargs -0 printf | dmenu`\" &&" \
                        "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
                        p, q, winid, NULL \
                } \