taccept multiple id's and output wid - wmutils - X windows manipulation utilities
(HTM) git clone git://z3bra.org/wmutils
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 34d28705f0c52a00eec1c01757c4526dc13d433b
(DIR) parent 985a96431a17738261474e75fc1eb4e3ee6c8de8
(HTM) Author: dcat <dcat@iotek.org>
Date: Mon, 8 Dec 2014 19:15:46 +0100
accept multiple id's and output wid
Diffstat:
M wattr.c | 40 +++++++++++++++++++-------------
1 file changed, 24 insertions(+), 16 deletions(-)
---
(DIR) diff --git a/wattr.c b/wattr.c
t@@ -128,7 +128,7 @@ getattribute(xcb_window_t w, int attr)
int
main(int argc, char **argv)
{
- int i;
+ int i,c;
xcb_window_t w = 0;
if (argc < 2 || (strncmp(argv[1], "-h", 2) == 0)) {
t@@ -139,22 +139,30 @@ main(int argc, char **argv)
atexit(cleanup);
xcbinit();
- w = strtoul(argv[argc-1], NULL, 16);
-
- for (i=0; i<strlen(argv[1]); i++) {
- switch (argv[1][i]) {
- 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 'i': ignored(w)? exit(0) : exit(1);
- case 'm': mapped(w) ? exit(0) : exit(1);
- default : exists(w) ? exit(0) : exit(1);
+ for (c=2; argv[c]; c++) {
+ w = strtoul(argv[c], NULL, 16);
+
+ for (i=0; i<strlen(argv[1]); i++) {
+ 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': ignored(w)? exit(0) : exit(1);
+ case 'm': mapped(w) ? exit(0) : exit(1);
+ default : exists(w) ? exit(0) : exit(1);
+ }
+ /* add a space if more attribute come after */
+ putc(i+1 < strlen(argv[1]) ? ' ' : '\n',stdout);
}
-
- /* add a space if more attribute come after */
- putc(i+1 < strlen(argv[1]) ? ' ' : '\n',stdout);
}
return 0;