diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-08 17:54:47 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-10-08 17:54:47 +0000 |
commit | 8923a8c94c288f5dba133a439f35666b5de2aac4 (patch) | |
tree | a512daebc3674c819766664c8ea17d41ef7fef02 /coreutils | |
parent | 87d25a2b8535dc627a02eb539fa3946be2a24647 (diff) | |
download | busybox-w32-8923a8c94c288f5dba133a439f35666b5de2aac4.tar.gz busybox-w32-8923a8c94c288f5dba133a439f35666b5de2aac4.tar.bz2 busybox-w32-8923a8c94c288f5dba133a439f35666b5de2aac4.zip |
correct largefile support, add comments about it.
git-svn-id: svn://busybox.net/trunk/busybox@16343 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cat.c | 7 | ||||
-rw-r--r-- | coreutils/catv.c | 6 | ||||
-rw-r--r-- | coreutils/dd.c | 16 |
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 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> | 5 | * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> |
6 | * | 6 | * |
7 | * Licensed under GPLv2 or later, see file License in this tarball for details. | 7 | * Licensed under GPLv2, see file License in this tarball for details. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
@@ -26,8 +26,9 @@ int cat_main(int argc, char **argv) | |||
26 | } | 26 | } |
27 | 27 | ||
28 | do { | 28 | do { |
29 | if ((f = bb_wfopen_input(*argv)) != NULL) { | 29 | f = bb_wfopen_input(*argv); |
30 | int r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); | 30 | if (f) { |
31 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); | ||
31 | bb_fclose_nonstdin(f); | 32 | bb_fclose_nonstdin(f); |
32 | if (r >= 0) { | 33 | if (r >= 0) { |
33 | continue; | 34 | 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 @@ | |||
15 | int catv_main(int argc, char **argv) | 15 | int catv_main(int argc, char **argv) |
16 | { | 16 | { |
17 | int retval = EXIT_SUCCESS, fd; | 17 | int retval = EXIT_SUCCESS, fd; |
18 | unsigned long flags; | 18 | unsigned flags; |
19 | 19 | ||
20 | flags = getopt32(argc, argv, "etv"); | 20 | flags = getopt32(argc, argv, "etv"); |
21 | #define CATV_OPT_e (1<<0) | 21 | #define CATV_OPT_e (1<<0) |
@@ -51,8 +51,8 @@ int catv_main(int argc, char **argv) | |||
51 | } | 51 | } |
52 | if (c < 32) { | 52 | if (c < 32) { |
53 | if (c == 10) { | 53 | if (c == 10) { |
54 | if (flags & CATV_OPT_e) | 54 | if (flags & CATV_OPT_e) |
55 | putchar('$'); | 55 | putchar('$'); |
56 | } else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) { | 56 | } else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) { |
57 | bb_printf("^%c", c+'@'); | 57 | bb_printf("^%c", c+'@'); |
58 | continue; | 58 | 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[] = { | |||
25 | { NULL, 0 } | 25 | { NULL, 0 } |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static FILEOFF_TYPE out_full, out_part, in_full, in_part; | 28 | static off_t out_full, out_part, in_full, in_part; |
29 | 29 | ||
30 | static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal) | 30 | static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal) |
31 | { | 31 | { |
32 | bb_fprintf(stderr, FILEOFF_FMT"+"FILEOFF_FMT" records in\n" | 32 | bb_fprintf(stderr, OFF_FMT"+"OFF_FMT" records in\n" |
33 | FILEOFF_FMT"+"FILEOFF_FMT" records out\n", | 33 | OFF_FMT"+"OFF_FMT" records out\n", |
34 | in_full, in_part, | 34 | in_full, in_part, |
35 | out_full, out_part); | 35 | out_full, out_part); |
36 | } | 36 | } |
@@ -44,7 +44,7 @@ int dd_main(int argc, char **argv) | |||
44 | int flags = trunc_flag; | 44 | int flags = trunc_flag; |
45 | size_t oc = 0, ibs = 512, obs = 512; | 45 | size_t oc = 0, ibs = 512, obs = 512; |
46 | ssize_t n; | 46 | ssize_t n; |
47 | FILEOFF_TYPE seek = 0, skip = 0, count = MAX_FILEOFF_TYPE; | 47 | off_t seek = 0, skip = 0, count = OFF_T_MAX; |
48 | int oflag, ifd, ofd; | 48 | int oflag, ifd, ofd; |
49 | const char *infile = NULL, *outfile = NULL; | 49 | const char *infile = NULL, *outfile = NULL; |
50 | char *ibuf, *obuf; | 50 | char *ibuf, *obuf; |
@@ -108,14 +108,14 @@ int dd_main(int argc, char **argv) | |||
108 | obuf = ibuf; | 108 | obuf = ibuf; |
109 | 109 | ||
110 | if (infile != NULL) | 110 | if (infile != NULL) |
111 | ifd = xopen(infile, O_RDONLY | (O_LARGEFILE * ENABLE_LFS)); | 111 | ifd = xopen(infile, O_RDONLY); |
112 | else { | 112 | else { |
113 | ifd = STDIN_FILENO; | 113 | ifd = STDIN_FILENO; |
114 | infile = bb_msg_standard_input; | 114 | infile = bb_msg_standard_input; |
115 | } | 115 | } |
116 | 116 | ||
117 | if (outfile != NULL) { | 117 | if (outfile != NULL) { |
118 | oflag = O_WRONLY | O_CREAT | (O_LARGEFILE * ENABLE_LFS); | 118 | oflag = O_WRONLY | O_CREAT; |
119 | 119 | ||
120 | if (!seek && (flags & trunc_flag)) | 120 | if (!seek && (flags & trunc_flag)) |
121 | oflag |= O_TRUNC; | 121 | oflag |= O_TRUNC; |
@@ -137,7 +137,7 @@ int dd_main(int argc, char **argv) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | if (skip) { | 139 | if (skip) { |
140 | if (LSEEK(ifd, skip * ibs, SEEK_CUR) < 0) { | 140 | if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) { |
141 | while (skip-- > 0) { | 141 | while (skip-- > 0) { |
142 | n = safe_read(ifd, ibuf, ibs); | 142 | n = safe_read(ifd, ibuf, ibs); |
143 | if (n < 0) | 143 | if (n < 0) |
@@ -149,7 +149,7 @@ int dd_main(int argc, char **argv) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | if (seek) { | 151 | if (seek) { |
152 | if (LSEEK(ofd, seek * obs, SEEK_CUR) < 0) | 152 | if (lseek(ofd, seek * obs, SEEK_CUR) < 0) |
153 | goto die_outfile; | 153 | goto die_outfile; |
154 | } | 154 | } |
155 | 155 | ||