[Ecls-list] Load and filenames.

Nathan Hawkins utsl at quic.net
Fri May 30 17:55:45 UTC 2008


Juan,
Actually, magic numbers wouldn't be that hard. Almost all *nix systems 
now use ELF, and ELF puts the same magic file id on all platforms. 
Windows and OSX are only two systems, so you'd end up with about 4-5 
magic numbers, none of which are going to change anytime soon.

Also, bindings to libmagic might be a better alternative to parsing the 
output of file.

Nathan



Juan Jose Garcia-Ripoll wrote:
> On Fri, May 30, 2008 at 6:06 PM, Waldek Hebisch
> <hebisch at math.uni.wroc.pl> wrote:
>   
>> Apparently, if file extension is unknown to 'load' it treats file
>> as a Lisp file.  It would be nice if 'load' could decide file type
>> based on content...
>>     
>
> Simply put, I do not know how to code this in a portable way. Seems
> like one should track all the magic file IDs of binary files on all
> platforms where ECL could potentially be built.
>
> Hmm, the only serious alternative I can think of is using the Unix
> command "file" and interpreting its output to decide whether the
> binary is executable (and hence fasl) or text (and hence potentially
> lisp source).
>
> Juanjo
>
>   





More information about the ecl-devel mailing list