Feature request - diffs/patches supplied
Stephen Welker <[email protected]> Sun, 12 Nov 2006 14:52:49 +1100
| Newsgroups | gmane.comp.web.sitecopy |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-7-312775669
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
Hello,
I have made changes to sitecopy 0.16.3, diffs/patches are attached.
The main purpose of the patches are to provide an option to turn off
the progress bar made of dots and print a transfer size in bytes
instead.
The main motivation of these patches is to provide transfer sizes
when used in cron jobs.
Two files have been patched: src/console_fe.c & doc/sitecopy.1
The patches are in the public domain. If they are included in a
future version of sitecopy, I would like to have an attribution in
the THANKS file.
Please do not hesitate to contact me, if you require a different diff
format.
--
regards,
Stephen Welker,
Nemostar Pty Ltd.
http://www.nemostar.com.au/
--Apple-Mail-7-312775669
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream; x-unix-mode=0644; name=console_fe.patch
Content-Disposition: attachment;
filename=console_fe.patch
--- src/console_fe.c.orig 2006-11-05 16:43:11.000000000 +1100
+++ src/console_fe.c 2006-11-06 09:26:09.000000000 +1100
@@ -150,6 +150,7 @@
static int allsites, /* Do they want all sites to be operated on? */
listflat, /* Do they want the 'flat' list style */
show_progress, /* Do they want the %-complete messages */
+ show_file_size, /* do they want a file size instead of progress bar (dots) */
prompting, /* Did they say --prompting? */
keepgoing, /* Did they say --keep-going? */
dry_run; /* Did they say --dry-run? */
@@ -383,7 +384,7 @@
#ifdef NE_DEBUGGING
"d:g:"
#endif
- "acefhiklonp:qr:suvVyZ"; /* available: bgjmntwx */
+ "acefhikloOnp:qr:suvVyZ"; /* available: bgjmntwx */
const static struct option longopts[] = {
/* Operation modes */
{ "update", no_argument, NULL, 'u' },
@@ -396,6 +397,7 @@
{ "keep-going", no_argument, NULL, 'k' },
{ "dry-run", no_argument, NULL, 'n' },
{ "show-progress", no_argument, NULL, 'o' },
+ { "show-file-size", no_argument, NULL, 'O' },
/* { "force-overwrite", no_argument, NULL, 't' }, */
{ "help", no_argument, NULL, 'h' },
{ "catchup", no_argument, NULL, 'c' },
@@ -424,6 +426,7 @@
/* Defaults */
allsites = prompting = false;
show_progress = false;
+ show_file_size = false;
action = action_none;
progname = base_name(argv[0]);
@@ -519,6 +522,9 @@
case 'o':
show_progress = true;
break;
+ case 'O':
+ show_file_size = true;
+ break;
case 'V':
version();
puts(ne_version_string());
@@ -720,7 +726,10 @@
switch (quiet) {
case 0:
in_transfer = 0;
- printf(_("Checksumming %s: ["), filename);
+ printf(_("Checksumming %s: "), filename);
+ if (show_file_size == 0) {
+ printf("[");
+ }
fflush(stdout);
break;
case 1:
@@ -734,10 +743,13 @@
{
switch (quiet) {
case 0:
+ if (show_file_size == 0) {
+ printf("] ");
+ }
if (success) {
- printf(_("] done.\n"));
+ printf(_("done.\n"));
} else {
- printf(_("] failed:\n%s\n"), err);
+ printf(_("failed:\n%s\n"), err);
}
default:
break;
@@ -787,7 +799,13 @@
switch (file->diff) {
case file_changed:
case file_new:
- printf(_("Uploading %s: ["), file_name(file));
+ printf(_("Uploading %s: "), file_name(file));
+ if (show_file_size) {
+ printf(_("%" NE_FMT_OFF_T " bytes "), file->local.size);
+ }
+ else {
+ printf("[");
+ }
break;
case file_deleted:
printf(_("Deleting %s: "), file_name(file));
@@ -840,16 +858,19 @@
printf(_("failed:%c%s\n"), wrap, error);
}
} else {
+ if (show_file_size == 0) {
+ printf("] ");
+ }
if (success) {
if (show_progress) {
float prog = (100 * (float)upload_sofar) / (float)upload_total;
if (upload_total == 0) prog = 0;
- printf(("] done. (%.0f%% finished)\n"), prog);
+ printf(("done. (%.0f%% finished)\n"), prog);
} else {
- printf(_("] done.\n"));
+ printf(_("done.\n"));
}
} else {
- printf(_("] failed:%c%s\n"), wrap, error);
+ printf(_("failed:%c%s\n"), wrap, error);
}
}
}
@@ -874,7 +895,13 @@
switch (file->diff) {
case file_changed:
case file_deleted:
- printf(_("Downloading %s: ["), file_name(file));
+ printf(_("Downloading %s: "), file_name(file));
+ if (show_file_size) {
+ printf(_("%" NE_FMT_OFF_T " bytes "), file->local.size);
+ }
+ else {
+ printf("[");
+ }
break;
case file_new:
printf(_("Deleting %s: "), file_name(file));
@@ -906,10 +933,13 @@
printf(_("failed:\n%s\n"), error);
}
} else {
+ if (show_file_size == 0) {
+ printf("] ");
+ }
if (success) {
- printf(_("] done.\n"));
+ printf(_("done.\n"));
} else {
- printf(_("] failed:\n%s\n"), error);
+ printf(_("failed:\n%s\n"), error);
}
}
}
@@ -936,8 +966,10 @@
void fe_transfer_progress(off_t num, off_t total)
{
if (quiet == 0) {
- putchar('.');
- fflush(stdout);
+ if (show_file_size == 0) {
+ putchar('.');
+ fflush(stdout);
+ }
in_transfer = 1;
}
}
@@ -1353,6 +1385,7 @@
" -a, --allsites Perform the operation on ALL defined sites\n"
" -k, --keep-going Carry on an update regardless of errors\n"
" -o, --show-progress Display total percentage file transfer complete\n"
+" -O, --show-file-size Display file size instead of progress bar\n"
" -q, --quiet Be quiet while performing the operation\n"
" -qq, --silent Be silent while perforing the operation\n"
" -n, --dry-run Display but do not carry out the operation\n"
--Apple-Mail-7-312775669
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--Apple-Mail-7-312775669
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream; x-unix-mode=0644; name=sitecopy.1.patch
Content-Disposition: attachment;
filename=sitecopy.1.patch
--- doc/sitecopy.1.orig 2006-11-05 17:49:59.000000000 +1100
+++ doc/sitecopy.1 2006-11-12 13:34:14.000000000 +1100
@@ -194,6 +194,14 @@
Applicable in
.B Update Mode
only, displays the progress (percentage complete) of data transfer.
+.IP "-O, --show-file-size"
+Applicable in
+.B Update Mode
+or
+.B Synch Mode
+or during
+.B checksumming
+only, displays the size of data transfer instead of a progress bar.
.IP "-k, --keep-going"
Keep going past errors in
.B Update Mode
--Apple-Mail-7-312775669
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--Apple-Mail-7-312775669
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
sitecopy maillist - [email protected]
http://dav.lyra.org/mailman/listinfo/sitecopy
--Apple-Mail-7-312775669--