This adds $# to the gramma to ask for the number of fields.
Signed-off-by: Bert Wesarg <[email protected]>
---
xprop.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/xprop.c b/xprop.c
index 04b4301..9203f08 100644
--- a/xprop.c
+++ b/xprop.c
@@ -1221,10 +1221,15 @@ Scan_Term (const char *string, thunk *thunks, const
char *format, long *value)
string = Scan_Long(string, value);
else if (*string == '$') {
const char *bad_string = string++;
- string = Scan_Long(string, &i);
- if (i >= thunks->thunk_count)
- Fatal_Error("Bad field reference %d in conditional %s", (int) i,
bad_string);
- *value = thunks[i].value;
+ if (*string == '#') {
+ *value = thunks->thunk_count;
+ ++string;
+ } else {
+ string = Scan_Long(string, &i);
+ if (i >= thunks->thunk_count)
+ Fatal_Error("Bad field reference %d in conditional %s", (int)
i, bad_string);
+ *value = thunks[i].value;
+ }
} else if (*string == 'm') {
string = Scan_Long(++string, &i);
*value = Mask_Bit_I(thunks, format, (int) i);
--
1.7.7.759.gfc8c6
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel