diff options
Diffstat (limited to 'coreutils/md5_sha1_sum.c')
-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 49766a925..6226e0988 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) | |||
81 | return hash_value; | 81 | return hash_value; |
82 | } | 82 | } |
83 | 83 | ||
84 | /* This could become a common function for md5 as well, by using md5_stream */ | 84 | int md5_sha1_sum_main(int argc, char **argv) |
85 | static int hash_files(int argc, char **argv, hash_algo_t hash_algo) | ||
86 | { | 85 | { |
87 | int return_value = EXIT_SUCCESS; | 86 | int return_value = EXIT_SUCCESS; |
88 | uint8_t *hash_value; | 87 | uint8_t *hash_value; |
89 | unsigned int flags; | 88 | unsigned int flags; |
89 | hash_algo_t hash_algo = ENABLE_MD5SUM ? | ||
90 | (ENABLE_SHA1SUM ? | ||
91 | (**argv=='m' ? HASH_MD5 : HASH_SHA1) | ||
92 | : HASH_MD5) | ||
93 | : HASH_SHA1; | ||
90 | 94 | ||
91 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) | 95 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) |
92 | flags = bb_getopt_ulflags(argc, argv, "scw"); | 96 | flags = bb_getopt_ulflags(argc, argv, "scw"); |
@@ -178,17 +182,3 @@ static int hash_files(int argc, char **argv, hash_algo_t hash_algo) | |||
178 | } | 182 | } |
179 | return (return_value); | 183 | return (return_value); |
180 | } | 184 | } |
181 | |||
182 | #ifdef CONFIG_MD5SUM | ||
183 | int md5sum_main(int argc, char **argv) | ||
184 | { | ||
185 | return (hash_files(argc, argv, HASH_MD5)); | ||
186 | } | ||
187 | #endif | ||
188 | |||
189 | #ifdef CONFIG_SHA1SUM | ||
190 | int sha1sum_main(int argc, char **argv) | ||
191 | { | ||
192 | return (hash_files(argc, argv, HASH_SHA1)); | ||
193 | } | ||
194 | #endif | ||