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
This commit is contained in:
Denis Vlasenko 2008-02-08 15:41:01 +00:00
parent 7dbf1b4d9e
commit 97bd0e05cc
4 changed files with 15 additions and 16 deletions

3
README
View File

@ -82,6 +82,9 @@ Downloading the current source code:
is generally a faster way of getting it fixed, and the complete archive of is generally a faster way of getting it fixed, and the complete archive of
what happened is the subversion changelog. what happened is the subversion changelog.
Note: if you want to compile busybox in a busybox environment you must
select ENABLE_DESKTOP.
---------------- ----------------
getting help: getting help:

View File

@ -30,7 +30,7 @@ int bb_cat(char **argv)
if (!LONE_DASH(*argv)) if (!LONE_DASH(*argv))
fd = open_or_warn(*argv, O_RDONLY); fd = open_or_warn(*argv, O_RDONLY);
if (fd >= 0) { if (fd >= 0) {
/* This is not an xfunc - never exits */ /* This is not a xfunc - never exits */
off_t r = bb_copyfd_eof(fd, STDOUT_FILENO); off_t r = bb_copyfd_eof(fd, STDOUT_FILENO);
if (fd != STDIN_FILENO) if (fd != STDIN_FILENO)
close(fd); close(fd);

View File

@ -723,7 +723,7 @@ decode_one_format(const char *s_orig, const char *s, const char **next,
/* Decode the modern od format string S. Append the decoded /* Decode the modern od format string S. Append the decoded
representation to the global array SPEC, reallocating SPEC if representation to the global array SPEC, reallocating SPEC if
necessary. Return zero if S is valid, nonzero otherwise. */ necessary. */
static void static void
decode_format_string(const char *s) decode_format_string(const char *s)
@ -776,18 +776,18 @@ skip(off_t n_skip)
as large as the size of the current file, we can as large as the size of the current file, we can
decrement n_skip and go on to the next file. */ decrement n_skip and go on to the next file. */
if (fstat(fileno(in_stream), &file_stats) == 0 if (fstat(fileno(in_stream), &file_stats) == 0
&& S_ISREG(file_stats.st_mode) && file_stats.st_size >= 0 && S_ISREG(file_stats.st_mode) && file_stats.st_size > 0
) { ) {
if (file_stats.st_size < n_skip) { if (file_stats.st_size < n_skip) {
n_skip -= file_stats.st_size; n_skip -= file_stats.st_size;
/* take check&close / open_next route */ /* take "check & close / open_next" route */
} else { } else {
if (fseeko(in_stream, n_skip, SEEK_CUR) != 0) if (fseeko(in_stream, n_skip, SEEK_CUR) != 0)
ioerror = 1; ioerror = 1;
return; return;
} }
} else { } else {
/* If it's not a regular file with nonnegative size, /* If it's not a regular file with positive size,
position the file pointer by reading. */ position the file pointer by reading. */
char buf[1024]; char buf[1024];
size_t n_bytes_to_read = 1024; size_t n_bytes_to_read = 1024;
@ -1000,9 +1000,7 @@ parse_old_offset(const char *s, off_t *offset)
spec, extend the input block with zero bytes until its length is a spec, extend the input block with zero bytes until its length is a
multiple of all format spec sizes. Write the final block. Finally, multiple of all format spec sizes. Write the final block. Finally,
write on a line by itself the offset of the byte after the last byte write on a line by itself the offset of the byte after the last byte
read. Accumulate return values from calls to read_block and read. */
check_and_close, and if any was nonzero, return nonzero.
Otherwise, return zero. */
static void static void
dump(off_t current_offset, off_t end_offset) dump(off_t current_offset, off_t end_offset)
@ -1078,8 +1076,7 @@ dump(off_t current_offset, off_t end_offset)
and INPUT_FILENAME so they correspond to the next file in the list. and INPUT_FILENAME so they correspond to the next file in the list.
Then try to read a byte from the newly opened file. Repeat if Then try to read a byte from the newly opened file. Repeat if
necessary until EOF is reached for the last file in FILE_LIST, then necessary until EOF is reached for the last file in FILE_LIST, then
set *C to EOF and return. Subsequent calls do likewise. The return set *C to EOF and return. Subsequent calls do likewise. */
value is nonzero if any errors occured, zero otherwise. */
static void static void
read_char(int *c) read_char(int *c)
@ -1112,8 +1109,7 @@ read_char(int *c)
A string constant is a run of at least 'string_min' ASCII A string constant is a run of at least 'string_min' ASCII
graphic (or formatting) characters terminated by a null. graphic (or formatting) characters terminated by a null.
Based on a function written by Richard Stallman for a Based on a function written by Richard Stallman for a
traditional version of od. Return nonzero if an error traditional version of od. */
occurs. Otherwise, return zero. */
static void static void
dump_strings(off_t address, off_t end_offset) dump_strings(off_t address, off_t end_offset)
@ -1412,8 +1408,8 @@ int od_main(int argc, char **argv)
if (str_w) if (str_w)
bytes_per_block = xatou(str_w); bytes_per_block = xatou(str_w);
if (!bytes_per_block || bytes_per_block % l_c_m != 0) { if (!bytes_per_block || bytes_per_block % l_c_m != 0) {
bb_error_msg("warning: invalid width %zu; using %d instead", bb_error_msg("warning: invalid width %u; using %d instead",
bytes_per_block, l_c_m); (unsigned)bytes_per_block, l_c_m);
bytes_per_block = l_c_m; bytes_per_block = l_c_m;
} }
} else { } else {

View File

@ -2654,10 +2654,10 @@ USE_FEATURE_BRCTL_FANCY("\n" \
"Address: 127.0.0.1\n" "Address: 127.0.0.1\n"
#define od_trivial_usage \ #define od_trivial_usage \
"[-aBbcDdeFfHhIiLlOovXx] [FILE]" "[-aBbcDdeFfHhIiLlOovXx] " USE_DESKTOP("[-t TYPE] ") "[FILE]"
#define od_full_usage \ #define od_full_usage \
"Write an unambiguous representation, octal bytes by default, of FILE\n" \ "Write an unambiguous representation, octal bytes by default, of FILE\n" \
"to standard output. With no FILE, or when FILE is -, read standard input." "to standard output. With no FILE or when FILE is -, read standard input."
#define openvt_trivial_usage \ #define openvt_trivial_usage \
"VTNUM COMMAND [ARGS...]" "VTNUM COMMAND [ARGS...]"