aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-04-09 22:01:20 -0500
committerRob Landley <rob@landley.net>2008-04-09 22:01:20 -0500
commitdd4d83e58135c7f75f5cf0103cd4c6ced4e86c84 (patch)
tree99297578f2ac31ebde593c912d11cb0c428cb876
parentaef99f4102bbb67963e651928bd79fcb2c656b6d (diff)
downloadtoybox-dd4d83e58135c7f75f5cf0103cd4c6ced4e86c84.tar.gz
Add -v to cp.
-rw-r--r--toys/cp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/toys/cp.c b/toys/cp.c
index d589f0ab..81a1e418 100644
--- a/toys/cp.c
+++ b/toys/cp.c
@@ -7,7 +7,7 @@
* See http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html
*
* "R+ra+d+p+r"
-USE_CP(NEWTOY(cp, "<2slrR+rdpa+d+p+rHLPif", TOYFLAG_BIN))
+USE_CP(NEWTOY(cp, "<2vslrR+rdpa+d+p+rHLPif", TOYFLAG_BIN))
config CP
bool "cp"
@@ -25,6 +25,7 @@ config CP
-d don't dereference symlinks
-a same as -dpr
-l hard link instead of copying
+ -v verbose
*/
#include "toys.h"
@@ -41,6 +42,7 @@ config CP
#define FLAG_r 512
#define FLAG_l 1024 // todo
#define FLAG_s 2048 // todo
+#define FLAG_v 4098
DEFINE_GLOBALS(
char *destname;
@@ -57,6 +59,9 @@ void cp_file(char *src, char *dst, struct stat *srcst)
{
int fdout = -1;
+ if (toys.optflags & FLAG_v)
+ printf("'%s' -> '%s'\n", src, dst);
+
// Copy directory or file to destination.
if (S_ISDIR(srcst->st_mode)) {