Home | History | Annotate | Download | only in tools

Lines Matching refs:crlf

42 def PrevailingEOLName(crlf, cr, lf):
46 crlf: How many CRLF (\r\n) sequences are in the file.
47 cr: How many CR (\r) characters are in the file, excluding CRLF sequences.
48 lf: How many LF (\n) characters are in the file, excluding CRLF sequences.
53 most = max(crlf, cr, lf)
56 if most == crlf:
57 return 'crlf'
61 def FixEndings(file, crlf, cr, lf):
62 """Change the file's line endings to CRLF or LF, whichever is more common."""
63 most = max(crlf, cr, lf)
64 if most == crlf:
88 crlf = CountChars(text, '\r\n')
89 cr = CountChars(text, '\r') - crlf
90 lf = CountChars(text, '\n') - crlf
93 if crlf > 0 or cr > 0:
98 if ((crlf > 0 and cr > 0) or
99 (crlf > 0 and lf > 0) or
101 print '%s: mostly %s' % (filename, PrevailingEOLName(crlf, cr, lf))
102 FixEndings(filename, crlf, cr, lf)
137 help="Force any files with CRLF to LF instead.")