Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/coreutils/sum.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/coreutils/sum.c
r3232 r3621 22 22 23 23 #include "libbb.h" 24 #include "common_bufsiz.h" 24 25 25 26 enum { SUM_BSD, PRINT_NAME, SUM_SYSV }; … … 31 32 static unsigned sum_file(const char *file, unsigned type) 32 33 { 33 #define buf bb_common_bufsiz134 34 unsigned long long total_bytes = 0; 35 35 int fd, r; 36 36 /* The sum of all the input bytes, modulo (UINT_MAX + 1). */ 37 37 unsigned s = 0; 38 39 #define buf bb_common_bufsiz1 40 setup_common_bufsiz(); 38 41 39 42 fd = open_or_warn_stdin(file); … … 42 45 43 46 while (1) { 44 size_t bytes_read = safe_read(fd, buf, BUFSIZ);47 size_t bytes_read = safe_read(fd, buf, COMMON_BUFSIZE); 45 48 46 49 if ((ssize_t)bytes_read <= 0) { … … 71 74 r = (s & 0xffff) + ((s & 0xffffffff) >> 16); 72 75 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); 74 77 } else 75 printf("%05 d%5llu %s\n", s, (total_bytes + 1023) / 1024, file);78 printf("%05u %5llu %s\n", s, (total_bytes + 1023) / 1024, file); 76 79 return 1; 77 80 #undef buf
Note:
See TracChangeset
for help on using the changeset viewer.