correct largefile support, add comments about it.
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user