aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2009-01-04 22:45:03 -0600
committerRob Landley <rob@landley.net>2009-01-04 22:45:03 -0600
commit2f638c397a916399049ac0adaf32a53f635d31bc (patch)
treeececf4826dd42cf67f6aeedcf30bc67f5faf4a2c
parent328686f925be6cea97f75ceceaa212a31ba16a5c (diff)
downloadtoybox-2f638c397a916399049ac0adaf32a53f635d31bc.tar.gz
Add -F option to cksum.
-rw-r--r--toys/cksum.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/toys/cksum.c b/toys/cksum.c
index a3e53de8..a54738cc 100644
--- a/toys/cksum.c
+++ b/toys/cksum.c
@@ -6,15 +6,18 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/cksum.html
-USE_CKSUM(NEWTOY(cksum, NULL, TOYFLAG_BIN))
+USE_CKSUM(NEWTOY(cksum, "F", TOYFLAG_BIN))
config CKSUM
bool "cksum"
default y
help
- usage: cksum [file...]
+ usage: cksum [-F] [file...]
+
For each file, output crc32 checksum value, length and name of file.
If no files listed, copy from stdin. Filename "-" is a synonym for stdin.
+
+ -F Start with 0xffffffff instead of 0.
*/
#include "toys.h"
@@ -32,7 +35,7 @@ static unsigned cksum(unsigned crc, unsigned char c)
static void do_cksum(int fd, char *name)
{
- unsigned crc = 0;
+ unsigned crc = toys.optflags ? 0xffffffff : 0;
uint64_t llen = 0, llen2;
// CRC the data