|
@@ -1,15 +1,16 @@
|
|
|
-Index: src/main/file.c
|
|
|
|
|
---- src/main/file.c.orig 2007-02-05 01:06:47 +0100
|
|
|
|
|
-+++ src/main/file.c 2007-02-05 08:53:41 +0100
|
|
|
|
|
-@@ -27,20 +27,20 @@
|
|
|
|
|
|
|
+Index: src/pv/file.c
|
|
|
|
|
+--- src/pv/file.c.orig 2007-08-04 22:37:30 +0200
|
|
|
|
|
++++ src/pv/file.c 2007-08-05 08:03:14 +0200
|
|
|
|
|
+@@ -30,27 +30,27 @@
|
|
|
*/
|
|
*/
|
|
|
- void main_getsize(opts_t opts)
|
|
|
|
|
|
|
+ void pv_calc_total_size(opts_t opts)
|
|
|
{
|
|
{
|
|
|
- struct stat64 sb;
|
|
- struct stat64 sb;
|
|
|
+ struct stat sb;
|
|
+ struct stat sb;
|
|
|
- int i, fd;
|
|
|
|
|
|
|
+ int rc, i, j, fd;
|
|
|
|
|
|
|
|
opts->size = 0;
|
|
opts->size = 0;
|
|
|
|
|
+ rc = 0;
|
|
|
|
|
|
|
|
if (opts->argc < 1) {
|
|
if (opts->argc < 1) {
|
|
|
- if (fstat64(STDIN_FILENO, &sb) == 0)
|
|
- if (fstat64(STDIN_FILENO, &sb) == 0)
|
|
@@ -20,34 +21,37 @@ Index: src/main/file.c
|
|
|
|
|
|
|
|
for (i = 0; i < opts->argc; i++) {
|
|
for (i = 0; i < opts->argc; i++) {
|
|
|
if (strcmp(opts->argv[i], "-") == 0) {
|
|
if (strcmp(opts->argv[i], "-") == 0) {
|
|
|
-- if (fstat64(STDIN_FILENO, &sb) == 0) {
|
|
|
|
|
-+ if (fstat(STDIN_FILENO, &sb) == 0) {
|
|
|
|
|
- opts->size = sb.st_size;
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+- rc = fstat64(STDIN_FILENO, &sb);
|
|
|
|
|
++ rc = fstat(STDIN_FILENO, &sb);
|
|
|
|
|
+ if (rc != 0) {
|
|
|
opts->size = 0;
|
|
opts->size = 0;
|
|
|
-@@ -48,16 +48,16 @@
|
|
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+- rc = stat64(opts->argv[i], &sb);
|
|
|
|
|
++ rc = stat(opts->argv[i], &sb);
|
|
|
|
|
+ if (rc == 0)
|
|
|
|
|
+ rc = access(opts->argv[i], R_OK);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-- if (stat64(opts->argv[i], &sb) == 0) {
|
|
|
|
|
-+ if (stat(opts->argv[i], &sb) == 0) {
|
|
|
|
|
- if (S_ISBLK(sb.st_mode)) {
|
|
|
|
|
- /*
|
|
|
|
|
- * Get the size of block devices by opening
|
|
|
|
|
- * them and seeking to the end.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+@@ -72,12 +72,12 @@
|
|
|
|
|
+ * them and seeking to the end.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (strcmp(opts->argv[i], "-") == 0) {
|
|
|
|
|
+- fd = open64("/dev/stdin", O_RDONLY);
|
|
|
|
|
++ fd = open("/dev/stdin", O_RDONLY);
|
|
|
|
|
+ } else {
|
|
|
- fd = open64(opts->argv[i], O_RDONLY);
|
|
- fd = open64(opts->argv[i], O_RDONLY);
|
|
|
+ fd = open(opts->argv[i], O_RDONLY);
|
|
+ fd = open(opts->argv[i], O_RDONLY);
|
|
|
- if (fd >= 0) {
|
|
|
|
|
- opts->size +=
|
|
|
|
|
-- lseek64(fd, 0, SEEK_END);
|
|
|
|
|
-+ lseek(fd, 0, SEEK_END);
|
|
|
|
|
- close(fd);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
-@@ -76,8 +76,8 @@
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fd >= 0) {
|
|
|
|
|
+- opts->size += lseek64(fd, 0, SEEK_END);
|
|
|
|
|
++ opts->size += lseek(fd, 0, SEEK_END);
|
|
|
|
|
+ close(fd);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+@@ -95,8 +95,8 @@
|
|
|
*/
|
|
*/
|
|
|
- int main_nextfd(opts_t opts, int filenum, int oldfd)
|
|
|
|
|
|
|
+ int pv_next_file(opts_t opts, int filenum, int oldfd)
|
|
|
{
|
|
{
|
|
|
- struct stat64 isb;
|
|
- struct stat64 isb;
|
|
|
- struct stat64 osb;
|
|
- struct stat64 osb;
|
|
@@ -56,7 +60,7 @@ Index: src/main/file.c
|
|
|
int fd;
|
|
int fd;
|
|
|
|
|
|
|
|
if (oldfd > 0) {
|
|
if (oldfd > 0) {
|
|
|
-@@ -99,7 +99,7 @@
|
|
|
|
|
|
|
+@@ -118,7 +118,7 @@
|
|
|
if (strcmp(opts->argv[filenum], "-") == 0) {
|
|
if (strcmp(opts->argv[filenum], "-") == 0) {
|
|
|
fd = STDIN_FILENO;
|
|
fd = STDIN_FILENO;
|
|
|
} else {
|
|
} else {
|
|
@@ -65,7 +69,7 @@ Index: src/main/file.c
|
|
|
if (fd < 0) {
|
|
if (fd < 0) {
|
|
|
fprintf(stderr, "%s: %s: %s: %s\n",
|
|
fprintf(stderr, "%s: %s: %s: %s\n",
|
|
|
opts->program_name,
|
|
opts->program_name,
|
|
|
-@@ -109,7 +109,7 @@
|
|
|
|
|
|
|
+@@ -128,7 +128,7 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -74,7 +78,7 @@ Index: src/main/file.c
|
|
|
fprintf(stderr, "%s: %s: %s: %s\n",
|
|
fprintf(stderr, "%s: %s: %s: %s\n",
|
|
|
opts->program_name,
|
|
opts->program_name,
|
|
|
_("failed to stat file"),
|
|
_("failed to stat file"),
|
|
|
-@@ -118,7 +118,7 @@
|
|
|
|
|
|
|
+@@ -137,7 +137,7 @@
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -83,10 +87,10 @@ Index: src/main/file.c
|
|
|
fprintf(stderr, "%s: %s: %s\n",
|
|
fprintf(stderr, "%s: %s: %s\n",
|
|
|
opts->program_name,
|
|
opts->program_name,
|
|
|
_("failed to stat output file"), strerror(errno));
|
|
_("failed to stat output file"), strerror(errno));
|
|
|
-Index: src/main/main.c
|
|
|
|
|
---- src/main/main.c.orig 2007-02-05 01:06:47 +0100
|
|
|
|
|
-+++ src/main/main.c 2007-02-05 08:54:34 +0100
|
|
|
|
|
-@@ -68,7 +68,7 @@
|
|
|
|
|
|
|
+Index: src/pv/loop.c
|
|
|
|
|
+--- src/pv/loop.c.orig 2007-08-04 22:37:30 +0200
|
|
|
|
|
++++ src/pv/loop.c 2007-08-05 08:04:05 +0200
|
|
|
|
|
+@@ -37,7 +37,7 @@
|
|
|
struct timeval start_time, next_update, next_reset, cur_time;
|
|
struct timeval start_time, next_update, next_reset, cur_time;
|
|
|
struct timeval init_time;
|
|
struct timeval init_time;
|
|
|
long double elapsed, tilreset;
|
|
long double elapsed, tilreset;
|
|
@@ -95,12 +99,12 @@ Index: src/main/main.c
|
|
|
int fd, n;
|
|
int fd, n;
|
|
|
|
|
|
|
|
fd = -1;
|
|
fd = -1;
|
|
|
-@@ -105,7 +105,7 @@
|
|
|
|
|
- fd = main_nextfd(opts, n, -1);
|
|
|
|
|
- if (fd < 0)
|
|
|
|
|
- return 1;
|
|
|
|
|
-- if (fstat64(fd, &sb) == 0) {
|
|
|
|
|
-+ if (fstat(fd, &sb) == 0) {
|
|
|
|
|
- main_transfer_bufsize(sb.st_blksize * 32, 0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+@@ -73,7 +73,7 @@
|
|
|
|
|
+ return 1;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+- if (fstat64(fd, &sb) == 0) {
|
|
|
|
|
++ if (fstat(fd, &sb) == 0) {
|
|
|
|
|
+ pv_set_buffer_size(sb.st_blksize * 32, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|