mirror of
https://github.com/mirror/make.git
synced 2025-02-06 17:50:48 +08:00
Formerly read.c.~48~
This commit is contained in:
parent
52930ae3a9
commit
2d89aa53df
17
read.c
17
read.c
@ -326,7 +326,7 @@ read_makefile (filename, type)
|
|||||||
while (!feof (infile))
|
while (!feof (infile))
|
||||||
{
|
{
|
||||||
lineno += nlines;
|
lineno += nlines;
|
||||||
nlines = readline (&lb, infile, filename);
|
nlines = readline (&lb, infile, filename, lineno);
|
||||||
|
|
||||||
if (collapsed_length < lb.size)
|
if (collapsed_length < lb.size)
|
||||||
{
|
{
|
||||||
@ -723,7 +723,7 @@ do_define (name, namelen, origin, lineno, infile, filename)
|
|||||||
while (!feof (infile))
|
while (!feof (infile))
|
||||||
{
|
{
|
||||||
lineno += nlines;
|
lineno += nlines;
|
||||||
nlines = readline (&lb, infile, filename);
|
nlines = readline (&lb, infile, filename, lineno);
|
||||||
p = next_token (lb.buffer);
|
p = next_token (lb.buffer);
|
||||||
|
|
||||||
if ((p[5] == '\0' || isblank (p[5])) && !strncmp (p, "endef", 5))
|
if ((p[5] == '\0' || isblank (p[5])) && !strncmp (p, "endef", 5))
|
||||||
@ -1480,10 +1480,11 @@ parse_file_seq (stringp, stopchar, size)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
readline (linebuffer, stream, filename)
|
readline (linebuffer, stream, filename, lineno)
|
||||||
struct linebuffer *linebuffer;
|
struct linebuffer *linebuffer;
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
unsigned int lineno;
|
||||||
{
|
{
|
||||||
char *buffer = linebuffer->buffer;
|
char *buffer = linebuffer->buffer;
|
||||||
register char *p = linebuffer->buffer;
|
register char *p = linebuffer->buffer;
|
||||||
@ -1499,11 +1500,15 @@ readline (linebuffer, stream, filename)
|
|||||||
{
|
{
|
||||||
if (fgets (p, end - p, stream) == 0)
|
if (fgets (p, end - p, stream) == 0)
|
||||||
if (feof (stream))
|
if (feof (stream))
|
||||||
return nlines;
|
break;
|
||||||
else
|
else
|
||||||
pfatal_with_name (filename);
|
pfatal_with_name (filename);
|
||||||
|
|
||||||
len = strlen (p);
|
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;
|
p += len;
|
||||||
if (p[-1] != '\n')
|
if (p[-1] != '\n')
|
||||||
{
|
{
|
||||||
@ -1543,7 +1548,7 @@ readline (linebuffer, stream, filename)
|
|||||||
if (!backslash)
|
if (!backslash)
|
||||||
{
|
{
|
||||||
p[-1] = '\0';
|
p[-1] = '\0';
|
||||||
return nlines;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end - p <= 1)
|
if (end - p <= 1)
|
||||||
@ -1557,6 +1562,8 @@ readline (linebuffer, stream, filename)
|
|||||||
linebuffer->buffer = buffer;
|
linebuffer->buffer = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Construct the list of include directories
|
/* Construct the list of include directories
|
||||||
|
Loading…
Reference in New Issue
Block a user