# HG changeset patch # User Rob Landley # Date 1231130703 21600 # Node ID 0c816f5abe22e87a316f3c8cd3353f3b8df24973 # Parent 556c10abdff62fdc5b4f94a02cd4ce689151ab6b Add -F option to cksum. diff -r 556c10abdff6 -r 0c816f5abe22 toys/cksum.c --- a/toys/cksum.c Sun Jan 04 13:27:36 2009 -0600 +++ b/toys/cksum.c Sun Jan 04 22:45:03 2009 -0600 @@ -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 void do_cksum(int fd, char *name) { - unsigned crc = 0; + unsigned crc = toys.optflags ? 0xffffffff : 0; uint64_t llen = 0, llen2; // CRC the data