aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-28 00:29:00 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-28 00:29:00 +0000
commitfc9975761320f38189e69a6e63666fa86019c550 (patch)
treeade67c96b46c3cbbd869c4ca4b77b462b4db0d81 /coreutils
parentede88e7a5065cac3e03d4d34c83d0dfa414453b4 (diff)
downloadbusybox-w32-fc9975761320f38189e69a6e63666fa86019c550.tar.gz
busybox-w32-fc9975761320f38189e69a6e63666fa86019c550.tar.bz2
busybox-w32-fc9975761320f38189e69a6e63666fa86019c550.zip
Tried to find sha1_crypt - nope... ok, save few bytes in md5_sha1_sum.c
(time to sleep, 02:28 in the morning)... git-svn-id: svn://busybox.net/trunk/busybox@16244 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/md5_sha1_sum.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 6226e0988..c10fac5d0 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -16,7 +16,7 @@ typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t;
16 16
17/* This might be useful elsewhere */ 17/* This might be useful elsewhere */
18static unsigned char *hash_bin_to_hex(unsigned char *hash_value, 18static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
19 unsigned char hash_length) 19 unsigned char hash_length)
20{ 20{
21 int x, len, max; 21 int x, len, max;
22 unsigned char *hex_value; 22 unsigned char *hex_value;
@@ -86,11 +86,9 @@ int md5_sha1_sum_main(int argc, char **argv)
86 int return_value = EXIT_SUCCESS; 86 int return_value = EXIT_SUCCESS;
87 uint8_t *hash_value; 87 uint8_t *hash_value;
88 unsigned int flags; 88 unsigned int flags;
89 hash_algo_t hash_algo = ENABLE_MD5SUM ? 89 hash_algo_t hash_algo = ENABLE_MD5SUM
90 (ENABLE_SHA1SUM ? 90 ? (ENABLE_SHA1SUM ? (**argv=='m' ? HASH_MD5 : HASH_SHA1) : HASH_MD5)
91 (**argv=='m' ? HASH_MD5 : HASH_SHA1) 91 : HASH_SHA1;
92 : HASH_MD5)
93 : HASH_SHA1;
94 92
95 if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) 93 if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK)
96 flags = bb_getopt_ulflags(argc, argv, "scw"); 94 flags = bb_getopt_ulflags(argc, argv, "scw");
@@ -99,10 +97,10 @@ int md5_sha1_sum_main(int argc, char **argv)
99 if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { 97 if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) {
100 if (flags & FLAG_SILENT) { 98 if (flags & FLAG_SILENT) {
101 bb_error_msg_and_die 99 bb_error_msg_and_die
102 ("the -s option is meaningful only when verifying checksums"); 100 ("-%c is meaningful only when verifying checksums", 's');
103 } else if (flags & FLAG_WARN) { 101 } else if (flags & FLAG_WARN) {
104 bb_error_msg_and_die 102 bb_error_msg_and_die
105 ("the -w option is meaningful only when verifying checksums"); 103 ("-%c is meaningful only when verifying checksums", 'w');
106 } 104 }
107 } 105 }
108 106
@@ -135,7 +133,7 @@ int md5_sha1_sum_main(int argc, char **argv)
135 filename_ptr = strstr(line, " "); 133 filename_ptr = strstr(line, " ");
136 if (filename_ptr == NULL) { 134 if (filename_ptr == NULL) {
137 if (flags & FLAG_WARN) { 135 if (flags & FLAG_WARN) {
138 bb_error_msg("Invalid format"); 136 bb_error_msg("invalid format");
139 } 137 }
140 count_failed++; 138 count_failed++;
141 return_value = EXIT_FAILURE; 139 return_value = EXIT_FAILURE;
@@ -165,7 +163,7 @@ int md5_sha1_sum_main(int argc, char **argv)
165 count_failed, count_total); 163 count_failed, count_total);
166 } 164 }
167 if (bb_fclose_nonstdin(pre_computed_stream) == EOF) { 165 if (bb_fclose_nonstdin(pre_computed_stream) == EOF) {
168 bb_perror_msg_and_die("Couldnt close file %s", file_ptr); 166 bb_perror_msg_and_die("cannot close file %s", file_ptr);
169 } 167 }
170 } else { 168 } else {
171 while (optind < argc) { 169 while (optind < argc) {
@@ -180,5 +178,5 @@ int md5_sha1_sum_main(int argc, char **argv)
180 } 178 }
181 } 179 }
182 } 180 }
183 return (return_value); 181 return return_value;
184} 182}