aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 17:54:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 17:54:47 +0000
commit7039a66b58706457c7423de60556e04545432943 (patch)
treea512daebc3674c819766664c8ea17d41ef7fef02 /coreutils
parent1385899416a4396385ad421ae1f532be7103738a (diff)
downloadbusybox-7039a66b58706457c7423de60556e04545432943.tar.gz
correct largefile support, add comments about it.
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/cat.c7
-rw-r--r--coreutils/catv.c6
-rw-r--r--coreutils/dd.c16
3 files changed, 15 insertions, 14 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index f3baf0a2d..10eb29c4d 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
*
- * Licensed under GPLv2 or later, see file License in this tarball for details.
+ * Licensed under GPLv2, see file License in this tarball for details.
*/
/* BB_AUDIT SUSv3 compliant */
@@ -26,8 +26,9 @@ int cat_main(int argc, char **argv)
}
do {
- if ((f = bb_wfopen_input(*argv)) != NULL) {
- int r = bb_copyfd_eof(fileno(f), STDOUT_FILENO);
+ f = bb_wfopen_input(*argv);
+ if (f) {
+ off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO);
bb_fclose_nonstdin(f);
if (r >= 0) {
continue;
diff --git a/coreutils/catv.c b/coreutils/catv.c
index 55656b4b2..a5a8b43e4 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -15,7 +15,7 @@
int catv_main(int argc, char **argv)
{
int retval = EXIT_SUCCESS, fd;
- unsigned long flags;
+ unsigned flags;
flags = getopt32(argc, argv, "etv");
#define CATV_OPT_e (1<<0)
@@ -51,8 +51,8 @@ int catv_main(int argc, char **argv)
}
if (c < 32) {
if (c == 10) {
- if (flags & CATV_OPT_e)
- putchar('$');
+ if (flags & CATV_OPT_e)
+ putchar('$');
} else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) {
bb_printf("^%c", c+'@');
continue;
diff --git a/coreutils/dd.c b/coreutils/dd.c
index d557ae46d..d60192e7c 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -25,12 +25,12 @@ static const struct suffix_mult dd_suffixes[] = {
{ NULL, 0 }
};
-static FILEOFF_TYPE out_full, out_part, in_full, in_part;
+static off_t out_full, out_part, in_full, in_part;
static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal)
{
- bb_fprintf(stderr, FILEOFF_FMT"+"FILEOFF_FMT" records in\n"
- FILEOFF_FMT"+"FILEOFF_FMT" records out\n",
+ bb_fprintf(stderr, OFF_FMT"+"OFF_FMT" records in\n"
+ OFF_FMT"+"OFF_FMT" records out\n",
in_full, in_part,
out_full, out_part);
}
@@ -44,7 +44,7 @@ int dd_main(int argc, char **argv)
int flags = trunc_flag;
size_t oc = 0, ibs = 512, obs = 512;
ssize_t n;
- FILEOFF_TYPE seek = 0, skip = 0, count = MAX_FILEOFF_TYPE;
+ off_t seek = 0, skip = 0, count = OFF_T_MAX;
int oflag, ifd, ofd;
const char *infile = NULL, *outfile = NULL;
char *ibuf, *obuf;
@@ -108,14 +108,14 @@ int dd_main(int argc, char **argv)
obuf = ibuf;
if (infile != NULL)
- ifd = xopen(infile, O_RDONLY | (O_LARGEFILE * ENABLE_LFS));
+ ifd = xopen(infile, O_RDONLY);
else {
ifd = STDIN_FILENO;
infile = bb_msg_standard_input;
}
if (outfile != NULL) {
- oflag = O_WRONLY | O_CREAT | (O_LARGEFILE * ENABLE_LFS);
+ oflag = O_WRONLY | O_CREAT;
if (!seek && (flags & trunc_flag))
oflag |= O_TRUNC;
@@ -137,7 +137,7 @@ int dd_main(int argc, char **argv)
}
if (skip) {
- if (LSEEK(ifd, skip * ibs, SEEK_CUR) < 0) {
+ if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) {
while (skip-- > 0) {
n = safe_read(ifd, ibuf, ibs);
if (n < 0)
@@ -149,7 +149,7 @@ int dd_main(int argc, char **argv)
}
if (seek) {
- if (LSEEK(ofd, seek * obs, SEEK_CUR) < 0)
+ if (lseek(ofd, seek * obs, SEEK_CUR) < 0)
goto die_outfile;
}