dll: fuse: fuse_opt_parse: bugfix in handling templates of the form NAME=VALUE

This commit is contained in:
Bill Zissimopoulos 2016-06-03 15:06:56 -07:00
parent e08b462566
commit 22da074ff7
2 changed files with 15 additions and 1 deletions

View File

@ -102,7 +102,14 @@ static void fsp_fuse_opt_match_templ(
else if ('=' == *p) else if ('=' == *p)
{ {
if (*q == *p) if (*q == *p)
*pspec = p + 1, *parg = q + 1; {
p++, q++;
if ('%' == *p || '\0' == *p)
*pspec = p, *parg = q;
else
*parg = 0 == lstrcmpA(q, p) ?
fsp_fuse_opt_match_exact : fsp_fuse_opt_match_none;
}
else else
*parg = fsp_fuse_opt_match_none; *parg = fsp_fuse_opt_match_none;
break; break;

View File

@ -15,6 +15,7 @@ struct data
long y; long y;
long long z; long long z;
int dec, neg, hex, oct; int dec, neg, hex, oct;
int sel;
char *esc; int ESC; char *esc; int ESC;
int arg_discard, arg_keep; int arg_discard, arg_keep;
int opt_discard, opt_keep; int opt_discard, opt_keep;
@ -207,6 +208,10 @@ void fuse_opt_parse_test(void)
{ "--hex=%x", offsetof(struct data, hex), 'hex' }, { "--hex=%x", offsetof(struct data, hex), 'hex' },
{ "--oct=%o", offsetof(struct data, oct), 'oct' }, { "--oct=%o", offsetof(struct data, oct), 'oct' },
{ "--sel=fortyone", offsetof(struct data, sel), 141 },
{ "--sel=fortytwo", offsetof(struct data, sel), 142 },
{ "--sel=fortythree", offsetof(struct data, sel), 143 },
{ "esc=%s", offsetof(struct data, esc), 'esc' }, { "esc=%s", offsetof(struct data, esc), 'esc' },
FUSE_OPT_KEY("ESC=", 'ESC'), FUSE_OPT_KEY("ESC=", 'ESC'),
@ -245,6 +250,7 @@ void fuse_opt_parse_test(void)
"--neg=-1234567890", "--neg=-1234567890",
"--hex=ABCDEF", "--hex=ABCDEF",
"--oct=12345670", "--oct=12345670",
"--sel=fortytwo",
"-oesc=\\\\foo\\,bar\\\\,ESC=\\\\FOO\\,BAR\\\\", "-oesc=\\\\foo\\,bar\\\\,ESC=\\\\FOO\\,BAR\\\\",
"--discard", "--discard",
"--keep", "--keep",
@ -317,6 +323,7 @@ void fuse_opt_parse_test(void)
ASSERT(-1234567890 == data.neg); ASSERT(-1234567890 == data.neg);
ASSERT(0xABCDEF == data.hex); ASSERT(0xABCDEF == data.hex);
ASSERT(012345670 == data.oct); ASSERT(012345670 == data.oct);
ASSERT(142 == data.sel);
ASSERT(0 == strcmp("\\foo,bar\\", data.esc)); ASSERT(0 == strcmp("\\foo,bar\\", data.esc));
ASSERT(1 == data.ESC); ASSERT(1 == data.ESC);
ASSERT(1 == data.arg_discard); ASSERT(1 == data.arg_discard);