Cope with NUL seperated directives. Fix reporting of unparseable directives.
This commit is contained in:
parent
e7c81c254c
commit
dc17f155ff
2 changed files with 30 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-06-27 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* deffilep.y (def_file_add_directive): Cope with NUL seperated
|
||||||
|
directives. Fix reporting of unparseable directives.
|
||||||
|
(def_error): Check for a NULL def_filename.
|
||||||
|
|
||||||
2003-06-27 Alan Modra <amodra@bigpond.net.au>
|
2003-06-27 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* emultempl/aix.em: Convert to C90, remove unnecessary prototypes
|
* emultempl/aix.em: Convert to C90, remove unnecessary prototypes
|
||||||
|
|
|
@ -601,18 +601,26 @@ def_file_add_directive (my_def, param, len)
|
||||||
{
|
{
|
||||||
def_file *save_def = def;
|
def_file *save_def = def;
|
||||||
const char *pend = param + len;
|
const char *pend = param + len;
|
||||||
const char *tend = param;
|
char * tend = (char *) param;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
def = my_def;
|
def = my_def;
|
||||||
|
|
||||||
while (param < pend)
|
while (param < pend)
|
||||||
{
|
{
|
||||||
while (param < pend && ISSPACE (*param))
|
while (param < pend && (ISSPACE (*param) || * param == '\n' || * param == 0))
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
for (tend = param + 1;
|
if (param == pend)
|
||||||
tend < pend && !(ISSPACE (tend[-1]) && *tend == '-');
|
break;
|
||||||
|
|
||||||
|
/* Scan forward until we encounter any of:
|
||||||
|
- the end of the buffer
|
||||||
|
- the start of a new option
|
||||||
|
- a newline seperating options
|
||||||
|
- a NUL seperating options. */
|
||||||
|
for (tend = (char *) (param + 1);
|
||||||
|
tend < pend && !(ISSPACE (tend[-1]) && *tend == '-') && (*tend != '\n') && (*tend != 0);
|
||||||
tend++)
|
tend++)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -628,15 +636,22 @@ def_file_add_directive (my_def, param, len)
|
||||||
lex_parse_string = param + len + 1;
|
lex_parse_string = param + len + 1;
|
||||||
lex_forced_token = diropts[i].token;
|
lex_forced_token = diropts[i].token;
|
||||||
saw_newline = 0;
|
saw_newline = 0;
|
||||||
def_parse ();
|
if (def_parse ())
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!diropts[i].param)
|
if (!diropts[i].param)
|
||||||
/* xgettext:c-format */
|
{
|
||||||
einfo (_("Warning: .drectve `%.*s' unrecognized\n"),
|
char saved;
|
||||||
tend - param, param);
|
|
||||||
|
saved = * tend;
|
||||||
|
* tend = 0;
|
||||||
|
/* xgettext:c-format */
|
||||||
|
einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
|
||||||
|
* tend = saved;
|
||||||
|
}
|
||||||
|
|
||||||
lex_parse_string = 0;
|
lex_parse_string = 0;
|
||||||
param = tend;
|
param = tend;
|
||||||
|
@ -843,7 +858,7 @@ static int
|
||||||
def_error (err)
|
def_error (err)
|
||||||
const char *err;
|
const char *err;
|
||||||
{
|
{
|
||||||
einfo ("%P: %s:%d: %s\n", def_filename, linenumber, err);
|
einfo ("%P: %s:%d: %s\n", def_filename ? def_filename : "<unknown-file>", linenumber, err);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue