From 12f0b138c93f3f544233aeb531dfa84a5dd75e61 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 9 Oct 2013 03:31:14 +0200 Subject: m readme + implement -0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/bfind.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/bfind.py b/src/bfind.py index bb8e3af..6dc67d9 100755 --- a/src/bfind.py +++ b/src/bfind.py @@ -25,6 +25,7 @@ xdev = False hardlinks = False symlinks = False visible = False +ending = '\n'.encode('utf-8') path = '' for arg in sys.argv[1:]: @@ -35,6 +36,7 @@ for arg in sys.argv[1:]: if arg == '--hardlinks' or (arg[:2] != '--' and 'h' in arg): hardlinks = True if arg == '--symlinks' or (arg[:2] != '--' and 's' in arg): symlinks = True if arg == '--visible' or (arg[:2] != '--' and 'v' in arg): visible = True + if arg == '--print0' or (arg[:2] != '--' and '0' in arg): ending = '\0'.encode('utf-8') visited_name = set() visited_id = set() @@ -65,6 +67,7 @@ while len(queue) > 0: if os.stat(path).st_dev != start_dev: # TODO make sure there is not symlinking problems continue sys.stdout.buffer.write(path.encode('utf-8')) + sys.stdout.buffer.write(ending) sys.stdout.buffer.flush() if os.path.isdir(path) and (symlinks or not os.path.islink(path)): for subd in os.listdir(path): -- cgit v1.2.3-70-g09d2