diff -ur fileutils-4.1.orig/src/install.c fileutils-4.1/src/install.c --- fileutils-4.1.orig/src/install.c Mon Dec 25 06:07:36 2000 +++ fileutils-4.1/src/install.c Fri Mar 15 00:01:40 2002 @@ -94,6 +94,9 @@ static int install_file_in_file PARAMS ((const char *from, const char *to, const struct cp_options *x)); static void get_ids PARAMS ((void)); +static void log_add_install PARAMS ((const char *to)); +static void log_finalize PARAMS ((void)); +static void log_init PARAMS ((const char *path)); static void strip PARAMS ((const char *path)); void usage PARAMS ((int status)); @@ -124,6 +127,9 @@ /* If nonzero, install a directory instead of a regular file. */ static int dir_arg; +/* The filehandle of the log (if any) */ +static FILE *log_file; + static struct option const long_options[] = { {"backup", optional_argument, NULL, 'b'}, @@ -191,6 +197,7 @@ struct cp_options x; int n_files; char **file; + char *log_fn = NULL; program_name = argv[0]; setlocale (LC_ALL, ""); @@ -206,11 +213,16 @@ strip_files = 0; dir_arg = 0; umask (0); + log_file = NULL; /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); + log_fn = getenv("INSTALL_LOG"); + if (log_fn) + log_init(log_fn); + while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pvV:S:", long_options, NULL)) != -1) { @@ -346,6 +358,8 @@ } } + log_finalize(); + exit (errors); } @@ -392,6 +406,7 @@ { if (copy_file (from, to, x)) return 1; + log_add_install(to); if (strip_files) strip (to); if (change_attributes (to)) @@ -588,6 +603,32 @@ else group_id = (gid_t) -1; } + + +static void +log_add_install (const char *to) +{ + if (log_file) + fprintf(log_file, "install: %s\n", to); +} + + +static void +log_finalize (void) +{ + if (log_file) + fclose(log_file); +} + + +static void +log_init (const char *path) +{ + log_file = fopen (path, "a"); + if (!log_file) + error (0, 1, "cannot open log %s", path); +} + void usage (int status) diff -ur fileutils-4.1.orig/tests/install/Makefile.am fileutils-4.1/tests/install/Makefile.am --- fileutils-4.1.orig/tests/install/Makefile.am Sun Feb 27 09:10:57 2000 +++ fileutils-4.1/tests/install/Makefile.am Thu Mar 14 23:48:59 2002 @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*-. AUTOMAKE_OPTIONS = 1.3 gnits -TESTS = basic-1 create-leading +TESTS = basic-1 create-leading create-log EXTRA_DIST = $(TESTS) TESTS_ENVIRONMENT = \ PATH=`pwd`/../../src:$$PATH