diff -Nur file_orig/src/copy.c file_new/src/copy.c --- file_orig/src/copy.c 2001-01-13 16:49:43.000000000 +0100 +++ file_new/src/copy.c 2002-09-18 20:37:14.000000000 +0200 @@ -193,6 +193,8 @@ off_t n_read_total = 0; int last_write_made_hole = 0; int make_holes = (x->sparse_mode == SPARSE_ALWAYS); + int t_read = 0; + int p_stat = 0; source_desc = open (src_path, O_RDONLY); if (source_desc < 0) @@ -336,12 +338,40 @@ } if (ip == 0) { - if (full_write (dest_desc, buf, n_read) < 0) + int n_written = 0; + n_written = full_write (dest_desc, buf, n_read); + if (n_written < 0) { error (0, errno, _("writing %s"), quote (dst_path)); return_val = -1; goto close_src_and_dst_desc; } + else if (x->dotted_copy_style) + { /* TODO: insert dotted copy style */ + int f_size = (int)sb.st_size; + t_read += n_written; + if ( (int)(((float)t_read / (float)f_size) * 100) > p_stat) + { + p_stat = (int)(((float)t_read / (float)f_size) * 100); + if (p_stat < 100) + { + if (p_stat < 10) + { + printf(" %s -> %s: %i%% copied", quote (src_path), quote (dst_path), p_stat); + } + else + { + printf(" %s -> %s: %i%% copied", quote (src_path), quote (dst_path), p_stat); + } + } + else + { + printf(" %s -> %s: %i%% copied\n", quote (src_path), quote (dst_path), p_stat); + } + fflush(stdout); + } + } + last_write_made_hole = 0; } } diff -Nur file_orig/src/copy.h file_new/src/copy.h --- file_orig/src/copy.h 2001-01-14 12:03:30.000000000 +0100 +++ file_new/src/copy.h 2002-09-18 19:42:55.000000000 +0200 @@ -38,6 +38,8 @@ struct cp_options { enum backup_type backup_type; + int dotted_copy_style; + /* If 1, shows x% copied */ /* If nonzero, copy all files except (directories and, if not dereferencing them, symbolic links,) as if they were regular files. */ diff -Nur file_orig/src/cp.c file_new/src/cp.c --- file_orig/src/cp.c 2001-02-03 17:48:34.000000000 +0100 +++ file_new/src/cp.c 2002-09-18 19:40:24.000000000 +0200 @@ -673,6 +673,7 @@ x->myeuid = geteuid (); x->move_mode = 0; x->one_file_system = 0; + x->dotted_copy_style = 0; x->preserve_owner_and_group = 0; x->preserve_chmod_bits = 0; @@ -719,7 +720,7 @@ we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); - while ((c = getopt_long (argc, argv, "abdfHilLprsuvxPRS:V:", long_opts, NULL)) + while ((c = getopt_long (argc, argv, "abdDfHilLprsuvxPRS:V:", long_opts, NULL)) != -1) { switch (c) @@ -759,6 +760,10 @@ x.dereference = DEREF_NEVER; break; + case 'D': + x.dotted_copy_style = 1; + break; + case 'f': x.unlink_dest_after_failed_open = 1; break; diff -Nur file_orig/src/mv.c file_new/src/mv.c --- file_orig/src/mv.c 2001-02-03 17:48:34.000000000 +0100 +++ file_new/src/mv.c 2002-09-18 19:41:20.000000000 +0200 @@ -122,6 +122,7 @@ x->symbolic_link = 0; x->set_mode = 0; x->mode = 0; + x->dotted_copy_style = 0; /* Find out the current file creation mask, to knock the right bits when using chmod. The creation mask is set to be liberal, so @@ -394,7 +395,7 @@ errors = 0; - while ((c = getopt_long (argc, argv, "bfiuvS:V:", long_options, NULL)) != -1) + while ((c = getopt_long (argc, argv, "bDfiuvS:V:", long_options, NULL)) != -1) { switch (c) { @@ -413,6 +414,9 @@ if (optarg) version_control_string = optarg; break; + case 'D': + x.dotted_copy_style = 1; + break; case 'f': x.interactive = 0; break;