diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-08 15:41:01 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-08 15:41:01 +0000 |
commit | 97bd0e05ccef27563b4403c24952f0abec8eb6cf (patch) | |
tree | ae7970506abbd5f5fec7eafa77eba9d46e4204cb /coreutils | |
parent | 7dbf1b4d9eb0eca9c98cfdd0d37d6ce3b8f09e0c (diff) | |
download | busybox-w32-97bd0e05ccef27563b4403c24952f0abec8eb6cf.tar.gz busybox-w32-97bd0e05ccef27563b4403c24952f0abec8eb6cf.tar.bz2 busybox-w32-97bd0e05ccef27563b4403c24952f0abec8eb6cf.zip |
README: doccument the need of CONFIG_DESKTOP
od: fix help text to include -t
od: handle /proc files (which have filesize 0) correctly
od: fix comments to not lie about return value
od: "%u" is 1 byte less than "%zu"
cat: fix English
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cat.c | 2 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 22 |
2 files changed, 10 insertions, 14 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c index a1db4cd45..18a74b81d 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -30,7 +30,7 @@ int bb_cat(char **argv) | |||
30 | if (!LONE_DASH(*argv)) | 30 | if (!LONE_DASH(*argv)) |
31 | fd = open_or_warn(*argv, O_RDONLY); | 31 | fd = open_or_warn(*argv, O_RDONLY); |
32 | if (fd >= 0) { | 32 | if (fd >= 0) { |
33 | /* This is not an xfunc - never exits */ | 33 | /* This is not a xfunc - never exits */ |
34 | off_t r = bb_copyfd_eof(fd, STDOUT_FILENO); | 34 | off_t r = bb_copyfd_eof(fd, STDOUT_FILENO); |
35 | if (fd != STDIN_FILENO) | 35 | if (fd != STDIN_FILENO) |
36 | close(fd); | 36 | close(fd); |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index 4fb825ee7..6948bf1e1 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -723,7 +723,7 @@ decode_one_format(const char *s_orig, const char *s, const char **next, | |||
723 | 723 | ||
724 | /* Decode the modern od format string S. Append the decoded | 724 | /* Decode the modern od format string S. Append the decoded |
725 | representation to the global array SPEC, reallocating SPEC if | 725 | representation to the global array SPEC, reallocating SPEC if |
726 | necessary. Return zero if S is valid, nonzero otherwise. */ | 726 | necessary. */ |
727 | 727 | ||
728 | static void | 728 | static void |
729 | decode_format_string(const char *s) | 729 | decode_format_string(const char *s) |
@@ -776,18 +776,18 @@ skip(off_t n_skip) | |||
776 | as large as the size of the current file, we can | 776 | as large as the size of the current file, we can |
777 | decrement n_skip and go on to the next file. */ | 777 | decrement n_skip and go on to the next file. */ |
778 | if (fstat(fileno(in_stream), &file_stats) == 0 | 778 | if (fstat(fileno(in_stream), &file_stats) == 0 |
779 | && S_ISREG(file_stats.st_mode) && file_stats.st_size >= 0 | 779 | && S_ISREG(file_stats.st_mode) && file_stats.st_size > 0 |
780 | ) { | 780 | ) { |
781 | if (file_stats.st_size < n_skip) { | 781 | if (file_stats.st_size < n_skip) { |
782 | n_skip -= file_stats.st_size; | 782 | n_skip -= file_stats.st_size; |
783 | /* take check&close / open_next route */ | 783 | /* take "check & close / open_next" route */ |
784 | } else { | 784 | } else { |
785 | if (fseeko(in_stream, n_skip, SEEK_CUR) != 0) | 785 | if (fseeko(in_stream, n_skip, SEEK_CUR) != 0) |
786 | ioerror = 1; | 786 | ioerror = 1; |
787 | return; | 787 | return; |
788 | } | 788 | } |
789 | } else { | 789 | } else { |
790 | /* If it's not a regular file with nonnegative size, | 790 | /* If it's not a regular file with positive size, |
791 | position the file pointer by reading. */ | 791 | position the file pointer by reading. */ |
792 | char buf[1024]; | 792 | char buf[1024]; |
793 | size_t n_bytes_to_read = 1024; | 793 | size_t n_bytes_to_read = 1024; |
@@ -1000,9 +1000,7 @@ parse_old_offset(const char *s, off_t *offset) | |||
1000 | spec, extend the input block with zero bytes until its length is a | 1000 | spec, extend the input block with zero bytes until its length is a |
1001 | multiple of all format spec sizes. Write the final block. Finally, | 1001 | multiple of all format spec sizes. Write the final block. Finally, |
1002 | write on a line by itself the offset of the byte after the last byte | 1002 | write on a line by itself the offset of the byte after the last byte |
1003 | read. Accumulate return values from calls to read_block and | 1003 | read. */ |
1004 | check_and_close, and if any was nonzero, return nonzero. | ||
1005 | Otherwise, return zero. */ | ||
1006 | 1004 | ||
1007 | static void | 1005 | static void |
1008 | dump(off_t current_offset, off_t end_offset) | 1006 | dump(off_t current_offset, off_t end_offset) |
@@ -1078,8 +1076,7 @@ dump(off_t current_offset, off_t end_offset) | |||
1078 | and INPUT_FILENAME so they correspond to the next file in the list. | 1076 | and INPUT_FILENAME so they correspond to the next file in the list. |
1079 | Then try to read a byte from the newly opened file. Repeat if | 1077 | Then try to read a byte from the newly opened file. Repeat if |
1080 | necessary until EOF is reached for the last file in FILE_LIST, then | 1078 | necessary until EOF is reached for the last file in FILE_LIST, then |
1081 | set *C to EOF and return. Subsequent calls do likewise. The return | 1079 | set *C to EOF and return. Subsequent calls do likewise. */ |
1082 | value is nonzero if any errors occured, zero otherwise. */ | ||
1083 | 1080 | ||
1084 | static void | 1081 | static void |
1085 | read_char(int *c) | 1082 | read_char(int *c) |
@@ -1112,8 +1109,7 @@ read_char(int *c) | |||
1112 | A string constant is a run of at least 'string_min' ASCII | 1109 | A string constant is a run of at least 'string_min' ASCII |
1113 | graphic (or formatting) characters terminated by a null. | 1110 | graphic (or formatting) characters terminated by a null. |
1114 | Based on a function written by Richard Stallman for a | 1111 | Based on a function written by Richard Stallman for a |
1115 | traditional version of od. Return nonzero if an error | 1112 | traditional version of od. */ |
1116 | occurs. Otherwise, return zero. */ | ||
1117 | 1113 | ||
1118 | static void | 1114 | static void |
1119 | dump_strings(off_t address, off_t end_offset) | 1115 | dump_strings(off_t address, off_t end_offset) |
@@ -1412,8 +1408,8 @@ int od_main(int argc, char **argv) | |||
1412 | if (str_w) | 1408 | if (str_w) |
1413 | bytes_per_block = xatou(str_w); | 1409 | bytes_per_block = xatou(str_w); |
1414 | if (!bytes_per_block || bytes_per_block % l_c_m != 0) { | 1410 | if (!bytes_per_block || bytes_per_block % l_c_m != 0) { |
1415 | bb_error_msg("warning: invalid width %zu; using %d instead", | 1411 | bb_error_msg("warning: invalid width %u; using %d instead", |
1416 | bytes_per_block, l_c_m); | 1412 | (unsigned)bytes_per_block, l_c_m); |
1417 | bytes_per_block = l_c_m; | 1413 | bytes_per_block = l_c_m; |
1418 | } | 1414 | } |
1419 | } else { | 1415 | } else { |