1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-04 09:18:36 +03:00

Revert "cleanup: simplify option matching function"

This reverts commit 0396ade38b.

The original code also handled len==1, which the new code doesn't.
Press <TAB> in the lvm shell to get a list of the possible
flag completions for a single hyphen.
This commit is contained in:
Alasdair G Kergon 2013-04-13 02:26:37 +01:00
parent c363c74a25
commit 9495a3d807

View File

@ -91,11 +91,18 @@ static char *_list_args(const char *text, int state)
return NULL; return NULL;
/* Short form arguments */ /* Short form arguments */
if (len == 2 && text[0] == '-') { if (len < 3) {
while (match_no < com->num_args) while (match_no < com->num_args) {
if (text[1] == (_cmdline->arg_props + char s[3];
com->valid_args[match_no++])->short_arg) char c;
return strdup(text); if (!(c = (_cmdline->arg_props +
com->valid_args[match_no++])->short_arg))
continue;
sprintf(s, "-%c", c);
if (!strncmp(text, s, len))
return strdup(s);
}
} }
/* Long form arguments */ /* Long form arguments */