dd modifications

Eric Thomas <[email protected]>
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
Dear Author,

I'm submitting patches that I made to the dd program and manual page. The 
changes allow the use of the conv=stat keyword, which will cause the program to 
display copy progress based upon the number of blocks read out of the total 
number of blocks that will be read. This is very useful when using dd to copy 
disk images to harddrives. The original fileutils-4.1 package was downloaded on 
January 20, 2003 from rpmfind.net. Please consider the inclusion of these 
changes for future fileutils distributions. Thank you,

Eric Thomas
[email protected]

_______________________________________________
Bug-fileutils mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/bug-fileutils
dd.1.patch (text/plain, 43 B)
83a84,86
> stat
> show copy progress
> .TP
dd.c.patch (text/plain, 1.5 KB)
28a29,30
> #include <sys/stat.h>
> #include <unistd.h>
85a88
> #define C_STAT 010000
150a154,156
> /* Approximate # of blocks to be copied.  For progress bar. */
> static unsigned long blocks = 0;
> 
168a175
>   {"stat", C_STAT},             /* Show copy progress. */
323a331
>   stat      show copy progress\n\
440a449
>   struct stat stats;
442a452
>   
445a456,466
>   /* For the progress indicator */
>   if (options == O_RDONLY)
>   {
>     fstat(fd, &stats);
> 
>     if (stats.st_size == 0 && max_records != -1)
>       blocks = max_records;
>     else if (stats.st_size != 0)
>       blocks = stats.st_size / input_blocksize - skip_records;
>   }
> 
963a985,1011
> 
>       if (conversions_mask & C_STAT)
>       {
>         /* Progress indicator is based upon records read */
>         if (blocks == 0)
>         {
>           if (r_full % 4 == 0)
> 		fprintf(stderr,
> 			_("   | Copying...To see progress specifiy count\r"));
> 	  else if (r_full % 4 == 1)
> 		fprintf(stderr,
> 			_("   / Copying...To see progress specifiy count\r"));
> 	  else if (r_full % 4 == 2)
> 		fprintf(stderr,
> 			_("   - Copying...To see progress specifiy count\r"));
> 	  else if (r_full % 4 == 3)
> 		fprintf(stderr,
> 			_("   \\ Copying...To see progress specifiy count\r"));
> 	  fflush(stderr);
>         }
>         else
>         {
>           fprintf(stderr, _("   %3d%% Complete\r"),
> 	  	      (int)(((double)r_full / blocks) * 100.0));
>           fflush(stderr);
>         }
>       }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.