summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2016-10-03 13:03:50 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2016-10-03 13:03:50 +0000
commit576f34f44a14077655f1a74ecd270ed8b32de433 (patch)
tree249b466b4f21e5715a8b7fe6236bb18d303828bf /sbin
parent2ccbc991cb3c0ab5161657b9618933487f2e78a4 (diff)
Those while loops look better written as for loops
ok kettenis@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/kbd/kbd_wscons.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/sbin/kbd/kbd_wscons.c b/sbin/kbd/kbd_wscons.c
index 0e1da363b4c..11828bdcb23 100644
--- a/sbin/kbd/kbd_wscons.c
+++ b/sbin/kbd/kbd_wscons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd_wscons.c,v 1.31 2016/09/30 12:07:23 kettenis Exp $ */
+/* $OpenBSD: kbd_wscons.c,v 1.32 2016/10/03 13:03:49 jca Exp $ */
/*
* Copyright (c) 2001 Mats O Jansson. All rights reserved.
@@ -100,27 +100,23 @@ kbd_show_enc(struct wskbd_encoding_data *encs, int idx)
kbtype_tab[idx]);
for (i = 0; i < encs->nencodings; i++) {
- n = &kbdenc_tab[0];
found = 0;
encoding = encs->encodings[i];
- while (n->value) {
+ for (n = &kbdenc_tab[0]; n->value; n++) {
if (n->value == KB_ENCODING(encoding)) {
printf("%s", n->name);
found++;
}
- n++;
}
if (found == 0)
printf("<encoding 0x%04x>", KB_ENCODING(encoding));
- n = &kbdvar_tab[0];
found = 0;
variant = KB_VARIANT(encoding);
- while (n->value) {
+ for (n = &kbdvar_tab[0]; n->value; n++) {
if ((n->value & KB_VARIANT(encoding)) == n->value) {
printf(".%s", n->name);
variant &= ~n->value;
}
- n++;
}
if (variant != 0)
printf(".<variant 0x%08x>", variant);
@@ -248,11 +244,9 @@ kbd_set(char *name, int verbose)
*b++ = *c++;
*b = '\0';
v = 0;
- n = &kbdvar_tab[0];
- while (n->value) {
+ for (n = &kbdvar_tab[0]; n->value; n++) {
if (strcmp(n->name, buf) == 0)
v = n->value;
- n++;
}
if (v == 0)
errx(1, "unknown variant %s", buf);