packages: coreutils/coreutils-advcopy.patch - try not to use "du", but this...
shadzik
shadzik at pld-linux.org
Wed Jan 27 14:50:42 CET 2010
Author: shadzik Date: Wed Jan 27 13:50:42 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- try not to use "du", but this code is very experimental (works on Linux though), code sent to author already
---- Files affected:
packages/coreutils:
coreutils-advcopy.patch (1.4 -> 1.5)
---- Diffs:
================================================================
Index: packages/coreutils/coreutils-advcopy.patch
diff -u packages/coreutils/coreutils-advcopy.patch:1.4 packages/coreutils/coreutils-advcopy.patch:1.5
--- packages/coreutils/coreutils-advcopy.patch:1.4 Tue Jan 26 15:49:11 2010
+++ packages/coreutils/coreutils-advcopy.patch Wed Jan 27 14:50:37 2010
@@ -1,3 +1,53 @@
+diff -ru coreutils-8.4.orig/man/cp.1 coreutils-8.4/man/cp.1
+--- coreutils-8.4.orig/man/cp.1 2010-01-25 16:03:29.606930239 +0100
++++ coreutils-8.4/man/cp.1 2010-01-27 14:35:07.949133697 +0100
+@@ -1,5 +1,5 @@
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
+-.TH CP "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
++.TH CP "1" "January 2010" "GNU coreutils 8.4" "User Commands"
+ .SH NAME
+ cp \- copy files and directories
+ .SH SYNOPSIS
+@@ -38,6 +38,9 @@
+ opened, remove it and try again (redundant if
+ the \fB\-n\fR option is used)
+ .TP
++\fB\-g\fR, \fB\-\-progress\-bar\fR
++add progress\-bar
++.TP
+ \fB\-i\fR, \fB\-\-interactive\fR
+ prompt before overwrite (overrides a previous \fB\-n\fR
+ option)
+diff -ru coreutils-8.4.orig/man/dir.1 coreutils-8.4/man/dir.1
+--- coreutils-8.4.orig/man/dir.1 2010-01-25 16:03:29.606930239 +0100
++++ coreutils-8.4/man/dir.1 2010-01-27 14:08:56.390385866 +0100
+@@ -1,5 +1,5 @@
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
+-.TH DIR "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
++.TH DIR "1" "January 2010" "GNU coreutils 8.4" "User Commands"
+ .SH NAME
+ dir \- list directory contents
+ .SH SYNOPSIS
+diff -ru coreutils-8.4.orig/man/ls.1 coreutils-8.4/man/ls.1
+--- coreutils-8.4.orig/man/ls.1 2010-01-25 16:03:29.616930463 +0100
++++ coreutils-8.4/man/ls.1 2010-01-27 14:08:56.520388775 +0100
+@@ -1,5 +1,5 @@
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
+-.TH LS "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
++.TH LS "1" "January 2010" "GNU coreutils 8.4" "User Commands"
+ .SH NAME
+ ls \- list directory contents
+ .SH SYNOPSIS
+diff -ru coreutils-8.4.orig/man/vdir.1 coreutils-8.4/man/vdir.1
+--- coreutils-8.4.orig/man/vdir.1 2010-01-25 16:03:29.606930239 +0100
++++ coreutils-8.4/man/vdir.1 2010-01-27 14:08:56.630386834 +0100
+@@ -1,5 +1,5 @@
+ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
+-.TH VDIR "1" "January 2010" "GNU coreutils 8.3.10-a4da4" "User Commands"
++.TH VDIR "1" "January 2010" "GNU coreutils 8.4" "User Commands"
+ .SH NAME
+ vdir \- list directory contents
+ .SH SYNOPSIS
diff -ru coreutils-8.4.orig/src/copy.c coreutils-8.4/src/copy.c
--- coreutils-8.4.orig/src/copy.c 2010-01-25 16:03:29.606930239 +0100
+++ coreutils-8.4/src/copy.c 2010-01-26 15:37:24.544158220 +0100
@@ -256,8 +306,16 @@
#endif
diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
--- coreutils-8.4.orig/src/cp.c 2010-01-25 16:03:29.596930015 +0100
-+++ coreutils-8.4/src/cp.c 2010-01-26 15:42:02.274161757 +0100
-@@ -139,6 +139,7 @@
++++ coreutils-8.4/src/cp.c 2010-01-27 14:35:01.999137610 +0100
+@@ -19,6 +19,7 @@
+ #include <config.h>
+ #include <stdio.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <getopt.h>
+ #include <selinux/selinux.h>
+
+@@ -139,6 +140,7 @@
{"target-directory", required_argument, NULL, 't'},
{"update", no_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'},
@@ -265,7 +323,7 @@
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
-@@ -176,6 +177,7 @@
+@@ -176,6 +178,7 @@
-f, --force if an existing destination file cannot be\n\
opened, remove it and try again (redundant if\n\
the -n option is used)\n\
@@ -273,7 +331,7 @@
-i, --interactive prompt before overwrite (overrides a previous -n\n\
option)\n\
-H follow command-line symbolic links in SOURCE\n\
-@@ -612,6 +614,57 @@
+@@ -612,6 +615,40 @@
quote (file[n_files - 1]));
}
@@ -297,32 +355,15 @@
+ int j;
+ for (j = 0; j < iFiles; j++)
+ {
-+ /* call du -s for each file */
-+ /* create command */
-+ char command[1024];
-+ sprintf ( command, "du -s \"%s\"", file[j] );
-+ /* TODO: replace all quote signs in file[i] */
-+
-+ FILE *fp;
-+ char output[1024];
-+
-+ /* run command */
-+ fp = popen(command, "r");
-+ if (fp == NULL || fgets(output, sizeof(output)-1, fp) == NULL) {
-+ printf("failed to run du.\n" );
-+ }
-+ else
-+ {
-+ /* isolate size */
-+ strchr ( output, '\t' )[0] = '\0';
-+ iTotalSize += atol ( output );
++ struct stat buf;
++ stat(file[j], &buf);
++ long blocks = buf.st_blocks/2;
++
++ iTotalSize += blocks;
+
-+ printf ( "Calculating total size... %d\r", iTotalSize );
++ printf ( "Calculating total size... %ld\r", iTotalSize );
+ fflush ( stdout );
-+ }
+
-+ /* close */
-+ pclose(fp);
+ }
+ g_iTotalSize = iTotalSize;
+ /* END progress mod */
@@ -331,7 +372,7 @@
if (target_directory)
{
/* cp file1...filen edir
-@@ -754,6 +807,46 @@
+@@ -754,6 +791,46 @@
ok = copy (source, new_dest, 0, x, &unused, NULL);
}
@@ -378,7 +419,7 @@
return ok;
}
-@@ -785,6 +878,7 @@
+@@ -785,6 +862,7 @@
x->recursive = false;
x->sparse_mode = SPARSE_AUTO;
x->symbolic_link = false;
@@ -386,7 +427,7 @@
x->set_mode = false;
x->mode = 0;
-@@ -923,7 +1017,7 @@
+@@ -923,7 +1001,7 @@
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
@@ -395,7 +436,7 @@
long_opts, NULL))
!= -1)
{
-@@ -975,6 +1069,10 @@
+@@ -975,6 +1053,10 @@
x.unlink_dest_after_failed_open = true;
break;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/coreutils/coreutils-advcopy.patch?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list