bin/144531: [PATCH] bin/cp show percentage complete

Philippe Pepiot phil at philpep.org
Sun Mar 7 19:00:02 UTC 2010


>Number:         144531
>Category:       bin
>Synopsis:       [PATCH] bin/cp show percentage complete
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 07 19:00:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Philippe Pepiot
>Release:        FreeBSD 8.0-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD shen.philpep.org 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0 r202418: Fri Jan 15 22:29:53 CET 2010 root at shen.philpep.org:/usr/obj/usr/src/sys/SHEN i386


	
>Description:
	When use the -v (verbose) option, show progress complete.
>How-To-Repeat:
	
>Fix:

	

--- cp-show-progress.patch begins here ---
Index: utils.c
===================================================================
--- utils.c	(revision 204841)
+++ utils.c	(working copy)
@@ -216,6 +216,11 @@
 						    entp->fts_path, to.p_path,
 						    cp_pct(wtotal, fs->st_size));
 					}
+					if (vflag)
+						(void)fprintf(stderr,
+						    "%s -> %s %3d%%\033[0G",
+						    entp->fts_path, to.p_path,
+						    cp_pct(wtotal, fs->st_size));
 					if (wcount >= (ssize_t)wresid)
 						break;
 				}
Index: cp.c
===================================================================
--- cp.c	(revision 204841)
+++ cp.c	(working copy)
@@ -481,7 +481,7 @@
 			break;
 		}
 		if (vflag && !badcp)
-			(void)printf("%s -> %s\n", curr->fts_path, to.p_path);
+			(void)printf("%s -> %s 100%%\n", curr->fts_path, to.p_path);
 	}
 	if (errno)
 		err(1, "fts_read");
--- cp-show-progress.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list