Handle ) in command line interface filename
SWIG now handles an interface filename specified on the command line which contains a closing parenthesis `)`, and more generally with attributes to `%include` and `%import` which are quoted and contain parentheses. Fixes #1006
This commit is contained in:
parent
663299281e
commit
f8a766295c
3 changed files with 36 additions and 7 deletions
|
|
@ -741,14 +741,35 @@ static String *get_options(String *str) {
|
|||
opt = NewString("(");
|
||||
while (((c = Getc(str)) != EOF)) {
|
||||
Putc(c, opt);
|
||||
if (c == ')') {
|
||||
level--;
|
||||
if (!level)
|
||||
return opt;
|
||||
switch (c) {
|
||||
case ')':
|
||||
level--;
|
||||
if (!level)
|
||||
return opt;
|
||||
break;
|
||||
case '(':
|
||||
level++;
|
||||
break;
|
||||
case '"':
|
||||
/* Skip over quoted strings */
|
||||
while (1) {
|
||||
c = Getc(str);
|
||||
if (c == EOF)
|
||||
goto bad;
|
||||
Putc(c, opt);
|
||||
if (c == '"')
|
||||
break;
|
||||
if (c == '\\') {
|
||||
c = Getc(str);
|
||||
if (c == EOF)
|
||||
goto bad;
|
||||
Putc(c, opt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c == '(')
|
||||
level++;
|
||||
}
|
||||
bad:
|
||||
Delete(opt);
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue