diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/catv.c | 4 | ||||
-rw-r--r-- | coreutils/cksum.c | 6 | ||||
-rw-r--r-- | coreutils/date.c | 6 | ||||
-rw-r--r-- | coreutils/split.c | 2 | ||||
-rw-r--r-- | coreutils/stat.c | 7 | ||||
-rw-r--r-- | coreutils/sum.c | 4 | ||||
-rw-r--r-- | coreutils/tee.c | 6 |
7 files changed, 20 insertions, 15 deletions
diff --git a/coreutils/catv.c b/coreutils/catv.c index 801d245..0e71368 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c @@ -49,6 +49,9 @@ int catv_main(int argc UNUSED_PARAM, char **argv) /* Read from stdin if there's nothing else to do. */ if (!argv[0]) *--argv = (char*)"-"; + +#define read_buf bb_common_bufsiz1 + setup_common_bufsiz(); do { fd = open_or_warn_stdin(*argv); if (fd < 0) { @@ -58,7 +61,6 @@ int catv_main(int argc UNUSED_PARAM, char **argv) for (;;) { int i, res; -#define read_buf bb_common_bufsiz1 res = read(fd, read_buf, COMMON_BUFSIZE); if (res < 0) retval = EXIT_FAILURE; diff --git a/coreutils/cksum.c b/coreutils/cksum.c index d8351e7..8a8a39f 100644 --- a/coreutils/cksum.c +++ b/coreutils/cksum.c @@ -33,6 +33,7 @@ int cksum_main(int argc UNUSED_PARAM, char **argv) argv++; #endif + setup_common_bufsiz(); do { int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input); @@ -43,9 +44,8 @@ int cksum_main(int argc UNUSED_PARAM, char **argv) crc = 0; length = 0; -#define read_buf bb_common_bufsiz1 -#define sizeof_read_buf COMMON_BUFSIZE - while ((bytes_read = safe_read(fd, read_buf, sizeof_read_buf)) > 0) { +#define read_buf bb_common_bufsiz1 + while ((bytes_read = safe_read(fd, read_buf, COMMON_BUFSIZE)) > 0) { length += bytes_read; crc = crc32_block_endian1(crc, read_buf, bytes_read, crc32_table); } diff --git a/coreutils/date.c b/coreutils/date.c index 59b4b8f..ff3214d 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -368,8 +368,8 @@ int date_main(int argc UNUSED_PARAM, char **argv) } #endif -#define date_buf bb_common_bufsiz1 -#define sizeof_date_buf COMMON_BUFSIZE +#define date_buf bb_common_bufsiz1 + setup_common_bufsiz(); if (*fmt_dt2str == '\0') { /* With no format string, just print a blank line */ date_buf[0] = '\0'; @@ -379,7 +379,7 @@ int date_main(int argc UNUSED_PARAM, char **argv) fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S"; } /* Generate output string */ - strftime(date_buf, sizeof_date_buf, fmt_dt2str, &tm_time); + strftime(date_buf, COMMON_BUFSIZE, fmt_dt2str, &tm_time); } puts(date_buf); diff --git a/coreutils/split.c b/coreutils/split.c index b2da74e..e67c3de 100644 --- a/coreutils/split.c +++ b/coreutils/split.c @@ -79,6 +79,8 @@ int split_main(int argc UNUSED_PARAM, char **argv) ssize_t bytes_read, to_write; char *src; + setup_common_bufsiz(); + opt_complementary = "?2:a+"; /* max 2 args; -a N */ opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &suffix_len); diff --git a/coreutils/stat.c b/coreutils/stat.c index 78df9c9..ddcfcf2 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -158,10 +158,9 @@ static const char *human_time(time_t t) /* coreutils 6.3 compat: */ /*static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")] ALIGN1;*/ -#define buf bb_common_bufsiz1 -#define sizeof_buf COMMON_BUFSIZE - - strcpy(strftime_YYYYMMDDHHMMSS(buf, sizeof_buf, &t), ".000000000"); +#define buf bb_common_bufsiz1 + setup_common_bufsiz(); + strcpy(strftime_YYYYMMDDHHMMSS(buf, COMMON_BUFSIZE, &t), ".000000000"); return buf; #undef buf } diff --git a/coreutils/sum.c b/coreutils/sum.c index cc66772..ec9ed2a 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c @@ -31,12 +31,14 @@ enum { SUM_BSD, PRINT_NAME, SUM_SYSV }; /* Return 1 if successful. */ static unsigned sum_file(const char *file, unsigned type) { -#define buf bb_common_bufsiz1 unsigned long long total_bytes = 0; int fd, r; /* The sum of all the input bytes, modulo (UINT_MAX + 1). */ unsigned s = 0; +#define buf bb_common_bufsiz1 + setup_common_bufsiz(); + fd = open_or_warn_stdin(file); if (fd == -1) return 0; diff --git a/coreutils/tee.c b/coreutils/tee.c index a0e177c..a68e944 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -37,8 +37,8 @@ int tee_main(int argc, char **argv) //TODO: make unconditional #if ENABLE_FEATURE_TEE_USE_BLOCK_IO ssize_t c; -# define buf bb_common_bufsiz1 -# define sizeof_buf COMMON_BUFSIZE +# define buf bb_common_bufsiz1 + setup_common_bufsiz(); #else int c; #endif @@ -81,7 +81,7 @@ int tee_main(int argc, char **argv) /* names[0] will be filled later */ #if ENABLE_FEATURE_TEE_USE_BLOCK_IO - while ((c = safe_read(STDIN_FILENO, buf, sizeof_buf)) > 0) { + while ((c = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE)) > 0) { fp = files; do fwrite(buf, 1, c, *fp); |