[klibc] bunch of small fixes
Oleg Verych
olecom at gmail.com
Fri Mar 28 19:12:59 PDT 2008
Nigel Cunningham @ On Sat, Mar 29, 2008 at 2:18 AM:
> > > Not being a shell guru, I'm not sure what the simplest way is to get
> > > 0xedc302e99856e50c into the start of a file. Can you help there?
> > >
> >
> > It depends on what byte order you want to use (it should match the byte
> > order of the other fields), but for littleendian, you can do:
> >
> > printf '\x0c\xe5\x56\x98\xe9\x02\xc3\xed' > file
> >
> > or
|
> > echo -ne '\x0c\xe5\x56\x98\xe9\x02\xc3\xed' > file
(note, that this one is not portable bashizm wrt e.g. [d]ash)
> > What I mean with "match the byte order of the other fields" - if you
> > have no fields which are host-byte-order-dependent, just pick a specific
> > byte sequence (like the above one) and stick to it. If you *have*
> > fields which are host-byte-order-dependent, then you probably want to
> > have the magic be endian-sensitive too,
|
> > unless you have a separate byte order field.
(important detail)
> Regarding endianness, I don't think that's an issue here, since the
> normal case is for the computer writing the data to be the one reading
> it back.
Anyway be careful about any other than by byte access (i.e word,
double word, etc.), when implementing comparison of the signature.
_______
More information about the klibc
mailing list