tfuck it, the simpler, the better. now it works - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 62588254a8049aedcf8533623090458850141f0a
 (DIR) parent d73c716df2a3b7152cb0371ee0017e9276843af3
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Fri, 19 Dec 2014 01:00:22 +0100
       
       fuck it, the simpler, the better. now it works
       
       Diffstat:
         M wattr.c                             |      25 +++++++++++++++----------
       
       1 file changed, 15 insertions(+), 10 deletions(-)
       ---
 (DIR) diff --git a/wattr.c b/wattr.c
       t@@ -57,7 +57,7 @@ getattribute(xcb_window_t w, int attr)
        int
        main(int argc, char **argv)
        {
       -        int c, retval = 0;
       +        int c;
                size_t i;
                xcb_window_t w = 0;
        
       t@@ -70,7 +70,7 @@ main(int argc, char **argv)
        
                if (argc == 2) {
                        w = strtoul(argv[1], NULL, 16);
       -                retval = exists(conn, w) ? 0 : 1;
       +                exists(conn, w) ? exit(0) : exit(1);
                }
        
                for (c=2; argv[c]; c++) {
       t@@ -80,13 +80,18 @@ main(int argc, char **argv)
                                switch (argv[1][i]) {
                                        case 'i': printf("0x%08x", w);
                                                  break;
       -                                case 'b': printf("%d", getattribute(w, ATTR_B));break;
       -                                case 'h': printf("%d", getattribute(w, ATTR_H));break;
       -                                case 'x': printf("%d", getattribute(w, ATTR_X));break;
       -                                case 'y': printf("%d", getattribute(w, ATTR_Y));break;
       -                                case 'w': printf("%d", getattribute(w, ATTR_W));break;
       -                                case 'o': retval = ignore(conn, w) ? 0 : 1;
       -                                case 'm': retval = mapped(conn, w) ? 0 : 1;
       +                                case 'b': printf("%d", getattribute(w, ATTR_B));
       +                                          break;
       +                                case 'h': printf("%d", getattribute(w, ATTR_H));
       +                                          break;
       +                                case 'x': printf("%d", getattribute(w, ATTR_X));
       +                                          break;
       +                                case 'y': printf("%d", getattribute(w, ATTR_Y));
       +                                          break;
       +                                case 'w': printf("%d", getattribute(w, ATTR_W));
       +                                          break;
       +                                case 'o': ignore(conn, w) ? exit(0) : exit(1);
       +                                case 'm': mapped(conn, w) ? exit(0) : exit(1);
                                }
                                /* add a space if more attribute come after */
                                putc(i+1 < strlen(argv[1]) ? ' ' : '\n',stdout);
       t@@ -95,5 +100,5 @@ main(int argc, char **argv)
        
                kill_xcb(&conn);
        
       -        return retval;
       +        return 0;
        }