twork on knf compliancy - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ee04273ec984b68711883faed2fbfae440d30de2
 (DIR) parent 14021c2836c9795c4581ff29336961a9bdbf9ec4
 (HTM) Author: dcat <dcat@iotek.org>
       Date:   Tue, 23 Dec 2014 15:43:43 +0100
       
       work on knf compliancy
       
       Diffstat:
         M chwb.c                              |      25 +++++++++++++------------
         M chwso.c                             |      28 ++++++++++++++++++----------
         M ignw.c                              |      16 ++++++++--------
         M killw.c                             |       4 ++--
         M lsw.c                               |      10 +++++-----
         M mapw.c                              |      17 ++++++++---------
         M wname.c                             |       2 +-
         M wtf.c                               |       2 +-
         M wtp.c                               |       4 ++--
       
       9 files changed, 58 insertions(+), 50 deletions(-)
       ---
 (DIR) diff --git a/chwb.c b/chwb.c
       t@@ -10,24 +10,24 @@
        
        static xcb_connection_t *conn;
        
       -static void usage      (char *name);
       -static void setborder  (int, int, xcb_window_t);
       +static void usage(char *name);
       +static void set_border(int, int, xcb_window_t);
        
        static void
       -usage (char *name)
       +usage(char *name)
        {
                fprintf(stderr, "usage: %s <-sc ...> <wid> [wid...]\n", name);
                exit(1);
        }
        
        static void
       -setborder (int bw, int color, xcb_window_t win)
       +set_border(int width, int color, xcb_window_t win)
        {
                uint32_t values[1];
                int mask;
        
       -        if (bw != -1) {
       -                values[0] = bw;
       +        if (width != -1) {
       +                values[0] = width;
                        mask = XCB_CONFIG_WINDOW_BORDER_WIDTH;
                        xcb_configure_window(conn, win, mask, values);
        
       t@@ -44,32 +44,33 @@ setborder (int bw, int color, xcb_window_t win)
        }
        
        int
       -main (int argc, char **argv)
       +main(int argc, char **argv)
        {
                char *argv0;
       -        int color,bw;
       +        int color,width;
        
       -        color = bw = -1;
       +        color = width = -1;
        
                if (argc < 2)
                        usage(argv[0]);
        
                ARGBEGIN {
                        case 's':
       -                        bw = strtoul(EARGF(usage(argv0)), NULL, 10);
       +                        width = strtoul(EARGF(usage(argv0)), NULL, 10);
                                break;
                        case 'c':
                                color = strtoul(EARGF(usage(argv0)), NULL, 16);
                                break;
       -        default:
       +                default:
                                usage(argv0);
       +                        /* NOTREACHED */
                } ARGEND
        
                init_xcb(&conn);
        
                /* assume remaining arguments are windows */
                while (*argv)
       -                setborder(bw, color, strtoul(*argv++, NULL, 16));
       +                set_border(width, color, strtoul(*argv++, NULL, 16));
        
                xcb_flush(conn);
        
 (DIR) diff --git a/chwso.c b/chwso.c
       t@@ -8,26 +8,26 @@
        #include "arg.h"
        #include "util.h"
        
       -static xcb_connection_t          *conn;
       +static xcb_connection_t *conn;
        
       -static void usage    (char *);
       -static void stack    (xcb_window_t, uint32_t[1]);
       +static void usage(char *);
       +static void stack(xcb_window_t, uint32_t[1]);
        
        static void
       -usage (char *name)
       +usage(char *name)
        {
                fprintf(stderr, "usage %s -rli <wid>\n", name);
                exit(1);
        }
        
        static void
       -stack (xcb_window_t win, uint32_t values[1])
       +stack(xcb_window_t win, uint32_t values[1])
        {
                xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, values);
        }
        
        int
       -main (int argc, char **argv)
       +main(int argc, char **argv)
        {
                xcb_window_t win;
                uint32_t values[1];
       t@@ -43,10 +43,18 @@ main (int argc, char **argv)
                        return 1;
        
                ARGBEGIN {
       -                case 'r': values[0] = XCB_STACK_MODE_ABOVE;    break;
       -                case 'l': values[0] = XCB_STACK_MODE_BELOW;    break;
       -                case 'i': values[0] = XCB_STACK_MODE_OPPOSITE; break;
       -                default:  usage(argv0);                        break;
       +                case 'r':
       +                        values[0] = XCB_STACK_MODE_ABOVE;
       +                        break;
       +                case 'l':
       +                        values[0] = XCB_STACK_MODE_BELOW;
       +                        break;
       +                case 'i':
       +                        values[0] = XCB_STACK_MODE_OPPOSITE;
       +                        break;
       +                default:
       +                        usage(argv0);
       +                        break;
                } ARGEND
        
                stack(win, values);
 (DIR) diff --git a/ignw.c b/ignw.c
       t@@ -8,21 +8,20 @@
        #include "arg.h"
        #include "util.h"
        
       -char *argv0;
        static xcb_connection_t *conn;
        
       -static void usage(void);
       -static void setoverride(xcb_window_t, int);
       +static void usage(char *);
       +static void set_override(xcb_window_t, int);
        
        static void
       -usage(void)
       +usage(char *name)
        {
       -        fprintf(stderr, "usage: %s [-sr] <wid> [wid..]\n", argv0);
       +        fprintf(stderr, "usage: %s [-sr] <wid> [wid..]\n", name);
                exit(1);
        }
        
        static void
       -setoverride(xcb_window_t w, int or)
       +set_override(xcb_window_t w, int or)
        {
                uint32_t mask = XCB_CW_OVERRIDE_REDIRECT;
                uint32_t val[] = { or };
       t@@ -34,17 +33,18 @@ int
        main(int argc, char **argv)
        {
                int setflag = 0;
       +        char *argv0;
        
                ARGBEGIN {
                        case 's': setflag = 1; break;
                        case 'r': setflag = 0; break;
       -                default: usage();
       +                default: usage(argv0);
                } ARGEND;
        
                init_xcb(&conn);
        
                while (*argv)
       -                setoverride(strtoul(*argv++, NULL, 16), setflag);
       +                set_override(strtoul(*argv++, NULL, 16), setflag);
        
                xcb_flush(conn);
        
 (DIR) diff --git a/killw.c b/killw.c
       t@@ -9,10 +9,10 @@
        
        static xcb_connection_t *conn;
        
       -static void usage (const char *);
       +static void usage(char *);
        
        static void
       -usage (const char *name)
       +usage (char *name)
        {
                fprintf(stderr, "usage: %s <wid> [wid...]\n", name);
                exit(1);
 (DIR) diff --git a/lsw.c b/lsw.c
       t@@ -8,11 +8,10 @@
        #include "arg.h"
        #include "util.h"
        
       -char *argv0;
        static xcb_connection_t *conn;
        static xcb_screen_t *scrn;
        
       -static void usage(void);
       +static void usage(char *);
        static int should_list(xcb_window_t, int);
        static void list_windows(xcb_window_t, int);
        
       t@@ -23,9 +22,9 @@ enum {
        };
        
        static void
       -usage(void)
       +usage(char *name)
        {
       -        fprintf(stderr, "usage: %s [-houra] [wid...]\n", argv0);
       +        fprintf(stderr, "usage: %s [-houra] [wid...]\n", name);
                exit(1);
        }
        
       t@@ -66,13 +65,14 @@ int
        main(int argc, char **argv)
        {
                int listmask = 0, rootflag = 0;
       +        char *argv0;
        
                ARGBEGIN {
                        case 'a': listmask |= LIST_ALL; break;
                        case 'u': listmask |= LIST_HIDDEN; break;
                        case 'o': listmask |= LIST_IGNORE; break;
                        case 'r': rootflag = 1; break;
       -                default : usage();
       +                default : usage(argv0);
                } ARGEND;
        
                init_xcb(&conn);
 (DIR) diff --git a/mapw.c b/mapw.c
       t@@ -14,15 +14,14 @@ enum {
                TOGGLE  = 1 << 2
        };
        
       -char *argv0;
        static xcb_connection_t *conn;
        
       -static void usage(void);
       +static void usage(char *);
        
        static void
       -usage(void)
       +usage(char *name)
        {
       -        fprintf(stderr, "usage: %s [-h] [-mut <wid> [wid..]]\n", argv0);
       +        fprintf(stderr, "usage: %s [-h] [-mut <wid> [wid..]]\n", name);
                exit(1);
        }
        
       t@@ -31,16 +30,17 @@ main(int argc, char **argv)
        {
                int mapflag = 0;
                xcb_window_t w = 0;
       +        char *argv0;
        
                ARGBEGIN {
                        case 'm': mapflag = MAP;    break;
                        case 'u': mapflag = UNMAP;  break;
                        case 't': mapflag = TOGGLE; break;
       -                default : usage();
       +                default : usage(argv0);
                } ARGEND;
        
                if (argc < 1 || mapflag == 0)
       -                usage();
       +                usage(argv0);
        
                init_xcb(&conn);
        
       t@@ -55,11 +55,10 @@ main(int argc, char **argv)
                                xcb_unmap_window(conn, w);
                                break;
                        case TOGGLE:
       -                        if (mapped(conn, w)) {
       +                        if (mapped(conn, w))
                                        xcb_unmap_window(conn, w);
       -                        } else {
       +                        else
                                        xcb_map_window(conn, w);
       -                        }
                                break;
                        }
                }
 (DIR) diff --git a/wname.c b/wname.c
       t@@ -13,7 +13,7 @@ static void usage(char *);
        static int get_title(xcb_window_t);
        
        static void
       -usage (char *name)
       +usage(char *name)
        {
                fprintf(stderr, "usage: %s <wid>\n", name);
                exit(1);
 (DIR) diff --git a/wtf.c b/wtf.c
       t@@ -10,7 +10,7 @@
        
        static xcb_connection_t *conn;
        
       -static void usage (char *name);
       +static void usage (char *);
        
        static void
        usage(char *name)
 (DIR) diff --git a/wtp.c b/wtp.c
       t@@ -9,8 +9,8 @@
        
        static xcb_connection_t *conn;
        
       -static void usage (char *name);
       -static void teleport (xcb_window_t, int, int, int, int);
       +static void usage(char *name);
       +static void teleport(xcb_window_t, int, int, int, int);
        
        static void
        usage(char *name)