Formerly read.c.~70~

This commit is contained in:
Roland McGrath 1993-12-02 20:44:03 +00:00
parent 12113c5925
commit f935610ca9

41
read.c
View file

@ -33,7 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
struct passwd *getpwnam (); struct passwd *getpwnam ();
static void read_makefile (); static int read_makefile ();
static unsigned int readline (), do_define (); static unsigned int readline (), do_define ();
static int conditional_line (); static int conditional_line ();
static void record_files (); static void record_files ();
@ -143,7 +143,8 @@ read_all_makefiles (makefiles)
{ {
if (*p != '\0') if (*p != '\0')
*p++ = '\0'; *p++ = '\0';
read_makefile (name, RM_NO_DEFAULT_GOAL | RM_INCLUDED | RM_DONTCARE); (void) read_makefile (name,
RM_NO_DEFAULT_GOAL | RM_INCLUDED | RM_DONTCARE);
} }
free (value); free (value);
@ -157,7 +158,8 @@ read_all_makefiles (makefiles)
struct dep *tail = read_makefiles; struct dep *tail = read_makefiles;
register struct dep *d; register struct dep *d;
read_makefile (*makefiles, 0); if (! read_makefile (*makefiles, 0))
perror_with_name ("", *makefiles);
/* Find the right element of read_makefiles. */ /* Find the right element of read_makefiles. */
d = read_makefiles; d = read_makefiles;
@ -181,7 +183,10 @@ read_all_makefiles (makefiles)
++p; ++p;
if (*p != 0) if (*p != 0)
read_makefile (*p, 0); {
if (! read_makefile (*p, 0))
perror_with_name ("", *p);
}
else else
{ {
/* No default makefile was found. Add the default makefiles to the /* No default makefile was found. Add the default makefiles to the
@ -214,9 +219,11 @@ read_all_makefiles (makefiles)
FLAGS contains bits as above. FLAGS contains bits as above.
FILENAME is added to the `read_makefiles' chain. */ FILENAME is added to the `read_makefiles' chain.
static void Returns 1 if a file was found and read, 0 if not. */
static int
read_makefile (filename, flags) read_makefile (filename, flags)
char *filename; char *filename;
int flags; int flags;
@ -314,19 +321,15 @@ read_makefile (filename, flags)
deps->changed = flags; deps->changed = flags;
deps = 0; deps = 0;
/* If the makefile can't be found at all, /* If the makefile can't be found at all, give up entirely. */
either ignore it or give up entirely. */
if (infile == 0) if (infile == 0)
{ {
if (! (flags & RM_DONTCARE)) /* If we did some searching, errno has the error from the last
{ attempt, rather from FILENAME itself. Restore it in case the
/* If we did some searching, errno has the error caller wants to use it in a message. */
from the last attempt, rather from FILENAME itself. */
errno = makefile_errno; errno = makefile_errno;
perror_with_name ("fopen: ", filename); return 0;
}
return;
} }
reading_filename = filename; reading_filename = filename;
@ -548,8 +551,10 @@ read_makefile (filename, flags)
free (files); free (files);
files = next; files = next;
read_makefile (name, (RM_INCLUDED | RM_NO_TILDE if (! read_makefile (name, (RM_INCLUDED | RM_NO_TILDE
| (noerror ? RM_DONTCARE : 0))); | (noerror ? RM_DONTCARE : 0))))
makefile_error (filename, lineno,
"%s: %s", name, strerror (errno));
} }
/* Free any space allocated by conditional_line. */ /* Free any space allocated by conditional_line. */
@ -737,6 +742,8 @@ read_makefile (filename, flags)
reading_filename = 0; reading_filename = 0;
reading_lineno_ptr = 0; reading_lineno_ptr = 0;
return 1;
} }
/* Execute a `define' directive. /* Execute a `define' directive.