[hackers] [sbase] Simplify sha*sum.c || FRIGN

From: <git_AT_suckless.org>
Date: Tue, 17 Feb 2015 10:11:11 +0100 (CET)

commit 92d8b66fdf0def222afe5ae75b2c4cb58ecb4ba9
Author: FRIGN <dev_AT_frign.de>
Date: Tue Feb 17 10:08:28 2015 +0100

    Simplify sha*sum.c

diff --git a/sha1sum.c b/sha1sum.c
index 2157156..54ea33f 100644
--- a/sha1sum.c
+++ b/sha1sum.c
_AT_@ -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
index 0eb6c22..09ef584 100644
--- a/sha256sum.c
+++ b/sha256sum.c
_AT_@ -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
index 2abff76..0018401 100644
--- a/sha512sum.c
+++ b/sha512sum.c
_AT_@ -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));
 }
Received on Tue Feb 17 2015 - 10:11:11 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 17 2015 - 10:12:09 CET