diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-10-09 03:31:14 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-10-09 03:31:14 +0200 |
commit | 12f0b138c93f3f544233aeb531dfa84a5dd75e61 (patch) | |
tree | b21ac2ebe10b8779950cf41a55ec1146a1888b42 /src | |
parent | add --print0 to readme (diff) | |
download | bfind-12f0b138c93f3f544233aeb531dfa84a5dd75e61.tar.gz bfind-12f0b138c93f3f544233aeb531dfa84a5dd75e61.tar.bz2 bfind-12f0b138c93f3f544233aeb531dfa84a5dd75e61.tar.xz |
m readme + implement -0
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-x | src/bfind.py | 3 |
1 files changed, 3 insertions, 0 deletions
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): |