[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch for fileutils
From: |
Timo A. Hummel |
Subject: |
Patch for fileutils |
Date: |
Thu, 09 Aug 2001 17:18:08 +0000 |
Hi,
I made a patch against fileutils-4.1 which allows to display the
progress of copy operations. This is very useful when copying large
files (especially when copying over the network). The patch was added
to cp(1) only, however, it also sits in copy.c's copy_reg so it can be
applied to mv and others also. I don't know if there are other copy
procedures as well, but feel free to add the patch to the other copy
procedures, if any. I also extended the structure cp_options with two
new members, progress and progressbar. Currently, I didn't implement
progressbar yet, but progress is working.
The cp(1) command has been modified and takes a new parameter:
-B, --progress shows a progress display
If -B is specified, verbose is also turned on to display file names as
well. Example:
address@hidden:~/> cp -B test.dat /tmp/test.dat
`test.dat' -> `/tmp/test.dat'
4888576 of 4888576 bytes copied
I didn't print out the filename but rather switched on verbose to avoid
line wrapping with long filenames.
Best regards
Timo
--
Timo A. Hummel, IT Specialist
IS Innovative Software AG Phone: +49 69 505030-302
Feuerbachstraße 26-32 Fax: +49 69 505030-505
60325 Frankfurt a.M. E-Mail:
mailto:address@hidden
GERMANY WWW: http://is.ag
189a190
> struct stat tb;
255a257,263
> if (fstat (source_desc, &tb))
> {
> error (0, errno, _("cannot fstat %s"), quote (src_path));
> return_val = -1;
> goto close_src_and_dst_desc;
> }
>
286a295,300
>
> if (x->progress)
> {
> printf( "\r%d of %d bytes copied", (int)n_read_total,
> (int)tb.st_size);
> }
>
347a362,366
> if (x->progress)
> {
> printf("\n");
> }
>
75a76,83
> /* If nonzero, show how many bytes have already been copied.
> This decreases performance, but it's very useful for large files. */
> int progress;
>
> /* If nonzero, show a progress bar. This *heavily* decreases
> performance and is NOT recommended for normal operation. */
> int progressbar;
>
124a125
> {"progress", no_argument, NULL, 'B'},
158a160
> -B, --progress shows a progress display\n\
687c689
<
---
> x->progress = 0;
722c724
< while ((c = getopt_long (argc, argv, "abdfHilLprsuvxPRS:V:", long_opts,
NULL))
---
> while ((c = getopt_long (argc, argv, "abBdfHilLprsuvxPRS:V:", long_opts,
> NULL))
742a745,749
> break;
>
> case 'B':
> x.progress = 1;
> x.verbose = 1;
smime.p7s
Description: S/MIME Cryptographic Signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Patch for fileutils,
Timo A. Hummel <=