show total number of files to copy

This commit is contained in:
Michael Wehr
2022-01-09 21:18:46 +01:00
parent ae89bfdb24
commit b79170e69b

View File

@@ -1,6 +1,6 @@
diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
--- coreutils-9.0/src/copy.c 2021-09-24 13:31:05.000000000 +0200 --- coreutils-9.0/src/copy.c 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/copy.c 2022-01-09 21:12:20.602444195 +0100 +++ coreutils-9.0-patched/src/copy.c 2022-01-09 21:17:53.190781361 +0100
@@ -129,6 +129,119 @@ @@ -129,6 +129,119 @@
dev_t dev; dev_t dev;
}; };
@@ -283,7 +283,7 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
return false; return false;
dest_pos = ext_start + n_read; dest_pos = ext_start + n_read;
@@ -1374,8 +1601,82 @@ @@ -1374,8 +1601,84 @@
buf_alloc = xmalloc (buf_size + buf_alignment); buf_alloc = xmalloc (buf_size + buf_alignment);
buf = ptr_align (buf_alloc, buf_alignment); buf = ptr_align (buf_alloc, buf_alignment);
@@ -324,9 +324,11 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
+ /* show how many files were written */ + /* show how many files were written */
+ int sum_length = 0; + int sum_length = 0;
+ if ( x->move_mode ) + if ( x->move_mode )
+ sum_length = sprintf ( cProgressField[1], "%d files moved so far...", g_iFilesCopied ); + sum_length = sprintf ( cProgressField[1], "%d of %d files moved so far...",
+ g_iFilesCopied, g_iTotalFiles );
+ else + else
+ sum_length = sprintf ( cProgressField[1], "%d files copied so far...", g_iFilesCopied ); + sum_length = sprintf ( cProgressField[1], "%d of %d files copied so far...",
+ g_iFilesCopied, g_iTotalFiles );
+ cProgressField[1][sum_length] = ' '; + cProgressField[1][sum_length] = ' ';
+ } + }
+ +
@@ -366,7 +368,7 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
if (! ( if (! (
#ifdef SEEK_HOLE #ifdef SEEK_HOLE
scantype == LSEEK_SCANTYPE scantype == LSEEK_SCANTYPE
@@ -1383,15 +1684,30 @@ @@ -1383,15 +1686,30 @@
scan_inference.ext_start, src_open_sb.st_size, scan_inference.ext_start, src_open_sb.st_size,
make_holes ? x->sparse_mode : SPARSE_NEVER, make_holes ? x->sparse_mode : SPARSE_NEVER,
x->reflink_mode != REFLINK_NEVER, x->reflink_mode != REFLINK_NEVER,
@@ -399,7 +401,7 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
{ {
return_val = false; return_val = false;
goto close_src_and_dst_desc; goto close_src_and_dst_desc;
@@ -1402,6 +1718,14 @@ @@ -1402,6 +1720,14 @@
return_val = false; return_val = false;
goto close_src_and_dst_desc; goto close_src_and_dst_desc;
} }
@@ -416,7 +418,7 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
if (x->preserve_timestamps) if (x->preserve_timestamps)
diff -aur coreutils-9.0/src/copy.h coreutils-9.0-patched/src/copy.h diff -aur coreutils-9.0/src/copy.h coreutils-9.0-patched/src/copy.h
--- coreutils-9.0/src/copy.h 2021-09-24 13:31:05.000000000 +0200 --- coreutils-9.0/src/copy.h 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/copy.h 2022-01-09 21:12:20.602444195 +0100 +++ coreutils-9.0-patched/src/copy.h 2022-01-09 21:17:53.194781413 +0100
@@ -236,6 +236,11 @@ @@ -236,6 +236,11 @@
Create destination directories as usual. */ Create destination directories as usual. */
bool symbolic_link; bool symbolic_link;
@@ -451,7 +453,7 @@ diff -aur coreutils-9.0/src/copy.h coreutils-9.0-patched/src/copy.h
#endif #endif
diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c
--- coreutils-9.0/src/cp.c 2021-09-24 13:31:05.000000000 +0200 --- coreutils-9.0/src/cp.c 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/cp.c 2022-01-09 21:12:20.606444248 +0100 +++ coreutils-9.0-patched/src/cp.c 2022-01-09 21:17:53.194781413 +0100
@@ -131,6 +131,9 @@ @@ -131,6 +131,9 @@
{"symbolic-link", no_argument, NULL, 's'}, {"symbolic-link", no_argument, NULL, 's'},
{"target-directory", required_argument, NULL, 't'}, {"target-directory", required_argument, NULL, 't'},
@@ -663,7 +665,7 @@ diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c
version_control_string) version_control_string)
diff -aur coreutils-9.0/src/mv.c coreutils-9.0-patched/src/mv.c diff -aur coreutils-9.0/src/mv.c coreutils-9.0-patched/src/mv.c
--- coreutils-9.0/src/mv.c 2021-09-24 13:31:05.000000000 +0200 --- coreutils-9.0/src/mv.c 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/mv.c 2022-01-09 21:12:20.606444248 +0100 +++ coreutils-9.0-patched/src/mv.c 2022-01-09 21:17:53.194781413 +0100
@@ -66,6 +66,9 @@ @@ -66,6 +66,9 @@
{"target-directory", required_argument, NULL, 't'}, {"target-directory", required_argument, NULL, 't'},
{"update", no_argument, NULL, 'u'}, {"update", no_argument, NULL, 'u'},