tFixed wattr usage and manpage - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 62f0fe421dd4fd37a767309415fc7ea2d0556287
 (DIR) parent 74fcdf967195d1aa951d80f9938e33328624f886
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Fri,  9 Jan 2015 18:50:35 +0100
       
       Fixed wattr usage and manpage
       
       Diffstat:
         M man/wattr.1                         |       8 +++++++-
         M wattr.c                             |      40 +++++++++++++++++++------------
       
       2 files changed, 32 insertions(+), 16 deletions(-)
       ---
 (DIR) diff --git a/man/wattr.1 b/man/wattr.1
       t@@ -7,7 +7,7 @@
        .Nd get window attributes
        .Sh SYNOPSIS
        .Nm wattr
       -.Op Cm bmhwxy
       +.Op Cm bmiowhxy
        .Ar wid
        .Sh DESCRIPTION
        .Nm
       t@@ -26,6 +26,9 @@ will return 0 if
        .Ar wid
        exists, and 1 otherwise.
        .Bl -tag -width Ds
       +.It Cm i
       +Print
       +.Ar wid
        .It Cm b
        Print
        .Ar wid Ns \(cqs border width.
       t@@ -50,6 +53,9 @@ Print
        Print
        .Ar wid Ns \(cqs
        height.
       +.It Cm o
       +.Nm
       +returns 0 if the override_redirect attribute is set on the window.
        .It Cm m
        .Nm
        returns 0 if
 (DIR) diff --git a/wattr.c b/wattr.c
       t@@ -27,7 +27,7 @@ enum {
        static void
        usage(char *name)
        {
       -        fprintf(stderr, "usage: %s [-h] [bmiwhxy] <wid>\n", name);
       +        fprintf(stderr, "usage: %s [-h] [bmiowhxy] <wid>\n", name);
                exit(1);
        }
        
       t@@ -79,20 +79,30 @@ main(int argc, char **argv)
        
                        for (i=0; i<strlen(argv[1]); i++) {
                                switch (argv[1][i]) {
       -                                case 'i': printf("0x%08x", w);
       -                                          break;
       -                                case 'b': printf("%d", get_attribute(w, ATTR_B));
       -                                          break;
       -                                case 'h': printf("%d", get_attribute(w, ATTR_H));
       -                                          break;
       -                                case 'x': printf("%d", get_attribute(w, ATTR_X));
       -                                          break;
       -                                case 'y': printf("%d", get_attribute(w, ATTR_Y));
       -                                          break;
       -                                case 'w': printf("%d", get_attribute(w, ATTR_W));
       -                                          break;
       -                                case 'o': ret = ignore(conn, w) ? 0 : 1; goto end;
       -                                case 'm': ret = mapped(conn, w) ? 0 : 1; goto end;
       +                                case 'i':
       +                                        printf("0x%08x", w);
       +                                        break;
       +                                case 'b':
       +                                        printf("%d", get_attribute(w, ATTR_B));
       +                                        break;
       +                                case 'h': 
       +                                        printf("%d", get_attribute(w, ATTR_H));
       +                                        break;
       +                                case 'x':
       +                                        printf("%d", get_attribute(w, ATTR_X));
       +                                        break;
       +                                case 'y':
       +                                        printf("%d", get_attribute(w, ATTR_Y));
       +                                        break;
       +                                case 'w':
       +                                        printf("%d", get_attribute(w, ATTR_W));
       +                                        break;
       +                                case 'o':
       +                                        ret = ignore(conn, w) ? 0 : 1;
       +                                        goto end;
       +                                case 'm':
       +                                        ret = mapped(conn, w) ? 0 : 1;
       +                                        goto end;
                                        default: kill_xcb(&conn); usage(argv[0]);
                                }
                                /* add a space if more attribute come after */