--- bin/cp/cp.c.orig Sun Dec 19 17:28:54 2004 +++ bin/cp/cp.c Wed Nov 2 11:35:42 2005 @@ -85,7 +85,7 @@ PATH_T to = { to.p_path, "" }; uid_t myuid; -int Rflag, fflag, iflag, pflag, rflag; +int Rflag, fflag, iflag, pflag, rflag, vflag; int myumask; enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE }; @@ -105,7 +105,7 @@ (void)setlocale(LC_ALL, ""); Hflag = Lflag = Pflag = Rflag = 0; - while ((ch = getopt(argc, argv, "HLPRfipr")) != -1) + while ((ch = getopt(argc, argv, "HLPRfiprv")) != -1) switch (ch) { case 'H': Hflag = 1; @@ -136,6 +136,9 @@ case 'r': rflag = 1; break; + case 'v': + vflag = 1; + break; default: usage(); break; @@ -342,7 +345,7 @@ to.p_end = target_mid + nlen; *to.p_end = '\0'; } - + /* Not an error but need to remember it happened */ if (stat(to.p_path, &to_stat) == -1) { if (curr->fts_info == FTS_DP) @@ -397,6 +400,9 @@ continue; } } + + if (vflag) + printf("%s -> %s\n", curr->fts_path, to.p_path); switch (curr->fts_statp->st_mode & S_IFMT) { case S_IFLNK: --- bin/cp/utils.c.orig Sun Dec 19 17:28:54 2004 +++ bin/cp/utils.c Wed Nov 2 11:35:42 2005 @@ -302,9 +302,9 @@ usage(void) { (void)fprintf(stderr, - "usage: %s [-fip] [-R [-H | -L | -P]] source_file target_file\n", __progname); + "usage: %s [-fipv] [-R [-H | -L | -P]] source_file target_file\n", __progname); (void)fprintf(stderr, - " %s [-fip] [-R [-H | -L | -P]] source_file ... target_directory\n", + " %s [-fipv] [-R [-H | -L | -P]] source_file ... target_directory\n", __progname); exit(1); } --- bin/cp/cp.1.orig Wed Nov 2 11:41:00 2005 +++ bin/cp/cp.1 Wed Nov 2 11:50:28 2005 @@ -41,14 +41,14 @@ .Nd copy files .Sh SYNOPSIS .Nm cp -.Op Fl fip +.Op Fl fipv .Oo .Fl R .Op Fl H | L | P .Oc .Ar source_file target_file .Nm cp -.Op Fl fip +.Op Fl fipv .Oo .Fl R .Op Fl H | L | P @@ -136,6 +136,13 @@ or .Xr tar 1 instead. +.It Fl v +Print the old and new path of the +.Ar source_file +as it is being copied. If the +.Fl R +flag has been specified this will also show all the recursive items +being copied. .El .Pp For each destination file that already exists, its contents are --- bin/mv/mv.c.orig Thu Jun 30 22:30:13 2005 +++ bin/mv/mv.c Wed Nov 2 11:35:42 2005 @@ -67,7 +67,7 @@ extern char *__progname; -int fflg, iflg; +int fflg, iflg, vflg; int stdin_ok; int copy(char *, char *); @@ -84,7 +84,7 @@ int ch; char path[MAXPATHLEN]; - while ((ch = getopt(argc, argv, "if")) != -1) + while ((ch = getopt(argc, argv, "ifv")) != -1) switch (ch) { case 'i': fflg = 0; @@ -94,6 +94,9 @@ iflg = 0; fflg = 1; break; + case 'v': + vflg = 1; + break; default: usage(); } @@ -221,8 +224,11 @@ * message to standard error, and do nothing more with the * current source file... */ - if (!rename(from, to)) + if (!rename(from, to)) { + if (vflg) + (void)fprintf(stderr, "%s -> %s\n", from, to); return (0); + } if (errno != EXDEV) { warn("rename %s to %s", from, to); @@ -274,6 +280,9 @@ int nread, from_fd, to_fd; int badchown = 0, serrno = 0; + if (vflg) + (void)fprintf(stderr, "%s -> %s\n", from, to); + if ((from_fd = open(from, O_RDONLY, 0)) < 0) { warn("%s", from); return (1); @@ -355,9 +364,12 @@ { int status; pid_t pid; - + if ((pid = vfork()) == 0) { - execl(_PATH_CP, "mv", "-PRp", from, to, (char *)NULL); + if (vflg) + execl(_PATH_CP, "mv", "-PRpv", from, to, (char *)NULL); + else + execl(_PATH_CP, "mv", "-PRp", from, to, (char *)NULL); warn("%s", _PATH_CP); _exit(1); } @@ -398,8 +410,8 @@ void usage(void) { - (void)fprintf(stderr, "usage: %s [-fi] source target\n", __progname); - (void)fprintf(stderr, " %s [-fi] source ... directory\n", + (void)fprintf(stderr, "usage: %s [-fiv] source target\n", __progname); + (void)fprintf(stderr, " %s [-fiv] source ... directory\n", __progname); exit(1); } --- bin/mv/mv.1.orig Wed Nov 2 11:48:53 2005 +++ bin/mv/mv.1 Wed Nov 2 11:59:10 2005 @@ -41,10 +41,10 @@ .Nd move files .Sh SYNOPSIS .Nm mv -.Op Fl fi +.Op Fl fiv .Ar source target .Nm mv -.Op Fl fi +.Op Fl fiv .Ar source ... directory .Sh DESCRIPTION In its first form, the @@ -81,6 +81,13 @@ If the response from the standard input begins with the character .Dq y , the move is attempted. +.It Fl v +Print the old and new path of +.Ar source Ns . +If a recursive action is being undertaken by +.Nm mv Ns , +all items being processed will be printed with their old and +new pathname. .El .Pp The last of any --- bin/rm/rm.c.orig Wed Nov 2 11:24:22 2005 +++ bin/rm/rm.c Wed Nov 2 11:35:42 2005 @@ -63,7 +63,7 @@ extern char *__progname; -int dflag, eval, fflag, iflag, Pflag, stdin_ok; +int dflag, eval, fflag, iflag, Pflag, vflag, stdin_ok; int check(char *, char *, struct stat *); void checkdot(char **); @@ -88,7 +88,7 @@ setlocale(LC_ALL, ""); Pflag = rflag = 0; - while ((ch = getopt(argc, argv, "dfiPRr")) != -1) + while ((ch = getopt(argc, argv, "dfiPRrv")) != -1) switch(ch) { case 'd': dflag = 1; @@ -108,6 +108,9 @@ case 'r': /* Compatibility. */ rflag = 1; break; + case 'v': + vflag = 1; + break; default: usage(); } @@ -204,6 +207,9 @@ * able to remove it. Don't print out the un{read,search}able * message unless the remove fails. */ + if (vflag) + (void)fprintf(stderr, "removing `%s'\n", p->fts_path); + switch (p->fts_info) { case FTS_DP: case FTS_DNR: @@ -239,6 +245,9 @@ * to remove a directory is an error, so must always stat the file. */ while ((f = *argv++) != NULL) { + if (vflag) + (void)fprintf(stderr, "removing `%s'\n", f); + /* Assume if can't stat the file, can't unlink it. */ if (lstat(f, &sb)) { if (!fflag || errno != ENOENT) { @@ -421,6 +430,6 @@ void usage(void) { - (void)fprintf(stderr, "usage: %s [-dfiPRr] file ...\n", __progname); + (void)fprintf(stderr, "usage: %s [-dfiPRrv] file ...\n", __progname); exit(1); } --- bin/rm/rm.1.orig Wed Nov 2 11:59:36 2005 +++ bin/rm/rm.1 Wed Nov 2 12:03:13 2005 @@ -42,7 +42,7 @@ .Sh SYNOPSIS .Nm rm .Op Fl f | Fl i -.Op Fl dPRr +.Op Fl dPRrv .Ar file Op Ar ... .Sh DESCRIPTION The @@ -104,6 +104,9 @@ .It Fl r Equivalent to .Fl R . +.It Fl v +Prints all the files' path names being deleted by +.Nm rm Ns . .El .Pp The