wmutils

X windows manipulation utilities
git clone git://z3bra.org/wmutils
Log | Files | Refs | LICENSE

commit f7b1e21cdda2e58108427f053f6a552ceaf9bc7b
parent 2c19eee092e62e716b0f8e48c64b52d9e925f3df
Author: z3bra <willy@mailoo.org>
Date:   Fri Nov 28 00:01:55 2014

improved error messages

Diffstat:
 lsw.c   | 10 +++++-----
 mapw.c  |  2 +-
 wattr.c |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lsw.c b/lsw.c @@ -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); } @@ -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 @@ -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) diff --git a/mapw.c b/mapw.c @@ -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 diff --git a/wattr.c b/wattr.c @@ -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 @@ -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;