blob: f52867a34ea21616af093eee9870f66b9b948379 [file] [log] [blame]
Guido van Rossumdc0493a1994-05-06 14:16:55 +00001#! /usr/local/bin/python
2
3import sys
4import os
5import string
6
7def main():
8 args = sys.argv[1:]
9 if not args:
10 print 'no files'
11 sys.exit(1)
12 for file in args:
13 print file, '...'
14 data = open(file, 'r').read()
15 lines = string.splitfields(data, '\r')
16 newdata = string.joinfields(lines, '\n')
17 if newdata != data:
18 print 'rewriting...'
19 os.rename(file, file + '~')
20 open(file, 'w').write(newdata)
21 print 'done.'
22 else:
23 print 'no change.'
24
25main()