aboutsummaryrefslogtreecommitdiff
path: root/bin/xrq.awk
diff options
context:
space:
mode:
Diffstat (limited to 'bin/xrq.awk')
-rw-r--r--bin/xrq.awk13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/xrq.awk b/bin/xrq.awk
index 686cf677..ffd5f124 100644
--- a/bin/xrq.awk
+++ b/bin/xrq.awk
@@ -8,19 +8,22 @@ BEGIN {
# Check we have at least one resource name
if (ARGC < 2) {
- print "xrq: Need at least one resource name" | "cat >&2"
+ stderr = "cat >&2"
+ print "xrq: Need at least one resource name" | stderr
+ close(stderr)
exit(2)
}
# Run `xrdb -query` and search for instances of the requested resource
- while ("xrdb -query" | getline) {
- for (i in ARGV) {
+ xrdb = "xrdb -query"
+ found = 0
+ while (xrdb | getline)
+ for (i in ARGV)
if ($1 == ARGV[i]) {
found = 1
print $2
}
- }
- }
+ close(xrdb)
# Exit successfully if we found at least one result
exit(!found)