fix whitespace

This commit is contained in:
Michael Wehr
2021-12-22 13:48:56 +01:00
parent 9d614d1883
commit d337f35f5b

View File

@@ -1,41 +1,41 @@
diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
--- coreutils-9.0/src/copy.c 2021-09-24 07:31:05.000000000 -0400
+++ coreutils-9.0-patched/src/copy.c 2021-10-27 21:33:32.299248300 -0400
--- coreutils-9.0/src/copy.c 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/copy.c 2021-12-22 13:44:23.687642989 +0100
@@ -129,6 +129,70 @@
dev_t dev;
};
+struct progress_status {
+ int iCountDown;
+ char ** cProgressField;
+ struct timeval last_time;
+ int last_size, iBarLength;
+ struct stat src_open_sb;
+};
+struct progress_status {
+ int iCountDown;
+ char ** cProgressField;
+ struct timeval last_time;
+ int last_size, iBarLength;
+ struct stat src_open_sb;
+};
+
+/* Begin progress Mod*/
+static void file_progress_bar ( char * _cDest, int _iBarLength, long _lProgress, long _lTotal )
+{
+ double dPercent = (double) _lProgress / (double) _lTotal * 100.f;
+/* Begin progress Mod*/
+static void file_progress_bar ( char * _cDest, int _iBarLength, long _lProgress, long _lTotal )
+{
+ double dPercent = (double) _lProgress / (double) _lTotal * 100.f;
+ sprintf( _cDest + ( _iBarLength - 6), "%4.1f", dPercent );
+ _cDest[_iBarLength - 2] = ' ';
+ _cDest[_iBarLength - 2] = ' ';
+
+ int i;
+ for ( i=1; i<=_iBarLength - 9; i++)
+ {
+ int i;
+ for ( i=1; i<=_iBarLength - 9; i++)
+ {
+ if ( dPercent > (double) (i-1) / (_iBarLength - 10) * 100.f )
+ {
+ _cDest[i] = '=';
+ _cDest[i] = '=';
+ }
+ else
+ else
+ {
+ _cDest[i] = ' ';
+ _cDest[i] = ' ';
+ }
+ }
+ for ( i=1; i<_iBarLength - 9; i++)
+ {
+ for ( i=1; i<_iBarLength - 9; i++)
+ {
+ if ( ( _cDest[i+1] == ' ' ) && ( _cDest[i] == '=' ) )
+ _cDest[i] = '>' ;
+ _cDest[i] = '>' ;
+ }
+}
+
@@ -95,7 +95,7 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
+ /* BEGIN progress mod */
+ /* update countdown */
+ s_progress->iCountDown--;
+ char * sProgressBar = s_progress->cProgressField[5];
+ char * sProgressBar = s_progress->cProgressField[5];
+ if ( s_progress->iCountDown < 0 )
+ s_progress->iCountDown = 100;
+
@@ -153,7 +153,7 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
+ s_progress->cProgressField[4][s_progress->iBarLength - 21 + fs_len] = ' ';
+
+ /* print the field */
+ int it;
+ int it;
+ for ( it = g_iTotalFiles>1 ? 0 : 3; it < 6; it++ )
+ {
+ printf ( "\033[K%s\n", s_progress->cProgressField[it] );
@@ -332,14 +332,14 @@ diff -aur coreutils-9.0/src/copy.c coreutils-9.0-patched/src/copy.c
if (x->preserve_timestamps)
diff -aur coreutils-9.0/src/copy.h coreutils-9.0-patched/src/copy.h
--- coreutils-9.0/src/copy.h 2021-09-24 07:31:05.000000000 -0400
+++ coreutils-9.0-patched/src/copy.h 2021-10-27 21:33:32.299248300 -0400
--- coreutils-9.0/src/copy.h 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/copy.h 2021-12-22 13:37:29.730204394 +0100
@@ -236,6 +236,9 @@
Create destination directories as usual. */
bool symbolic_link;
+ /* If true, draw a nice progress bar on screen */
+ bool progress_bar;
+ /* If true, draw a nice progress bar on screen */
+ bool progress_bar;
+
/* If true, do not copy a nondirectory that has an existing destination
with the same or newer modification time. */
@@ -357,12 +357,12 @@ diff -aur coreutils-9.0/src/copy.h coreutils-9.0-patched/src/copy.h
+__attribute__((__common__)) struct timeval g_oStartTime;
+__attribute__((__common__)) int g_iTotalFiles;
+__attribute__((__common__)) bool progress;
+/* END OF PROGRESS MOD */
+/* END OF PROGRESS MOD */
+
#endif
diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c
--- coreutils-9.0/src/cp.c 2021-09-24 07:31:05.000000000 -0400
+++ coreutils-9.0-patched/src/cp.c 2021-10-27 21:22:08.913768100 -0400
--- coreutils-9.0/src/cp.c 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/cp.c 2021-12-22 13:38:59.519244777 +0100
@@ -131,6 +131,7 @@
{"symbolic-link", no_argument, NULL, 's'},
{"target-directory", required_argument, NULL, 't'},
@@ -405,16 +405,16 @@ diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c
+ iFiles = n_files - 1;
+ int j;
+
+ /* how many files are we copying */
+ char command[1024];
+ sprintf( command, "find \"%s\" -type f | wc -l", file[0]);
+ FILE *fp ;
+ char output[1024];
+ /* how many files are we copying */
+ char command[1024];
+ sprintf( command, "find \"%s\" -type f | wc -l", file[0]);
+ FILE *fp ;
+ char output[1024];
+ fp = popen(command,"r");
+ if ( fp == NULL || fgets(output, sizeof(output)-1, fp) == NULL)
+ printf("failed to run find.\n");
+ else
+ g_iTotalFiles = atoi( output ) ;
+ printf("failed to run find.\n");
+ else
+ g_iTotalFiles = atoi( output );
+
+ for (j = 0; j < iFiles; j++)
+ {
@@ -520,9 +520,9 @@ diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c
x.unlink_dest_after_failed_open = true;
break;
+ case 'g':
+ progress = true;
+ break;
+ case 'g':
+ progress = true;
+ break;
+
case 'H':
x.dereference = DEREF_COMMAND_LINE_ARGUMENTS;
@@ -538,8 +538,8 @@ diff -aur coreutils-9.0/src/cp.c coreutils-9.0-patched/src/cp.c
? xget_version (_("backup type"),
version_control_string)
diff -aur coreutils-9.0/src/mv.c coreutils-9.0-patched/src/mv.c
--- coreutils-9.0/src/mv.c 2021-09-24 07:31:05.000000000 -0400
+++ coreutils-9.0-patched/src/mv.c 2021-10-27 21:33:32.299248300 -0400
--- coreutils-9.0/src/mv.c 2021-09-24 13:31:05.000000000 +0200
+++ coreutils-9.0-patched/src/mv.c 2021-12-22 13:37:58.306524898 +0100
@@ -66,6 +66,7 @@
{"target-directory", required_argument, NULL, 't'},
{"update", no_argument, NULL, 'u'},
@@ -656,8 +656,8 @@ diff -aur coreutils-9.0/src/mv.c coreutils-9.0-patched/src/mv.c
case 'v':
x.verbose = true;
break;
+ case 'g':
+ progress = true;
+ case 'g':
+ progress = true;
+ break;
case 'S':
make_backups = true;