Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/sum.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/coreutils/sum.c

    r3232 r3621  
    2222
    2323#include "libbb.h"
     24#include "common_bufsiz.h"
    2425
    2526enum { SUM_BSD, PRINT_NAME, SUM_SYSV };
     
    3132static unsigned sum_file(const char *file, unsigned type)
    3233{
    33 #define buf bb_common_bufsiz1
    3434    unsigned long long total_bytes = 0;
    3535    int fd, r;
    3636    /* The sum of all the input bytes, modulo (UINT_MAX + 1).  */
    3737    unsigned s = 0;
     38
     39#define buf bb_common_bufsiz1
     40    setup_common_bufsiz();
    3841
    3942    fd = open_or_warn_stdin(file);
     
    4245
    4346    while (1) {
    44         size_t bytes_read = safe_read(fd, buf, BUFSIZ);
     47        size_t bytes_read = safe_read(fd, buf, COMMON_BUFSIZE);
    4548
    4649        if ((ssize_t)bytes_read <= 0) {
     
    7174        r = (s & 0xffff) + ((s & 0xffffffff) >> 16);
    7275        s = (r & 0xffff) + (r >> 16);
    73         printf("%d %llu %s\n", s, (total_bytes + 511) / 512, file);
     76        printf("%u %llu %s\n", s, (total_bytes + 511) / 512, file);
    7477    } else
    75         printf("%05d %5llu %s\n", s, (total_bytes + 1023) / 1024, file);
     78        printf("%05u %5llu %s\n", s, (total_bytes + 1023) / 1024, file);
    7679    return 1;
    7780#undef buf
Note: See TracChangeset for help on using the changeset viewer.