version 1.15, 1999/11/12 17:10:51 |
version 1.16, 1999/11/17 09:20:17 |
|
|
errno = save_errno; |
errno = save_errno; |
} |
} |
|
|
|
int |
|
foregroundproc() |
|
{ |
|
static pid_t pgrp = -1; |
|
int ctty_pgrp; |
|
|
|
if (pgrp == -1) |
|
pgrp = getpgrp(); |
|
|
|
return((ioctl(STDOUT_FILENO, TIOCGPGRP, &ctty_pgrp) != -1 && |
|
ctty_pgrp == pgrp)); |
|
} |
|
|
void |
void |
progressmeter(int flag) |
progressmeter(int flag) |
{ |
{ |
|
|
lastupdate = start; |
lastupdate = start; |
lastsize = 0; |
lastsize = 0; |
} |
} |
|
if (foregroundproc() == 0) |
|
return; |
|
|
(void)gettimeofday(&now, (struct timezone *)0); |
(void)gettimeofday(&now, (struct timezone *)0); |
cursize = statbytes; |
cursize = statbytes; |
if (totalbytes != 0) { |
if (totalbytes != 0) { |
|
|
if (barlength > 0) { |
if (barlength > 0) { |
i = barlength * ratio / 100; |
i = barlength * ratio / 100; |
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), |
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), |
"|%.*s%*s|", i, |
"|%.*s%*s|", i, |
"*****************************************************************************" |
"*****************************************************************************" |
"*****************************************************************************", |
"*****************************************************************************", |
barlength - i, ""); |
barlength - i, ""); |
} |
} |
|
|
i = 0; |
i = 0; |