sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit e77f0b0b9f08d35e7ea245ab721d769f424189de
parent 8e016fad91221f108ef11df65516db98173ec34e
Author: FRIGN <dev@frign.de>
Date:   Tue, 17 Feb 2015 10:08:28 +0100

Simplify sha*sum.c

Diffstat:
Msha1sum.c | 4+---
Msha256sum.c | 4+---
Msha512sum.c | 4+---
3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/sha1sum.c b/sha1sum.c @@ -25,18 +25,16 @@ main(int argc, char *argv[]) { uint8_t md[SHA1_DIGEST_LENGTH]; char *checkfile = NULL; - int cflag = 0; ARGBEGIN { case 'c': - cflag = 1; checkfile = ARGF(); break; default: usage(); } ARGEND; - if (cflag) + if (checkfile) return cryptcheck(checkfile, argc, argv, &sha1_ops, md, sizeof(md)); return cryptmain(argc, argv, &sha1_ops, md, sizeof(md)); } diff --git a/sha256sum.c b/sha256sum.c @@ -25,18 +25,16 @@ main(int argc, char *argv[]) { uint8_t md[SHA256_DIGEST_LENGTH]; char *checkfile = NULL; - int cflag = 0; ARGBEGIN { case 'c': - cflag = 1; checkfile = ARGF(); break; default: usage(); } ARGEND; - if (cflag) + if (checkfile) return cryptcheck(checkfile, argc, argv, &sha256_ops, md, sizeof(md)); return cryptmain(argc, argv, &sha256_ops, md, sizeof(md)); } diff --git a/sha512sum.c b/sha512sum.c @@ -25,18 +25,16 @@ main(int argc, char *argv[]) { uint8_t md[SHA512_DIGEST_LENGTH]; char *checkfile = NULL; - int cflag = 0; ARGBEGIN { case 'c': - cflag = 1; checkfile = ARGF(); break; default: usage(); } ARGEND; - if (cflag) + if (checkfile) return cryptcheck(checkfile, argc, argv, &sha512_ops, md, sizeof(md)); return cryptmain(argc, argv, &sha512_ops, md, sizeof(md)); }