timproved error messages - wmutils - X windows manipulation utilities
 (HTM) git clone git://z3bra.org/wmutils
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f7b1e21cdda2e58108427f053f6a552ceaf9bc7b
 (DIR) parent 2c19eee092e62e716b0f8e48c64b52d9e925f3df
 (HTM) Author: z3bra <willy@mailoo.org>
       Date:   Fri, 28 Nov 2014 00:01:55 +0100
       
       improved error messages
       
       Diffstat:
         M lsw.c                               |      10 +++++-----
         M mapw.c                              |       2 +-
         M wattr.c                             |       4 ++--
       
       3 files changed, 8 insertions(+), 8 deletions(-)
       ---
 (DIR) diff --git a/lsw.c b/lsw.c
       t@@ -18,7 +18,7 @@ static int ismapped(xcb_window_t w);
        static void
        usage(void)
        {
       -        fprintf(stderr, "usage: %s [-ah] [<wid>]\n", argv0);
       +        fprintf(stderr, "usage: %s [-har] [wid...]\n", argv0);
                exit(1);
        }
        
       t@@ -27,12 +27,12 @@ xcbinit(void)
        {
                conn = xcb_connect(NULL, NULL);
                if (xcb_connection_has_error(conn))
       -                errx(1, "xcb_connect");
       +                errx(1, "unable connect to the X server");
        
                scrn = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
        
                if (scrn == NULL)
       -                errx(1, "xcb_setup_roots_iterator");
       +                errx(1, "unable to retrieve screen informations");
        }
        
        static void
       t@@ -72,11 +72,11 @@ listwindows(xcb_window_t w, int listhidden)
                c = xcb_query_tree(conn, w);
                r = xcb_query_tree_reply(conn, c, NULL);
                if (r == NULL)
       -                errx(1, "xcb_query_tree_reply");
       +                errx(1, "0x%08x: no such window", w);
        
                wc = xcb_query_tree_children(r);
                if (wc == NULL)
       -                errx(1, "xcb_query_tree_children");
       +                errx(1, "0x%08x: unable to retrieve children", w);
        
                for (i=0; i<r->children_len; i++) {
                        if (ismapped(wc[i]) || listhidden)
 (DIR) diff --git a/mapw.c b/mapw.c
       t@@ -31,7 +31,7 @@ xcbinit(void)
        {
                conn = xcb_connect(NULL, NULL);
                if (xcb_connection_has_error(conn))
       -                errx(1, "xcb_connect");
       +                errx(1, "unable to connect to the X server");
        }
        
        static void
 (DIR) diff --git a/wattr.c b/wattr.c
       t@@ -32,7 +32,7 @@ xcbinit(void)
        {
                conn = xcb_connect(NULL, NULL);
                if (xcb_connection_has_error(conn))
       -                errx(1, "xcb_connect");
       +                errx(1, "unable to connect to the X server");
        }
        
        static void
       t@@ -69,7 +69,7 @@ getattribute(xcb_window_t w, int attr)
                r = xcb_get_geometry_reply(conn, c, NULL);
        
                if (r == NULL)
       -                errx(1, "xcb_get_geometry");
       +                errx(1, "0x%08x: no such window", w);
        
                switch (attr) {
                        case ATTR_W: attr = r->width  + 2 * r->border_width; break;