diff options
author | Guenter Knauf <lists@gknw.net> | 2009-10-03 23:24:26 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-10-07 09:31:27 +0200 |
commit | b95be30e3fc4831391355f89a959d0c503bed5fb (patch) | |
tree | 1356f05b3c6cc1de7d19a55902e07f6034917a36 /src | |
parent | d183a15cbb26691e0a05bab06ab700ec46fcfba4 (diff) | |
download | coreutils-b95be30e3fc4831391355f89a959d0c503bed5fb.tar.xz |
md5sum, sha*sum: also accept openssl checksum syntax
* src/md5sum.c (split_3): Accept openssl checksum syntax, which
differs only by two spaces from that of the bsd checksum tools:
openssl: MD5(f)= d41d8cd98f00b204e9800998ecf8427e
bsd: MD5 (f) = d41d8cd98f00b204e9800998ecf8427e
Diffstat (limited to 'src')
-rw-r--r-- | src/md5sum.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/md5sum.c b/src/md5sum.c index e004c5e91..aa2a144a7 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -251,11 +251,10 @@ static bool split_3 (char *s, size_t s_len, unsigned char **hex_digest, int *binary, char **file_name) { - size_t i; bool escaped_filename = false; size_t algo_name_len; - i = 0; + size_t i = 0; while (ISWHITE (s[i])) ++i; @@ -263,11 +262,13 @@ split_3 (char *s, size_t s_len, algo_name_len = strlen (DIGEST_TYPE_STRING); if (strncmp (s + i, DIGEST_TYPE_STRING, algo_name_len) == 0) { - if (strncmp (s + i + algo_name_len, " (", 2) == 0) + if (s[i + algo_name_len] == ' ') + ++i; + if (s[i + algo_name_len] == '(') { *binary = 0; - return bsd_split_3 (s + i + algo_name_len + 2, - s_len - (i + algo_name_len + 2), + return bsd_split_3 (s + i + algo_name_len + 1, + s_len - (i + algo_name_len + 1), hex_digest, file_name); } } |