--- bin/cp/cp.c.orig Tue Oct 4 14:49:42 2005 +++ bin/cp/cp.c Wed Oct 5 10:14:27 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 Tue Oct 4 14:57:33 2005 +++ bin/cp/utils.c Tue Oct 4 15:17:59 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/mv/mv.c.orig Tue Oct 4 15:21:23 2005 +++ bin/mv/mv.c Wed Oct 5 15:04:41 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); @@ -356,9 +365,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); } @@ -399,8 +411,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/rm/rm.c.orig Wed Jun 2 07:58:54 2004 +++ bin/rm/rm.c Tue Oct 4 16:00:16 2005 @@ -63,7 +63,7 @@ extern char *__progname; -int dflag, eval, fflag, iflag, Pflag, Wflag, stdin_ok; +int dflag, eval, fflag, iflag, Pflag, Wflag, 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, "dfiPRrW")) != -1) + while ((ch = getopt(argc, argv, "dfiPRrWv")) != -1) switch(ch) { case 'd': dflag = 1; @@ -111,6 +111,9 @@ case 'W': Wflag = 1; break; + case 'v': + vflag = 1; + break; default: usage(); } @@ -209,6 +212,8 @@ * 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: @@ -250,6 +255,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 (Wflag) { @@ -442,6 +450,6 @@ void usage(void) { - (void)fprintf(stderr, "usage: %s [-dfiPRrW] file ...\n", __progname); + (void)fprintf(stderr, "usage: %s [-dfiPRrWv] file ...\n", __progname); exit(1); }