while (!feof (infile))
{
lineno += nlines;
- nlines = readline (&lb, infile, filename);
+ nlines = readline (&lb, infile, filename, lineno);
if (collapsed_length < lb.size)
{
while (!feof (infile))
{
lineno += nlines;
- nlines = readline (&lb, infile, filename);
+ nlines = readline (&lb, infile, filename, lineno);
p = next_token (lb.buffer);
if ((p[5] == '\0' || isblank (p[5])) && !strncmp (p, "endef", 5))
*/
static unsigned int
-readline (linebuffer, stream, filename)
+readline (linebuffer, stream, filename, lineno)
struct linebuffer *linebuffer;
FILE *stream;
char *filename;
+ unsigned int lineno;
{
char *buffer = linebuffer->buffer;
register char *p = linebuffer->buffer;
{
if (fgets (p, end - p, stream) == 0)
if (feof (stream))
- return nlines;
+ break;
else
pfatal_with_name (filename);
len = strlen (p);
+ if (len == 0)
+ /* This only happens when the first thing on the line is a '\0'. */
+ makefile_fatal (filename, lineno, "NUL not allowed in makefile");
+
p += len;
if (p[-1] != '\n')
{
if (!backslash)
{
p[-1] = '\0';
- return nlines;
+ break;
}
if (end - p <= 1)
linebuffer->buffer = buffer;
}
}
+
+ return nlines;
}
\f
/* Construct the list of include directories