summaryrefslogtreecommitdiffstats
path: root/Mac/scripts
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-05-06 14:16:55 (GMT)
committerGuido van Rossum <guido@python.org>1994-05-06 14:16:55 (GMT)
commitdc0493ac67a975e010e813a5bc5363215a702463 (patch)
tree1656e9fefe98e92c599083ae55a3579e08388cfd /Mac/scripts
parentfe16cc03382c0d58ac8feb358d36ac44826221b1 (diff)
downloadcpython-dc0493ac67a975e010e813a5bc5363215a702463.zip
cpython-dc0493ac67a975e010e813a5bc5363215a702463.tar.gz
cpython-dc0493ac67a975e010e813a5bc5363215a702463.tar.bz2
Initial revision
Diffstat (limited to 'Mac/scripts')
-rwxr-xr-xMac/scripts/crlf.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Mac/scripts/crlf.py b/Mac/scripts/crlf.py
new file mode 100755
index 0000000..f52867a
--- /dev/null
+++ b/Mac/scripts/crlf.py
@@ -0,0 +1,25 @@
+#! /usr/local/bin/python
+
+import sys
+import os
+import string
+
+def main():
+ args = sys.argv[1:]
+ if not args:
+ print 'no files'
+ sys.exit(1)
+ for file in args:
+ print file, '...'
+ data = open(file, 'r').read()
+ lines = string.splitfields(data, '\r')
+ newdata = string.joinfields(lines, '\n')
+ if newdata != data:
+ print 'rewriting...'
+ os.rename(file, file + '~')
+ open(file, 'w').write(newdata)
+ print 'done.'
+ else:
+ print 'no change.'
+
+main()