python/dist/src/Tools/scripts md5sum.py, 1.3, 1.3.8.1
Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv14182 Modified Files: Tag: release23-maint md5sum.py Log Message: backport tim's patch making -rb the default. This will be in 2.3.2 final. Index: md5sum.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/md5sum.py,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -C2 -d -r1.3 -r1.3.8.1 *** md5sum.py 13 May 2003 17:39:26 -0000 1.3 --- md5sum.py 30 Sep 2003 09:32:55 -0000 1.3.8.1 *************** *** 7,16 **** bufsize = 8096 fnfilter = None ! rmode = 'r' usage = """ usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] ! -b : read files in binary mode ! -t : read files in text mode (default) -l : print last pathname component only -s bufsize: read buffer size (default %d) --- 7,16 ---- bufsize = 8096 fnfilter = None ! rmode = 'rb' usage = """ usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] ! -b : read files in binary mode (default) ! -t : read files in text mode (you almost certainly don't want this!) -l : print last pathname component only -s bufsize: read buffer size (default %d) *************** *** 41,45 **** return sts ! def printsum(filename, out = sys.stdout): try: fp = open(filename, rmode) --- 41,45 ---- return sts ! def printsum(filename, out=sys.stdout): try: fp = open(filename, rmode) *************** *** 53,62 **** return sts ! def printsumfp(fp, filename, out = sys.stdout): m = md5.new() try: while 1: data = fp.read(bufsize) ! if not data: break m.update(data) except IOError, msg: --- 53,63 ---- return sts ! def printsumfp(fp, filename, out=sys.stdout): m = md5.new() try: while 1: data = fp.read(bufsize) ! if not data: ! break m.update(data) except IOError, msg: *************** *** 66,70 **** return 0 ! def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize try: --- 67,71 ---- return 0 ! def main(args = sys.argv[1:], out=sys.stdout): global fnfilter, rmode, bufsize try: *************** *** 76,84 **** if o == '-l': fnfilter = os.path.basename ! if o == '-b': rmode = 'rb' ! if o == '-t': rmode = 'r' ! if o == '-s': bufsize = int(a) if not args: --- 77,85 ---- if o == '-l': fnfilter = os.path.basename ! elif o == '-b': rmode = 'rb' ! elif o == '-t': rmode = 'r' ! elif o == '-s': bufsize = int(a) if not args:
! -b : read files in binary mode (default) ! -t : read files in text mode (you almost certainly don't want this!) When is -t useful? Skip
Skip Montanaro wrote
! -b : read files in binary mode (default) ! -t : read files in text mode (you almost certainly don't want this!)
When is -t useful?
Beats me. Unless you've got a hankering to generate useless MD5 sums <wink> Anthony -- Anthony Baxter <anthony@interlink.com.au> It's never too late to have a happy childhood.
participants (3)
-
Anthony Baxter
-
anthonybaxter@users.sourceforge.net
-
Skip Montanaro