diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2018-07-04 15:29:26 +0200 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-11-12 11:41:47 -0800 |
commit | 3e27b6a63f3baf153bba076e12870f2a88691a13 (patch) | |
tree | 53cbc87ba87a91d5468d9a7c6be19e2827ccf40a | |
parent | 22a8eb00662a926cd5df52ba15851a31104ae41e (diff) |
Actually stop after an invalid atom.
The manual page states that if no upper range limit has been specified,
no higher atoms will be printed. This is not true for
$ xlsatoms -range 0-
This prints the first 100 atoms, even though it already encountered an
invalid one at 0. The reason is that say_batch works as a batch, i.e.
retrieves 100 atoms at a time. If one of them is invalid, the rest is
still printed.
With this adjustment, xlsatoms behaves as stated in manual page.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xlsatoms.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -248,13 +248,15 @@ say_batch(xcb_connection_t *c, const char *format, xcb_get_atom_name_cookie_t *c xcb_get_atom_name_reply_t *r; r = xcb_get_atom_name_reply(c, cookie[i], &e); if (r) { - /* We could just use %.*s in 'format', but we want to be compatible - with legacy command line usage */ - snprintf(atom_name, sizeof(atom_name), "%.*s", - r->name_len, xcb_get_atom_name_name(r)); - - printf (format, i + low, atom_name); - putchar ('\n'); + if (!done) { + /* We could just use %.*s in 'format', but we want to be compatible + with legacy command line usage */ + snprintf(atom_name, sizeof(atom_name), "%.*s", + r->name_len, xcb_get_atom_name_name(r)); + + printf (format, i + low, atom_name); + putchar ('\n'); + } free(r); } if (e) { |