Subject: Re: CVS commit: basesrc/usr.bin/file
To: None <tech-userlevel@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 06/05/2002 10:51:47
>>> So, it most be solved in another way, probably by padding struct
>>> file in such a way that it's the same on all archs.
["struct magic", surely?]
>> That's only a better-guess "solution" (ie, it works on more hosts
>> but still is not C-guaranteed to work).  If you really want to
>> generate the same data on all arches, you have to pack and unpack it
>> yourself, rather than depending on overlaying a struct onto it.
> The object of the magic.mgc is so that you don't have to interpret
> the uncompiled file each time around.

(a) Unpacking a binary file carefully is usually still faster than
    parsing and compiling the text file.

(b) The compiled file *reader* is a NetBSD-only program, I think?  Only
    the *writer* is liable to be compiled with non-gcc?  In that case,
    the writer should be super-careful, but the reader can overlay a
    struct and count on gcc to make it work "right".

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B