enum
{
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1,
- SPARSE_OPTION
+ SPARSE_OPTION,
+ STRIP_TRAILING_SLASHES_OPTION
};
int stat ();
as its destination instead of the usual "e_dir/e_file." */
static int flag_path = 0;
+/* Remove any trailing slashes from each SOURCE argument. */
+static int remove_trailing_slashes;
+
static char const *const sparse_type_string[] =
{
"never", "auto", "always", 0
{"path", no_argument, NULL, 'P'},
{"preserve", no_argument, NULL, 'p'},
{"recursive", no_argument, NULL, 'R'},
+ {"strip-trailing-slash", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
{"suffix", required_argument, NULL, 'S'},
{"symbolic-link", no_argument, NULL, 's'},
{"target-directory", required_argument, NULL, TARGET_DIRECTORY_OPTION},
special files like FIFOs or /dev/zero\n\
--sparse=WHEN control creation of sparse files\n\
-R, --recursive copy directories recursively\n\
+ --strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
+ argument\n\
-s, --symbolic-link make symbolic links instead of copying\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
--target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY\n\
char *arg_in_concat = NULL;
char *arg = file[i];
- strip_trailing_slashes (arg);
+ if (remove_trailing_slashes)
+ strip_trailing_slashes (arg);
if (flag_path)
{
tmp_source = (char *) alloca (strlen (source) + 1);
strcpy (tmp_source, source);
- strip_trailing_slashes (tmp_source);
+ if (remove_trailing_slashes)
+ strip_trailing_slashes (tmp_source);
source_base = base_name (tmp_source);
new_dest = (char *) alloca (strlen (dest)
x.copy_as_regular = 0;
break;
+ case STRIP_TRAILING_SLASHES_OPTION:
+ remove_trailing_slashes = 1;
+ break;
+
case 's':
#ifdef S_ISLNK
x.symbolic_link = 1;