Passed purify. Fixed indirections. Fixed byte order printing.
Fixed segmentation faults caused by referencing past the end
of the magic buffer. Fixed bus errors caused by referencing
unaligned shorts or longs.
Added more debugging information, and made existing
debugging printing to go to stderr. Added limit counts
to all functions to avoid spurious core-dumps.
Use calloc() to allocate magic entries to avoid unitialized
memory spurious errors. Change showstr to print to a file
and the ability to print both counted and null terminated strings
Ian Darwin [Fri, 19 Feb 1993 15:01:26 +0000 (15:01 +0000)]
Numerous changes from Guy Harris too numerous to mention but including
byte-order independance, fixing "old-style masking", etc. etc. A bugfix
for broken symlinks from martin@@d255s004.zfe.siemens.de.
Ian Darwin [Fri, 19 Feb 1993 14:22:48 +0000 (14:22 +0000)]
Part of Guy Harris' Jan-93 rewrite, including:
Add in support for multiple levels of continuation.
Add in support for "beshort", "belong", "bedate", "leshort",
"lelong", and "ledate" types.
Also, make old-style "not set"ting - "0 byte ^0x80 statically
linked", meaning "this line matches if any of the bits in the
value *aren't* set in the number from the file" - work.
Ian Darwin [Fri, 19 Feb 1993 14:22:47 +0000 (14:22 +0000)]
Part of Guy Harris' Jan-93 rewrite, including:
Add in support for "beshort", "belong", "bedate", "leshort",
"lelong", and "ledate" types.
NOTE: it doesn't support multi-level ">"; it wasn't clear to me
why it printed things such as "offset" and "indirect-offset" for
old-style continuations, as the offset into the file is an
absolute number *even for continuation lines*.
Ian Darwin [Fri, 19 Feb 1993 14:22:46 +0000 (14:22 +0000)]
Part of Guy Harris' Jan-93 rewrite, including:
Note that "short", "long", and "date" work in the native byte
order of the process running "file" (actually, I say "this
machine", but I could imagine UNIX on MIPS chips supporting both
big-endian and little-endian processes), and document "beshort",
"belong", "bedate", "leshort", "lelong", and "ledate".
Document old-style ANDing, now that it works.
Formatting nits.
Mention that ">\0" can be used to match any string, and thus to
print strings extracted from the file.
Document multi-level ">".
Document that I haven't yet implemented ways of specifying the
endianness of data to be used in indirect offsets.
Ian Darwin [Fri, 19 Feb 1993 14:22:45 +0000 (14:22 +0000)]
Part of Guy Harris' Jan-93 rewrite, including:
Put an extra '\0' at the end of the buffer before handing it to
"tryit()"; "ascmagic()" assumes the buffer is a '\0'-terminated
string, as it runs a copy of it through "strtok()".
Ian Darwin [Fri, 19 Feb 1993 14:22:42 +0000 (14:22 +0000)]
Part of Guy Harris' Jan-93 rewrite, including:
Add in support for multiple levels of continuation.
Add in support for "beshort", "belong", "bedate", "leshort",
"lelong", and "ledate" types.
Fix the old-style ANDing - don't change it to a MASK op
relation, because:
there's already code to handle old-style ANDing and there's no
need to use the MASK op code to implement this;
the parser that used to be there assumed that there was a
*second* number that represented a value against which
to compare the ANDed value, and the old-style ANDing
*didn't* have that so lines containing the old-style
syntax "0 byte &0x80 dynamically linked" turned into
lines containing the new-style syntax "0 byte&0x80 0
dynamically linked", as the missing second value
defaulted to 0.
That may be where that bizarro "!074000,000000" stuff from the
Clipper magic number stuff came, but since you can just
*explicitly* implement that with new-style ANDing, one might as
well just do that....
Also, make old-style "not set"ting - "0 byte ^0x80 statically
linked", meaning "this line matches if any of the bits in the
value *aren't* set in the number from the file" - work.