X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=bin%2Fcmp.py;h=800e119ab5627f8dd6423cb6cf61001eb81a8205;hb=dc43cb5356c6c8eb214f5861e2262e5124fb1f75;hp=37cc0ff5bae45afd699b0e37c6ca984a08d5ebab;hpb=f46bd4d41cc7f243bc8a321effee5200aa69e709;p=dotfiles.git diff --git a/bin/cmp.py b/bin/cmp.py index 37cc0ff..800e119 100755 --- a/bin/cmp.py +++ b/bin/cmp.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """cmp.py: compare two files. Replace cmp because standard cmp cannot compare large files. """ @@ -6,11 +6,11 @@ large files. import sys, os if sys.argv[1] in ("-h", "--help"): - print "Broytman cmp.py 1.0, Copyright (C) 2003 PhiloSoft Design" - print "Usage: cmp.py [-h|--help|-V|--version] [-i] file1 file2" + print("Broytman cmp.py 1.0, Copyright (C) 2003-2023 PhiloSoft Design") + print("Usage: cmp.py [-h|--help|-V|--version] [-i] file1 file2") sys.exit() elif sys.argv[1] in ("-V", "--version"): - print "Broytman cmp.py 1.0, Copyright (C) 2003 PhiloSoft Design" + print("Broytman cmp.py 1.0, Copyright (C) 2003-2023 PhiloSoft Design") sys.exit() elif sys.argv[1] == "-i": show_pbar = False @@ -31,7 +31,7 @@ if show_pbar: try: size = os.path.getsize(fname1) except: - print filename, ": no such file" + print(filename, ": no such file") sys.exit(1) if show_pbar: @@ -62,7 +62,7 @@ while True: pbar.display(file1.tell()) if block1 and block2: - if len(block1) <> len(block2): + if len(block1) != len(block2): report() break elif block1: @@ -74,7 +74,7 @@ while True: else: break - if block1 <> block2: + if block1 != block2: report() break