summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2013-09-02 11:33:33 +0200
committerGuillem Jover <guillem@debian.org>2013-10-16 05:20:19 +0200
commitf2e2ab4bd1b91756e4a4f747b2441893990c7531 (patch)
tree37079d791526ae34ef7fb663b7f82cac88b6ffb7 /utils
parentaae7949241856e5d893f611ed53f2b4e19d40714 (diff)
downloaddpkg-f2e2ab4bd1b91756e4a4f747b2441893990c7531.tar.gz
u-a: Unify idx handling in alternative_select_choice()
Make it obvious the 0 passed to alternative_print_choice() is the idx, and move the increment in the for loop into the post action.
Diffstat (limited to 'utils')
-rw-r--r--utils/update-alternatives.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 4ece75b8b..9ad117d67 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1608,12 +1608,10 @@ alternative_select_choice(struct alternative *a)
pr(" %-12.12s %-*.*s %-10.10s %s", _("Selection"), len, len,
_("Path"), _("Priority"), _("Status"));
pr("------------------------------------------------------------");
- alternative_print_choice(a, ALT_ST_AUTO, best, 0, len);
- idx = 1;
- for (fs = a->choices; fs; fs = fs->next) {
+ idx = 0;
+ alternative_print_choice(a, ALT_ST_AUTO, best, idx++, len);
+ for (fs = a->choices; fs; fs = fs->next, idx++)
alternative_print_choice(a, ALT_ST_MANUAL, fs, idx, len);
- idx++;
- }
printf("\n");
printf(_("Press enter to keep the current choice[*], "
"or type selection number: "));