Use simpler logic to show progress on Linux

This commit is contained in:
Arun Prakash Jana 2020-01-18 14:13:56 +05:30
parent 5f18a0892c
commit dd02fb6049
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -552,8 +552,8 @@ static const char * const envs[] = {
}; };
#ifdef __linux__ #ifdef __linux__
static char cp[] = "cpg -giRp"; static char cp[] = "cp -iRp";
static char mv[] = "mvg -gi"; static char mv[] = "mv -i";
#else #else
static char cp[] = "cp -iRp"; static char cp[] = "cp -iRp";
static char mv[] = "mv -i"; static char mv[] = "mv -i";
@ -5897,9 +5897,6 @@ int main(int argc, char *argv[])
char *arg = NULL; char *arg = NULL;
char *session = NULL; char *session = NULL;
int opt; int opt;
#ifdef __linux__
bool progress = FALSE;
#endif
while ((opt = getopt(argc, argv, "HSKaAb:cdeEgnop:QrRs:t:vVxh")) != -1) { while ((opt = getopt(argc, argv, "HSKaAb:cdeEgnop:QrRs:t:vVxh")) != -1) {
switch (opt) { switch (opt) {
@ -5964,7 +5961,8 @@ int main(int argc, char *argv[])
break; break;
case 'r': case 'r':
#ifdef __linux__ #ifdef __linux__
progress = TRUE; cp[2] = cp[5] = mv[2] = mv[5] = 'g'; /* cp -iRp -> cpg -giRp */
cp[4] = mv[4] = '-';
#endif #endif
break; break;
case 'R': case 'R':
@ -6136,16 +6134,6 @@ int main(int argc, char *argv[])
if (!set_tmp_path()) if (!set_tmp_path())
return _FAILURE; return _FAILURE;
#ifdef __linux__
if (!progress) {
cp[5] = cp[4];
cp[2] = cp[4] = ' ';
mv[5] = mv[4];
mv[2] = mv[4] = ' ';
}
#endif
/* Ignore/handle certain signals */ /* Ignore/handle certain signals */
struct sigaction act = {.sa_handler = sigint_handler}; struct sigaction act = {.sa_handler = sigint_handler};