Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 27329
Collapse All | Expand All

(-)coreutils-gentoo-patches.orig/coreutils-progress-bar.patch (-4 / +5 lines)
Lines 108-114 Link Here
108
 /* Copy a regular file from SRC_PATH to DST_PATH.
108
 /* Copy a regular file from SRC_PATH to DST_PATH.
109
    If the source file contains holes, copies holes and blocks of zeros
109
    If the source file contains holes, copies holes and blocks of zeros
110
    in the source file as holes in the destination file.
110
    in the source file as holes in the destination file.
111
@@ -216,6 +282,16 @@ copy_reg (const char *src_path, const ch
111
@@ -216,6 +282,19 @@ copy_reg (const char *src_path, const ch
112
   off_t n_read_total = 0;
112
   off_t n_read_total = 0;
113
   int last_write_made_hole = 0;
113
   int last_write_made_hole = 0;
114
   int make_holes = (x->sparse_mode == SPARSE_ALWAYS);
114
   int make_holes = (x->sparse_mode == SPARSE_ALWAYS);
Lines 122-127 Link Here
122
+  off_t sample_sum = 0;
122
+  off_t sample_sum = 0;
123
+  int sample_count = 0;
123
+  int sample_count = 0;
124
+  int line_length = 80;
124
+  int line_length = 80;
125
+#ifdef TIOCGWINSZ
126
+  struct winsize ws;
127
+#endif
125
 
128
 
126
   source_desc = open (src_path, O_RDONLY);
129
   source_desc = open (src_path, O_RDONLY);
127
   if (source_desc < 0)
130
   if (source_desc < 0)
Lines 135-141 Link Here
135
   for (;;)
138
   for (;;)
136
     {
139
     {
137
       ssize_t n_read = read (source_desc, buf, buf_size);
140
       ssize_t n_read = read (source_desc, buf, buf_size);
138
@@ -377,6 +456,115 @@ copy_reg (const char *src_path, const ch
141
@@ -377,6 +456,113 @@ copy_reg (const char *src_path, const ch
139
 	    }
142
 	    }
140
 	  last_write_made_hole = 0;
143
 	  last_write_made_hole = 0;
141
 	}
144
 	}
Lines 170-177 Link Here
170
+            }
173
+            }
171
+	  
174
+	  
172
+#ifdef TIOCGWINSZ
175
+#ifdef TIOCGWINSZ
173
+	  struct winsize ws;
174
+	  
175
+	  if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col != 0)
176
+	  if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col != 0)
176
+	    {
177
+	    {
177
+	      line_length = ws.ws_col;
178
+	      line_length = ws.ws_col;

Return to bug 27329