(log_working_directory): Made global.

Print entering msg only once.
This commit is contained in:
Roland McGrath 1995-11-26 01:37:07 +00:00
parent 808f1c1cd2
commit 37cf6fdc18

24
main.c
View file

@ -43,7 +43,6 @@ extern double atof ();
#endif
extern char *mktemp ();
static void log_working_directory ();
static void print_data_base (), print_version ();
static void decode_switches (), decode_env_switches ();
static void define_makeflags ();
@ -688,10 +687,6 @@ main (argc, argv, envp)
starting_directory = current_directory;
}
/* Tell the user where he is. */
if (print_directory_flag)
log_working_directory (1);
/* Read any stdin makefiles into temporary files. */
@ -1010,8 +1005,7 @@ main (argc, argv, envp)
if (print_data_base_flag)
print_data_base ();
if (print_directory_flag)
log_working_directory (0);
log_working_directory (0);
if (makefiles != 0)
{
@ -1950,8 +1944,7 @@ die (status)
if (print_data_base_flag)
print_data_base ();
if (print_directory_flag)
log_working_directory (0);
log_working_directory (0);
}
exit (status);
@ -1960,20 +1953,21 @@ die (status)
/* Write a message indicating that we've just entered or
left (according to ENTERING) the current directory. */
static void
void
log_working_directory (entering)
int entering;
{
static int entered = 0;
char *message = entering ? "Entering" : "Leaving";
if (entering)
entered = 1;
else if (!entered)
/* Don't print the leaving message if we
haven't printed the entering message. */
/* Print nothing without the flag. Don't print the entering message
again if we already have. Don't print the leaving message if we
haven't printed the entering message. */
if (! print_directory_flag || entering == entered)
return;
entered = entering;
if (print_data_base_flag)
fputs ("# ", stdout);