summaryrefslogtreecommitdiff
path: root/util-linux/blockdev.c
diff options
context:
space:
mode:
authorDenys Vlasenko2010-09-06 15:34:15 +0200
committerDenys Vlasenko2010-09-06 15:34:15 +0200
commit264bdadb2c0406474a4e874a3b16cb57661e6b3a (patch)
tree30d99f539baba30281201f632f0670dc273e5138 /util-linux/blockdev.c
parentb4e6b419340452d2e0fedc9f0f88c5fd102982de (diff)
downloadbusybox-264bdadb2c0406474a4e874a3b16cb57661e6b3a.zip
busybox-264bdadb2c0406474a4e874a3b16cb57661e6b3a.tar.gz
blockdev: -2 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'util-linux/blockdev.c')
-rw-r--r--util-linux/blockdev.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/util-linux/blockdev.c b/util-linux/blockdev.c
index fea30b0..2b48c28 100644
--- a/util-linux/blockdev.c
+++ b/util-linux/blockdev.c
@@ -109,12 +109,15 @@ static const struct bdc bdcommands[] = {
static const struct bdc *find_cmd(const char *s)
{
- int j;
- if (*s++ == '-')
- if (*s++ == '-')
- for (j = 0; j < ARRAY_SIZE(bdcommands); j++)
- if (strcmp(s, bdcommands[j].name) == 0)
- return &bdcommands[j];
+ const struct bdc *bdcmd = bdcommands;
+ if (s[0] == '-' && s[1] == '-') {
+ s += 2;
+ do {
+ if (strcmp(s, bdcmd->name) == 0)
+ return bdcmd;
+ bdcmd++;
+ } while (bdcmd != bdcommands + ARRAY_SIZE(bdcommands));
+ }
bb_show_usage();
}