1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:47:47 +00:00

Userland: Rename cp's "-r" flag to "-R"

Linux accepts both -r and -R, but the BSDs only like -R, and
dR POSIX also only mentions -R. So make -R the canonical flag.

Keep -r available as an alias for -R.
This commit is contained in:
Nico Weber 2021-01-06 18:32:51 -05:00 committed by Andreas Kling
parent 56c2cc4162
commit cf9135557b

View file

@ -57,7 +57,8 @@ int main(int argc, char** argv)
Core::ArgsParser args_parser;
args_parser.add_option(link, "Link files instead of copying", "link", 'l');
args_parser.add_option(recursion_allowed, "Copy directories recursively", "recursive", 'r');
args_parser.add_option(recursion_allowed, "Copy directories recursively", "recursive", 'R');
args_parser.add_option(recursion_allowed, "Same as -R", nullptr, 'r');
args_parser.add_option(verbose, "Verbose", "verbose", 'v');
args_parser.add_positional_argument(sources, "Source file path", "source");
args_parser.add_positional_argument(destination, "Destination file path", "destination");
@ -99,7 +100,7 @@ bool copy_file_or_directory(String src_path, String dst_path, bool recursion_all
if (S_ISDIR(src_stat.st_mode)) {
if (!recursion_allowed) {
fprintf(stderr, "cp: -r not specified; omitting directory '%s'\n", src_path.characters());
fprintf(stderr, "cp: -R not specified; omitting directory '%s'\n", src_path.characters());
return false;
}
return copy_directory(src_path, dst_path, link);