summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-04-22 12:42:00 +1000
committerRan Benita <ran@unusedvar.com>2021-04-27 09:53:32 +0300
commit693ffb073b92907730c987320558ff668707d8a9 (patch)
treef28fb65e6a8883ac6591d1f255a04fbe243e781b /tools
parent68dddd4132521dc72133a4f0010d0d07ec30a16e (diff)
downloadxorg-lib-libxkbcommon-693ffb073b92907730c987320558ff668707d8a9.tar.gz
tools: change the list separator handling
Slightly easier to read than the "bool first" approach. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/registry-list.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/registry-list.c b/tools/registry-list.c
index 0dc71d1..d8848ac 100644
--- a/tools/registry-list.c
+++ b/tools/registry-list.c
@@ -156,7 +156,6 @@ main(int argc, char **argv)
struct rxkb_iso3166_code *iso3166;
const char *variant = rxkb_layout_get_variant(l);
const char *brief = rxkb_layout_get_brief(l);
- bool first;
printf("- %s%s%s%s:%s:%s",
rxkb_layout_get_name(l),
@@ -167,22 +166,24 @@ main(int argc, char **argv)
rxkb_layout_get_description(l));
iso639 = rxkb_layout_get_iso639_first(l);
- if (iso639)
+ if (iso639) {
+ const char *sep = "";
printf(":iso639-");
- first = true;
- while (iso639) {
- printf("%s%s", first ? "" : ",", rxkb_iso639_code_get_code(iso639));
- iso639 = rxkb_iso639_code_next(iso639);
- first = false;
+ while (iso639) {
+ printf("%s%s", sep, rxkb_iso639_code_get_code(iso639));
+ iso639 = rxkb_iso639_code_next(iso639);
+ sep = ",";
+ }
}
iso3166 = rxkb_layout_get_iso3166_first(l);
- if (iso3166)
+ if (iso3166) {
+ const char *sep = "";
printf(":iso3166-");
- first = true;
- while (iso3166) {
- printf("%s%s", first ? "" : ",", rxkb_iso3166_code_get_code(iso3166));
- iso3166 = rxkb_iso3166_code_next(iso3166);
- first = false;
+ while (iso3166) {
+ printf("%s%s", sep, rxkb_iso3166_code_get_code(iso3166));
+ iso3166 = rxkb_iso3166_code_next(iso3166);
+ sep = ",";
+ }
}
printf("\n");