#endif
};
- opt_complementary = "t--d:d--t:s--d:d--s" IF_FEATURE_INSTALL_LONG_OPTIONS(IF_SELINUX(":Z--\xff:\xff--Z"));
/* -c exists for backwards compatibility, it's needed */
/* -b is ignored ("make a backup of each existing destination file") */
- opts = GETOPT32(argv, "cvb" "Ddpsg:m:o:t:" IF_SELINUX("Z:"),
- LONGOPTS
- &gid_str, &mode_str, &uid_str, &last
- IF_SELINUX(, &scontext)
+ opts = GETOPT32(argv, "^"
+ "cvb" "Ddpsg:m:o:t:" IF_SELINUX("Z:")
+ "\0"
+ "t--d:d--t:s--d:d--s"
+ IF_FEATURE_INSTALL_LONG_OPTIONS(IF_SELINUX(":Z--\xff:\xff--Z")),
+ LONGOPTS
+ &gid_str, &mode_str, &uid_str, &last
+ IF_SELINUX(, &scontext)
);
argc -= optind;
argv += optind;
dest = last;
if (opts & OPT_MKDIR_LEADING) {
char *ddir = xstrdup(dest);
- bb_make_directory(dirname(ddir), 0755, mkdir_flags);
+ /*
+ * -D -t DIR1/DIR2/F3 FILE: create DIR1/DIR2/F3, copy FILE there
+ * -D FILE DIR1/DIR2/F3: create DIR1/DIR2, copy FILE there as F3
+ */
+ bb_make_directory((opts & OPT_TARGET) ? ddir : dirname(ddir), 0755, mkdir_flags);
/* errors are not checked. copy_file
* will fail if dir is not created.
*/