1 """checktext - Check that a text file has macintosh-style newlines"""
9 fsspec
, ok
= macfs
.PromptGetFile('File to check end-of-lines in:', 'TEXT')
12 pathname
= fsspec
.as_pathname()
13 fp
= open(pathname
, 'rb')
17 EasyDialogs
.Message('Sorry, file is too big.')
20 EasyDialogs
.Message('File is empty.')
22 number_cr
= string
.count(data
, '\r')
23 number_lf
= string
.count(data
, '\n')
24 if number_cr
== number_lf
== 0:
25 EasyDialogs
.Message('File contains no lines.')
27 EasyDialogs
.Message('File has unix-style line endings')
29 EasyDialogs
.Message('File has mac-style line endings')
30 elif number_cr
== number_lf
:
31 EasyDialogs
.Message('File probably has MSDOS-style line endings')
33 EasyDialogs
.Message('File has no recognizable line endings (binary file?)')
36 if __name__
== '__main__':