/* If nonzero, install a directory instead of a regular file. */
static int dir_arg;
+/* If nonzero, show what we are doing. */
+static int verbose;
+
/* If nonzero, display usage information and exit. */
static int show_help;
{"preserve-timestamps", no_argument, NULL, 'p'},
{"backup", no_argument, NULL, 'b'},
{"version-control", required_argument, NULL, 'V'},
+ {"verbose", no_argument, NULL, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
strip_files = 0;
preserve_timestamps = 0;
dir_arg = 0;
+ verbose = 0;
umask (0);
version = getenv ("SIMPLE_BACKUP_SUFFIX");
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
- while ((optc = getopt_long (argc, argv, "bcsdg:m:o:pV:S:", long_options,
+ while ((optc = getopt_long (argc, argv, "bcsdg:m:o:pvV:S:", long_options,
NULL)) != -1)
{
switch (optc)
case 'd':
dir_arg = 1;
break;
+ case 'v':
+ verbose = 1;
+ break;
case 'g':
group_name = optarg;
break;
for (; optind < argc; ++optind)
{
errors |=
- make_path (argv[optind], mode, mode, owner_id, group_id, 0, NULL);
+ make_path (argv[optind], mode, mode, owner_id, group_id, 0,
+ (verbose ? "%s" : NULL));
}
}
else
target_created = 0;
}
+ /* Now it's the time to give some feedback if requested. */
+ if (verbose)
+ printf ("%s -> %s\n", from, to);
+
fromfd = open (from, O_RDONLY, 0);
if (fromfd == -1)
{