detect unix or dos line endings



On 05/23/2011 02:43 PM, Edwin Woollett wrote:
> On May 23, Paul Bowyer wrote:
> ------------------------------------
>
> On 05/23/2011 12:17 PM, Edwin Woollett wrote:
>> How can I use Maxima to determine whether a text
>> file has unix (LF = ascii 10) or dos line endings (CR = ascii 13, LF)?
>>
>> Ted Woollett
>>
> Hi again Ted:
>
> Look in the help file for "ascii (int)" and "cequal (char_1, char_2)" 
> and its friends as a possible solution.
>
> Paul
> ----------------------------------------------
> Thanks, Paul, but so far these critters are no help.
> For example, using openr, and then readline, results in all the 
> characters of the line EXCEPT
> the LF ( or CR LF ) characters at the end of the
> binary line. So there is no "there" to
> interrogate.
>
> On May 23, Dan Stanger wrote:
> ---------------------------------------------
> Use the underlying lisp.
> Dan
> -----------------------------------
>
> Hi Dan,  I would like to find a solution which only uses
> the tools presently available in the Maxima language,
> such as are provided in file reads, and string processing,
> etc.  I would like to include something about
> reading and writing files within the Maxima language in
> the revised Ch.2 of Maxima by Example.  This should
> include mundane tasks such as file_length, file_type
> (unix or dos line endings), utilities such as
> unix_to_dos, dos_to_unix file conversions, etc, etc.
>
> So far, Maxima by Example has earnestly endeavored
> to accomplish basic grunt tasks using just the basic
> Maxima language tools (things you can do in
> True Basic, for example),  since it is supposed
> to be an introduction, and not really for experts.
> Once I am satisfied that a good introduction for
> beginners exists, it might be time for some Lisp
> code tutorials.
>
> Ted
>
>
>
Ted:

I found functions for opening binary and reading binary, but they bring 
in floating point numbers and I didn't find anything to convert that to 
ascii. If it's available in Maxima without resorting to lisp, I couldn't 
find it.

Paul