diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2018-04-12 10:38:26 +0300 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2018-04-12 10:38:26 +0300 |
commit | c30cca6a46335397110ad3e35a9c100ab47b3f5a (patch) | |
tree | f3ab0b9a8e66b763d0827416f02c0f049cbcf601 /unix2dos.py | |
parent | 31bdc161fbb2cc51c745894836dd08a3ca8d6923 (diff) |
Updated cleanup script to also enforce Windows-style line endings
Diffstat (limited to 'unix2dos.py')
-rw-r--r-- | unix2dos.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/unix2dos.py b/unix2dos.py new file mode 100644 index 000000000..517955040 --- /dev/null +++ b/unix2dos.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import sys + +for fname in sys.argv[1:]: + infile = open( fname, "rb" ) + instr = infile.read() + infile.close() + outstr = instr.replace( "\r\n", "\n" ).replace( "\r", "\n" ).replace( "\n", "\r\n" ) + + if len(outstr) == len(instr): + continue + + outfile = open( fname, "wb" ) + outfile.write( outstr ) + outfile.close() |