diff options
author | Rob Landley | 2006-08-06 02:13:36 +0000 |
---|---|---|
committer | Rob Landley | 2006-08-06 02:13:36 +0000 |
commit | 236c6755d2532cc20e31f4ff4f19cdaa4bde078c (patch) | |
tree | efd52650829e699be220c3932a7f4360f316482e /coreutils | |
parent | affb7a61a6576194b5c87635ad87d3b3b9e6575b (diff) | |
download | busybox-236c6755d2532cc20e31f4ff4f19cdaa4bde078c.zip busybox-236c6755d2532cc20e31f4ff4f19cdaa4bde078c.tar.gz |
Teach md5sum and sha1sum to work the way other applets do so I don't have to
teach scripts/individual new tricks. And while I'm at it, teach
scripts/individual other new tricks. Now builds 198 applets, some of which
I should teach it to hardlink together because they're really the same app...
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/md5_sha1_sum.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 49766a9..6226e09 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c @@ -81,12 +81,16 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo) return hash_value; } -/* This could become a common function for md5 as well, by using md5_stream */ -static int hash_files(int argc, char **argv, hash_algo_t hash_algo) +int md5_sha1_sum_main(int argc, char **argv) { int return_value = EXIT_SUCCESS; uint8_t *hash_value; unsigned int flags; + hash_algo_t hash_algo = ENABLE_MD5SUM ? + (ENABLE_SHA1SUM ? + (**argv=='m' ? HASH_MD5 : HASH_SHA1) + : HASH_MD5) + : HASH_SHA1; if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) flags = bb_getopt_ulflags(argc, argv, "scw"); @@ -178,17 +182,3 @@ static int hash_files(int argc, char **argv, hash_algo_t hash_algo) } return (return_value); } - -#ifdef CONFIG_MD5SUM -int md5sum_main(int argc, char **argv) -{ - return (hash_files(argc, argv, HASH_MD5)); -} -#endif - -#ifdef CONFIG_SHA1SUM -int sha1sum_main(int argc, char **argv) -{ - return (hash_files(argc, argv, HASH_SHA1)); -} -#endif |