]> git.pld-linux.org Git - packages/coreutils.git/commitdiff
- try not to use "du", but this code is very experimental (works on Linux though...
authorshadzik <shadzik@pld-linux.org>
Wed, 27 Jan 2010 13:50:37 +0000 (13:50 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    coreutils-advcopy.patch -> 1.5

coreutils-advcopy.patch

index 2eca7d5d53eebdc6b48781fffd6c2cc4459ea44a..01499e8ad63d0151cc24922df9e77c922f157b2f 100644 (file)
@@ -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 @@ diff -ru coreutils-8.4.orig/src/copy.h coreutils-8.4/src/copy.h
  #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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
    {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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
    -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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
 +    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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
    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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
    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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
    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 @@ diff -ru coreutils-8.4.orig/src/cp.c coreutils-8.4/src/cp.c
                             long_opts, NULL))
           != -1)
      {
-@@ -975,6 +1069,10 @@
+@@ -975,6 +1053,10 @@
            x.unlink_dest_after_failed_open = true;
            break;
  
This page took 0.306769 seconds and 4 git commands to generate.