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

From: <git_AT_suckless.org>
Date: Tue, 24 Mar 2015 23:53:53 +0100 (CET)

commit e77f0b0b9f08d35e7ea245ab721d769f424189de
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 Mar 24 2015 - 23:53:53 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:10:28 CET