wmutils

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

commit 62588254a8049aedcf8533623090458850141f0a
parent d73c716df2a3b7152cb0371ee0017e9276843af3
Author: z3bra <willy@mailoo.org>
Date:   Fri Dec 19 01:00:22 2014

fuck it, the simpler, the better. now it works

Diffstat:
 wattr.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/wattr.c b/wattr.c @@ -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; @@ -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++) { @@ -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); @@ -95,5 +100,5 @@ main(int argc, char **argv) kill_xcb(&conn); - return retval; + return 0; }