* Written by Kayvan Aghaiepour and David MacKenzie
* Taken from coreutils and turned into a busybox applet by Mike Frysinger
*
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//usage:#define sum_trivial_usage
+//usage: "[-rs] [FILE]..."
+//usage:#define sum_full_usage "\n\n"
+//usage: "Checksum and count the blocks in a file\n"
+//usage: "\n -r Use BSD sum algorithm (1K blocks)"
+//usage: "\n -s Use System V sum algorithm (512byte blocks)"
+
#include "libbb.h"
enum { SUM_BSD, PRINT_NAME, SUM_SYSV };
if (type >= SUM_SYSV) {
r = (s & 0xffff) + ((s & 0xffffffff) >> 16);
s = (r & 0xffff) + (r >> 16);
- printf("%d %llu %s\n", s, (total_bytes + 511) / 512, file);
+ printf("%u %llu %s\n", s, (total_bytes + 511) / 512, file);
} else
- printf("%05d %5llu %s\n", s, (total_bytes + 1023) / 1024, file);
+ printf("%05u %5llu %s\n", s, (total_bytes + 1023) / 1024, file);
return 1;
#undef buf
}
n = sum_file("-", type);
} else {
/* Need to print the name if either
- - more than one file given
- - doing sysv */
+ * - more than one file given
+ * - doing sysv */
type += (argv[1] || type == SUM_SYSV);
n = 1;
do {