diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-13 06:22:16 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-13 06:22:16 +0100 |
commit | c55cb366fe86b9b203ac7c7b9c3538b30f91a305 (patch) | |
tree | 35f9f35e39eaf1fff699b8aa2da0e7768cf00b79 /src/common.c | |
parent | ...and pave (diff) | |
download | sha3sum-c55cb366fe86b9b203ac7c7b9c3538b30f91a305.tar.gz sha3sum-c55cb366fe86b9b203ac7c7b9c3538b30f91a305.tar.bz2 sha3sum-c55cb366fe86b9b203ac7c7b9c3538b30f91a305.tar.xz |
parse the command line
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/common.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/common.c b/src/common.c index a1afe28..f75657a 100644 --- a/src/common.c +++ b/src/common.c @@ -42,6 +42,11 @@ +static char* restrict hashsum = NULL; +static char* restrict hexsum = NULL; + + + /** * Print the checksum of a file * @@ -62,8 +67,6 @@ int print_checksum(const char* restrict filename, libkeccak_generalised_spec_t* libkeccak_spec_t spec; libkeccak_state_t state; int r, fd; - static char* restrict hashsum = NULL; - static char* restrict hexsum = NULL; size_t length; if (r = libkeccak_degeneralise_spec(gspec, &spec), r) @@ -120,6 +123,9 @@ int print_checksum(const char* restrict filename, libkeccak_generalised_spec_t* return USER_ERROR("unknown error in algorithm parameters"); } + if (squeezes <= 0) + return USER_ERROR("the squeeze count be be positive"); + if (verbose) { fprintf(stderr, "rate: %li\n", gspec->bitrate); @@ -175,9 +181,12 @@ int print_checksum(const char* restrict filename, libkeccak_generalised_spec_t* } } - free(hashsum); - free(hexsum); - return 0; } + +void cleanup(void) +{ + free(hashsum), hashsum = NULL; + free(hexsum), hexsum = NULL; +} |