4 * Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * @brief cp: copy file command
30 #include <linux/stat.h>
36 * @param[in] cmdtp FIXME
37 * @param[in] argc Argument count from command line
38 * @param[in] argv List of input arguments
40 static int do_cp ( cmd_tbl_t
*cmdtp
, int argc
, char *argv
[])
48 return COMMAND_ERROR_USAGE
;
50 if (!stat(argv
[argc
- 1], &statbuf
)) {
51 if (S_ISDIR(statbuf
.st_mode
))
55 if (argc
> 3 && !last_is_dir
) {
56 printf("cp: target `%s' is not a directory\n", argv
[argc
- 1]);
60 for (i
= 1; i
< argc
- 1; i
++) {
63 dst
= concat_path_file(argv
[argc
- 1], argv
[i
]);
64 ret
= copy_file(argv
[i
], dst
);
69 ret
= copy_file(argv
[i
], argv
[argc
- 1]);
80 static const __maybe_unused
char cmd_cp_help
[] =
81 "Usage: cp <source> <destination>\n"
82 "cp copies file <source> to <destination>.\n"
83 "Currently only this form is supported and you have to specify the exact target\n"
84 "filename (not a target directory).\n"
85 "This command is file based only. See memcpy for memory copy\n";
89 .usage
= "copy files",
90 U_BOOT_CMD_HELP(cmd_cp_help
)
94 * @page cp_command cp: Copy file
96 * Usage: cp \<source> [\<source>] \<destination>
98 * \c cp copies file \<source> to \<destination>
100 * Currently only this form is supported and you have to specify the exact
101 * target filename (not a target directory).\n
102 * This command is file based only. See memcpy for generic memory copy