diff -Naur make-3.81/commands.c make-3.81_orig/commands.c --- make-3.81/commands.c 2006-08-29 16:51:53.254814400 +0200 +++ make-3.81_orig/commands.c 2006-02-20 03:14:01.000000000 +0100 @@ -596,12 +596,12 @@ { register char *s; - fputs (_("# commands to execute"), data_base); + fputs (_("# commands to execute"), stdout); if (cmds->fileinfo.filenm == 0) - fputs (_(" (built-in):"), data_base); + puts (_(" (built-in):")); else - fprintf (data_base, _(" (from `%s', line %lu):\n"), + printf (_(" (from `%s', line %lu):\n"), cmds->fileinfo.filenm, cmds->fileinfo.lineno); s = cmds->commands; @@ -616,7 +616,7 @@ if (end == 0) end = s + strlen (s); - fprintf (data_base, "\t%.*s\n", (int) (end - s), s); + printf ("\t%.*s\n", (int) (end - s), s); s = end; } diff -Naur make-3.81/dir.c make-3.81_orig/dir.c --- make-3.81/dir.c 2006-08-29 16:53:05.919300800 +0200 +++ make-3.81_orig/dir.c 2006-02-11 23:16:04.000000000 +0100 @@ -980,7 +980,7 @@ register struct directory **dir_slot; register struct directory **dir_end; - fputs (_("\n# Directories\n"), data_base); + puts (_("\n# Directories\n")); files = impossible = 0; @@ -992,20 +992,20 @@ if (! HASH_VACANT (dir)) { if (dir->contents == 0) - fprintf (data_base, _("# %s: could not be stat'd.\n"), dir->name); + printf (_("# %s: could not be stat'd.\n"), dir->name); else if (dir->contents->dirfiles.ht_vec == 0) { #ifdef WINDOWS32 - fprintf (data_base, _("# %s (key %s, mtime %d): could not be opened.\n"), + printf (_("# %s (key %s, mtime %d): could not be opened.\n"), dir->name, dir->contents->path_key,dir->contents->mtime); #else /* WINDOWS32 */ #ifdef VMS - fprintf (data_base, _("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"), + printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"), dir->name, dir->contents->dev, dir->contents->ino[0], dir->contents->ino[1], dir->contents->ino[2]); #else - fprintf (data_base, _("# %s (device %ld, inode %ld): could not be opened.\n"), + printf (_("# %s (device %ld, inode %ld): could not be opened.\n"), dir->name, (long int) dir->contents->dev, (long int) dir->contents->ino); #endif @@ -1032,51 +1032,51 @@ } } #ifdef WINDOWS32 - fprintf (data_base, _("# %s (key %s, mtime %d): "), + printf (_("# %s (key %s, mtime %d): "), dir->name, dir->contents->path_key, dir->contents->mtime); #else /* WINDOWS32 */ #ifdef VMS - fprintf (data_base, _("# %s (device %d, inode [%d,%d,%d]): "), + printf (_("# %s (device %d, inode [%d,%d,%d]): "), dir->name, dir->contents->dev, dir->contents->ino[0], dir->contents->ino[1], dir->contents->ino[2]); #else - fprintf (data_base, _("# %s (device %ld, inode %ld): "), + printf (_("# %s (device %ld, inode %ld): "), dir->name, (long)dir->contents->dev, (long)dir->contents->ino); #endif #endif /* WINDOWS32 */ if (f == 0) - fputs (_("No"), data_base); + fputs (_("No"), stdout); else - fprintf (data_base, "%u", f); - fputs (_(" files, "), data_base); + printf ("%u", f); + fputs (_(" files, "), stdout); if (im == 0) - fputs (_("no"), data_base); + fputs (_("no"), stdout); else - fprintf (data_base, "%u", im); - fputs (_(" impossibilities"), data_base); + printf ("%u", im); + fputs (_(" impossibilities"), stdout); if (dir->contents->dirstream == 0) - fputs (".", data_base); + puts ("."); else - fputs (_(" so far."), data_base); + puts (_(" so far.")); files += f; impossible += im; } } } - fputs ("\n# ", data_base); + fputs ("\n# ", stdout); if (files == 0) - fputs (_("No"), data_base); + fputs (_("No"), stdout); else - fprintf (data_base, "%u", files); - fputs (_(" files, "), data_base); + printf ("%u", files); + fputs (_(" files, "), stdout); if (impossible == 0) - fputs (_("no"), data_base); + fputs (_("no"), stdout); else - fprintf (data_base, "%u", impossible); - fprintf (data_base, _(" impossibilities in %lu directories.\n"), directories.ht_fill); + printf ("%u", impossible); + printf (_(" impossibilities in %lu directories.\n"), directories.ht_fill); } /* Hooks for globbing. */ diff -Naur make-3.81/file.c make-3.81_orig/file.c --- make-3.81/file.c 2006-08-29 16:53:40.779427200 +0200 +++ make-3.81_orig/file.c 2006-03-17 15:24:20.000000000 +0100 @@ -876,72 +876,72 @@ struct dep *d; struct dep *ood = 0; - putc ('\n', data_base); + putchar ('\n'); if (!f->is_target) - fputs (_("# Not a target:"), data_base); - fprintf (data_base, "%s:%s", f->name, f->double_colon ? ":" : ""); + puts (_("# Not a target:")); + printf ("%s:%s", f->name, f->double_colon ? ":" : ""); /* Print all normal dependencies; note any order-only deps. */ for (d = f->deps; d != 0; d = d->next) if (! d->ignore_mtime) - fprintf (data_base, " %s", dep_name (d)); + printf (" %s", dep_name (d)); else if (! ood) ood = d; /* Print order-only deps, if we have any. */ if (ood) { - fprintf (data_base, " | %s", dep_name (ood)); + printf (" | %s", dep_name (ood)); for (d = ood->next; d != 0; d = d->next) if (d->ignore_mtime) - fprintf (data_base, " %s", dep_name (d)); + printf (" %s", dep_name (d)); } - putc ('\n', data_base); + putchar ('\n'); if (f->precious) - fputs (_("# Precious file (prerequisite of .PRECIOUS)."), data_base); + puts (_("# Precious file (prerequisite of .PRECIOUS).")); if (f->phony) - fputs (_("# Phony target (prerequisite of .PHONY)."), data_base); + puts (_("# Phony target (prerequisite of .PHONY).")); if (f->cmd_target) - fputs (_("# Command-line target."), data_base); + puts (_("# Command-line target.")); if (f->dontcare) - fputs (_("# A default, MAKEFILES, or -include/sinclude makefile."), data_base); - fputs (f->tried_implicit + puts (_("# A default, MAKEFILES, or -include/sinclude makefile.")); + puts (f->tried_implicit ? _("# Implicit rule search has been done.") - : _("# Implicit rule search has not been done."), data_base); + : _("# Implicit rule search has not been done.")); if (f->stem != 0) - fprintf (data_base, _("# Implicit/static pattern stem: `%s'\n"), f->stem); + printf (_("# Implicit/static pattern stem: `%s'\n"), f->stem); if (f->intermediate) - fputs (_("# File is an intermediate prerequisite."), data_base); + puts (_("# File is an intermediate prerequisite.")); if (f->also_make != 0) { - fputs (_("# Also makes:"), data_base); + fputs (_("# Also makes:"), stdout); for (d = f->also_make; d != 0; d = d->next) - fprintf (data_base, " %s", dep_name (d)); - putc ('\n', data_base); + printf (" %s", dep_name (d)); + putchar ('\n'); } if (f->last_mtime == UNKNOWN_MTIME) - fputs (_("# Modification time never checked."), data_base); + puts (_("# Modification time never checked.")); else if (f->last_mtime == NONEXISTENT_MTIME) - fputs (_("# File does not exist."), data_base); + puts (_("# File does not exist.")); else if (f->last_mtime == OLD_MTIME) - fputs (_("# File is very old."), data_base); + puts (_("# File is very old.")); else { char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; file_timestamp_sprintf (buf, f->last_mtime); - fprintf (data_base, _("# Last modified %s\n"), buf); + printf (_("# Last modified %s\n"), buf); } - fputs (f->updated - ? _("# File has been updated.") : _("# File has not been updated."), data_base); + puts (f->updated + ? _("# File has been updated.") : _("# File has not been updated.")); switch (f->command_state) { case cs_running: - fputs (_("# Commands currently running (THIS IS A BUG)."), data_base); + puts (_("# Commands currently running (THIS IS A BUG).")); break; case cs_deps_running: - fputs (_("# Dependencies commands running (THIS IS A BUG)."), data_base); + puts (_("# Dependencies commands running (THIS IS A BUG).")); break; case cs_not_started: case cs_finished: @@ -950,25 +950,25 @@ case -1: break; case 0: - fputs (_("# Successfully updated."), data_base); + puts (_("# Successfully updated.")); break; case 1: assert (question_flag); - fputs (_("# Needs to be updated (-q is set)."), data_base); + puts (_("# Needs to be updated (-q is set).")); break; case 2: - fputs (_("# Failed to be updated."), data_base); + puts (_("# Failed to be updated.")); break; default: - fputs (_("# Invalid value in `update_status' member!"), data_base); - fflush (data_base); + puts (_("# Invalid value in `update_status' member!")); + fflush (stdout); fflush (stderr); abort (); } break; default: - fputs (_("# Invalid value in `command_state' member!"), data_base); - fflush (data_base); + puts (_("# Invalid value in `command_state' member!")); + fflush (stdout); fflush (stderr); abort (); } @@ -986,12 +986,12 @@ void print_file_data_base (void) { - fputs (_("\n# Files"), data_base); + puts (_("\n# Files")); hash_map (&files, print_file); - fputs (_("\n# files hash-table stats:\n# "), data_base); - hash_print_stats (&files, data_base); + fputs (_("\n# files hash-table stats:\n# "), stdout); + hash_print_stats (&files, stdout); } #define EXPANSION_INCREMENT(_l) ((((_l) / 500) + 1) * 500) diff -Naur make-3.81/main.c make-3.81_orig/main.c --- make-3.81/main.c 2006-08-29 16:54:28.017352000 +0200 +++ make-3.81_orig/main.c 2006-03-20 03:36:37.000000000 +0100 @@ -177,9 +177,6 @@ int print_data_base_flag = 0; -static struct stringlist* data_base_fname = NULL; -FILE* data_base = NULL; - /* Nonzero means don't remake anything; just return a nonzero status if the specified targets are not up to date (-q). */ @@ -334,8 +331,6 @@ N_("\ -p, --print-data-base Print make's internal database.\n"), N_("\ - -P, --data-base-file File name to print make's internal database to.\n"), - N_("\ -q, --question Run no commands; exit status says if up to date.\n"), N_("\ -r, --no-builtin-rules Disable the built-in implicit rules.\n"), @@ -404,7 +399,6 @@ { 'o', string, (char *) &old_files, 0, 0, 0, 0, 0, "old-file" }, { 'p', flag, (char *) &print_data_base_flag, 1, 1, 0, 0, 0, "print-data-base" }, - { 'P', string, (char *) &data_base_fname, 0, 0, 0, 0, 0, "data-base-file" }, { 'q', flag, (char *) &question_flag, 1, 1, 1, 0, 0, "question" }, { 'r', flag, (char *) &no_builtin_rules_flag, 1, 1, 0, 0, 0, "no-builtin-rules" }, @@ -1250,20 +1244,6 @@ /* Set always_make_flag if -B was given and we've not restarted already. */ always_make_flag = always_make_set && (restarts == 0); - /* TODO: where to fclose() this one best ? */ - if (data_base_fname != NULL && data_base_fname->list != NULL - && data_base_fname->list[0] != NULL) { - data_base = fopen(data_base_fname->list[0], "w"); - if(data_base == NULL) { - fprintf(stderr, "could not write-open '%s'\n", data_base_fname->list[0]); - exit(-1); - } - print_data_base_flag = 1; - } - else { - data_base = stdout; - } - /* Print version information. */ if (print_version_flag || print_data_base_flag || db_level) { @@ -2955,26 +2935,26 @@ year, and none of the rest of it should be translated (including the word "Copyright", so it hardly seems worth it. */ - fprintf (data_base, "%sGNU Make %s\n\ + printf ("%sGNU Make %s\n\ %sCopyright (C) 2006 Free Software Foundation, Inc.\n", precede, version_string, precede); - fprintf (data_base, _("%sThis is free software; see the source for copying conditions.\n\ + printf (_("%sThis is free software; see the source for copying conditions.\n\ %sThere is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ %sPARTICULAR PURPOSE.\n"), precede, precede, precede); if (!remote_description || *remote_description == '\0') - fprintf (data_base, _("\n%sThis program built for %s\n"), precede, make_host); + printf (_("\n%sThis program built for %s\n"), precede, make_host); else - fprintf (data_base, _("\n%sThis program built for %s (%s)\n"), + printf (_("\n%sThis program built for %s (%s)\n"), precede, make_host, remote_description); printed_version = 1; /* Flush stdout so the user doesn't have to wait to see the version information while things are thought about. */ - fflush (data_base); + fflush (stdout); } /* Print a bunch of information about this and that. */ @@ -2985,7 +2965,7 @@ time_t when; when = time ((time_t *) 0); - fprintf (data_base, _("\n# Make data base, printed on %s"), ctime (&when)); + printf (_("\n# Make data base, printed on %s"), ctime (&when)); print_variable_data_base (); print_dir_data_base (); @@ -2995,7 +2975,7 @@ strcache_print_stats ("#"); when = time ((time_t *) 0); - fprintf (data_base, _("\n# Finished Make data base on %s\n"), ctime (&when)); + printf (_("\n# Finished Make data base on %s\n"), ctime (&when)); } static void diff -Naur make-3.81/make.h make-3.81_orig/make.h --- make-3.81/make.h 2006-08-29 16:54:40.945942400 +0200 +++ make-3.81_orig/make.h 2006-02-16 00:54:43.000000000 +0100 @@ -507,7 +507,6 @@ extern int print_version_flag, print_directory_flag, check_symlink_flag; extern int warn_undefined_variables_flag, posix_pedantic, not_parallel; extern int second_expansion, clock_skew_detected, rebuilding_makefiles; -extern FILE* data_base; /* can we run commands via 'sh -c xxx' or must we use batch files? */ extern int batch_mode_shell; diff -Naur make-3.81/rule.c make-3.81_orig/rule.c --- make-3.81/rule.c 2006-08-29 16:55:02.987636800 +0200 +++ make-3.81_orig/rule.c 2006-03-17 15:24:20.000000000 +0100 @@ -522,18 +522,18 @@ for (i = 0; r->targets[i] != 0; ++i) { - fputs (r->targets[i], data_base); + fputs (r->targets[i], stdout); if (r->targets[i + 1] != 0) - putc (' ', data_base); + putchar (' '); else - putc (':', data_base); + putchar (':'); } if (r->terminal) - putc (':', data_base); + putchar (':'); for (d = r->deps; d != 0; d = d->next) - fprintf (data_base, " %s", dep_name (d)); - putc ('\n', data_base); + printf (" %s", dep_name (d)); + putchar ('\n'); if (r->cmds != 0) print_commands (r->cmds); @@ -545,14 +545,14 @@ register unsigned int rules, terminal; register struct rule *r; - fputs (_("\n# Implicit Rules"), data_base); + puts (_("\n# Implicit Rules")); rules = terminal = 0; for (r = pattern_rules; r != 0; r = r->next) { ++rules; - putc ('\n', data_base); + putchar ('\n'); print_rule (r); if (r->terminal) @@ -560,19 +560,19 @@ } if (rules == 0) - fputs (_("\n# No implicit rules."), data_base); + puts (_("\n# No implicit rules.")); else { - fprintf (data_base, _("\n# %u implicit rules, %u"), rules, terminal); + printf (_("\n# %u implicit rules, %u"), rules, terminal); #ifndef NO_FLOAT - fprintf (data_base, " (%.1f%%)", (double) terminal / (double) rules * 100.0); + printf (" (%.1f%%)", (double) terminal / (double) rules * 100.0); #else { int f = (terminal * 1000 + 5) / rules; - fprintf (data_base, " (%d.%d%%)", f/10, f%10); + printf (" (%d.%d%%)", f/10, f%10); } #endif - fputs (_(" terminal."), data_base); + puts (_(" terminal.")); } if (num_pattern_rules != rules) diff -Naur make-3.81/strcache.c make-3.81_orig/strcache.c --- make-3.81/strcache.c 2006-08-29 16:55:15.685896000 +0200 +++ make-3.81_orig/strcache.c 2006-02-11 23:16:05.000000000 +0100 @@ -207,10 +207,10 @@ avgsize = numbuffs ? (int)(totsize / numbuffs) : 0; avgfree = numbuffs ? (int)(totfree / numbuffs) : 0; - fprintf (data_base, _("\n%s # of strings in strcache: %d\n"), prefix, numstrs); - fprintf (data_base, _("%s # of strcache buffers: %d\n"), prefix, numbuffs); - fprintf (data_base, _("%s strcache size: total = %d / max = %d / min = %d / avg = %d\n"), + printf (_("\n%s # of strings in strcache: %d\n"), prefix, numstrs); + printf (_("%s # of strcache buffers: %d\n"), prefix, numbuffs); + printf (_("%s strcache size: total = %d / max = %d / min = %d / avg = %d\n"), prefix, totsize, maxsize, minsize, avgsize); - fprintf (data_base, _("%s strcache free: total = %d / max = %d / min = %d / avg = %d\n"), + printf (_("%s strcache free: total = %d / max = %d / min = %d / avg = %d\n"), prefix, totfree, maxfree, minfree, avgfree); } diff -Naur make-3.81/variable.c make-3.81_orig/variable.c --- make-3.81/variable.c 2006-08-29 16:55:44.557411200 +0200 +++ make-3.81_orig/variable.c 2006-03-08 21:15:08.000000000 +0100 @@ -1390,39 +1390,39 @@ default: abort (); } - fputs ("# ", data_base); - fputs (origin, data_base); + fputs ("# ", stdout); + fputs (origin, stdout); if (v->fileinfo.filenm) - fprintf (data_base, _(" (from `%s', line %lu)"), + printf (_(" (from `%s', line %lu)"), v->fileinfo.filenm, v->fileinfo.lineno); - putc ('\n', data_base); - fputs (prefix, data_base); + putchar ('\n'); + fputs (prefix, stdout); /* Is this a `define'? */ if (v->recursive && strchr (v->value, '\n') != 0) - fprintf (data_base, "define %s\n%s\nendef\n", v->name, v->value); + printf ("define %s\n%s\nendef\n", v->name, v->value); else { register char *p; - fprintf (data_base, "%s %s= ", v->name, v->recursive ? v->append ? "+" : "" : ":"); + printf ("%s %s= ", v->name, v->recursive ? v->append ? "+" : "" : ":"); /* Check if the value is just whitespace. */ p = next_token (v->value); if (p != v->value && *p == '\0') /* All whitespace. */ - fprintf (data_base, "$(subst ,,%s)", v->value); + printf ("$(subst ,,%s)", v->value); else if (v->recursive) - fputs (v->value, data_base); + fputs (v->value, stdout); else /* Double up dollar signs. */ for (p = v->value; *p != '\0'; ++p) { if (*p == '$') - putc ('$', data_base); - putc (*p, data_base); + putchar ('$'); + putchar (*p); } - putc ('\n', data_base); + putchar ('\n'); } } @@ -1435,10 +1435,10 @@ { hash_map_arg (&set->table, print_variable, prefix); - fputs (_("# variable set hash-table stats:\n"), data_base); - fputs ("# ", data_base); - hash_print_stats (&set->table, data_base); - putc ('\n', data_base); + fputs (_("# variable set hash-table stats:\n"), stdout); + fputs ("# ", stdout); + hash_print_stats (&set->table, stdout); + putc ('\n', stdout); } /* Print the data base of variables. */ @@ -1446,11 +1446,11 @@ void print_variable_data_base (void) { - fputs ( _("\n# Variables\n"), data_base); + puts (_("\n# Variables\n")); print_variable_set (&global_variable_set, ""); - fputs (_("\n# Pattern-specific Variable Values"), data_base); + puts (_("\n# Pattern-specific Variable Values")); { struct pattern_var *p; @@ -1459,14 +1459,14 @@ for (p = pattern_vars; p != 0; p = p->next) { ++rules; - fprintf (data_base, "\n%s :\n", p->target); + printf ("\n%s :\n", p->target); print_variable (&p->variable, "# "); } if (rules == 0) - fputs (_("\n# No pattern-specific variable values."), data_base); + puts (_("\n# No pattern-specific variable values.")); else - fprintf (data_base, _("\n# %u pattern-specific variable values"), rules); + printf (_("\n# %u pattern-specific variable values"), rules); } } diff -Naur make-3.81/vpath.c make-3.81_orig/vpath.c --- make-3.81/vpath.c 2006-08-29 16:56:02.743561600 +0200 +++ make-3.81_orig/vpath.c 2006-02-11 23:16:05.000000000 +0100 @@ -568,7 +568,7 @@ register unsigned int nvpaths; register struct vpath *v; - fputs (_("\n# VPATH Search Paths\n"), data_base); + puts (_("\n# VPATH Search Paths\n")); nvpaths = 0; for (v = vpaths; v != 0; v = v->next) @@ -577,29 +577,29 @@ ++nvpaths; - fprintf (data_base, "vpath %s ", v->pattern); + printf ("vpath %s ", v->pattern); for (i = 0; v->searchpath[i] != 0; ++i) - fprintf (data_base, "%s%c", v->searchpath[i], + printf ("%s%c", v->searchpath[i], v->searchpath[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR); } if (vpaths == 0) - fputs (_("# No `vpath' search paths."), data_base); + puts (_("# No `vpath' search paths.")); else - fprintf (data_base, _("\n# %u `vpath' search paths.\n"), nvpaths); + printf (_("\n# %u `vpath' search paths.\n"), nvpaths); if (general_vpath == 0) - fputs (_("\n# No general (`VPATH' variable) search path."), data_base); + puts (_("\n# No general (`VPATH' variable) search path.")); else { register char **path = general_vpath->searchpath; register unsigned int i; - fputs (_("\n# General (`VPATH' variable) search path:\n# "), data_base); + fputs (_("\n# General (`VPATH' variable) search path:\n# "), stdout); for (i = 0; path[i] != 0; ++i) - fprintf (data_base, "%s%c", path[i], + printf ("%s%c", path[i], path[i + 1] == 0 ? '\n' : PATH_SEPARATOR_CHAR); } }