bin/170278: [request] Add --check option to md5(1)

Alexander Pyhalov apyhalov at gmail.com
Thu Aug 30 21:00:22 UTC 2012


The following reply was made to PR bin/170278; it has been noted by GNATS.

From: Alexander Pyhalov <apyhalov at gmail.com>
To: bug-followup at FreeBSD.org, pepper at reppep.com
Cc:  
Subject: Re: bin/170278: [request] Add --check option to md5(1)
Date: Fri, 31 Aug 2012 00:55:21 +0400

 --047d7b343e38c5d44d04c881e479
 Content-Type: multipart/alternative; boundary=047d7b343e38c5d44804c881e477
 
 --047d7b343e38c5d44804c881e477
 Content-Type: text/plain; charset=ISO-8859-1
 
 Attached patch implements '--check'-like feature from GNU md5sum. However,
 it seems md5sum  allows more comlex file formats.
 
 -- 
 Best regards,
 Alexander Pyhalov
 
 --047d7b343e38c5d44804c881e477
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Attached patch implements &#39;--check&#39;-like feature from GNU md5sum. H=
 owever, it seems md5sum =A0allows more comlex file formats.<br clear=3D"all=
 "><div><br></div>--=A0<div>Best regards,=A0<br>Alexander Pyhalov</div><div>=
 <br>
 </div>
 
 --047d7b343e38c5d44804c881e477--
 --047d7b343e38c5d44d04c881e479
 Content-Type: text/plain; charset=US-ASCII; name="patch.txt"
 Content-Disposition: attachment; filename="patch.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_h6ic1u4w0
 
 LS0tIC91c3Ivc3JjL3NiaW4vbWQ1L21kNS5jCTIwMTItMDYtMDYgMjE6NDI6MTAuOTAxMjA4MTAx
 ICswNDAwCisrKyBtZDUuYwkyMDEyLTA4LTMxIDAwOjQ5OjE5LjQyMzc5OTk5OCArMDQwMApAQCAt
 MjAsMTAgKzIwLDEyIEBACiAjaW5jbHVkZSA8c3lzL2NkZWZzLmg+CiBfX0ZCU0RJRCgiJEZyZWVC
 U0QkIik7CiAKKyNpbmNsdWRlIDxzeXMvcGFyYW0uaD4KICNpbmNsdWRlIDxzeXMvdHlwZXMuaD4K
 ICNpbm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AgICAgICAgICAgICAgICBmYWlsZWQrKzsKKyAgICAgICAgICAgICAgICAgICAgICAg
 ICAgICAgICAgfSBlbHNlIHsKKwkJCQkJaWYgKHFmbGFnKQorICAgICAgICAgICAgICAgICAgICAg
 ICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlcyIsIHApOworICAgICAgICAgICAg
 ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHJmbGFnKQorICAgICAgICAgICAg
 ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlcyAlcyIsIHAsIGN1
 cmZuYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCisg
 ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIiVz
 ICglcykgPSAlcyIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
 ICAgICAgICAgICAgIEFsZ29yaXRobVtkaWdlc3RdLm5hbWUsIGN1cmZuYW1lLCBwKTsKKwkJCQkJ
 aWYgKHN0cmNtcChjaGVja0FnYWluc3RDdXIscCkpIHsKKyAJCSAgICAgICAJICAgICAgICAgICAg
 ICAgICAgIGNoZWNrc0ZhaWxlZCsrOworICAgICAgICAgICAgICAgIAkJICAgICAgICAgICBpZiAo
 IXFmbGFnKQorICAgICAgICAgICAgICAgICAgICAgICAgCQkgICAgICAgcHJpbnRmKCIgWyBGYWls
 ZWQgXSIpOworICAgICAgICAgICAgICAgICAgICAgICAgCQl9CisJCQkJCXB1dGNoYXIoJ1xuJyk7
 CisJCQkJfQorCQkJfSBlbHNlIHsKKwkJCQkoKmZhaWxlZCkrKzsKKwkJCX0KKwkJCWJ6ZXJvKHN0
 cixNQVhfU1RSSU5HX0xFTkdUSCk7CisgICAgICAgICAgICAgICAgfQorCQlmY2xvc2UoZmwpOwor
 CX0gZWxzZSB7CisJCSgqZmFpbGVkKSsrOworCX0KK30KKwogLyoKICAqIERpZ2VzdHMgYSBzdHJp
 bmcgYW5kIHByaW50cyB0aGUgcmVzdWx0LgogICovCg==
 --047d7b343e38c5d44d04c881e479--


More information about the freebsd-bugs mailing list