diff -ru2N file-4.03/magic/Magdir/java file-4.03-patched/magic/Magdir/java --- file-4.03/magic/Magdir/java Sun Feb 15 18:08:45 1998 +++ file-4.03-patched/magic/Magdir/java Sun Apr 27 20:05:15 2003 @@ -2,7 +2,13 @@ # Java ByteCode # From Larry Schwimmer (schwim@cs.stanford.edu) -0 belong 0xcafebabe compiled Java class data, ->6 beshort x version %d. ->4 beshort x \b%d +# +# The Java magic number is the same as the Mach-O fat file magic number. +# Interestingly the the same guy, Mike DeMoney, of NeXT Inc. then of First +# Person (Sun) picked both numbers only a couple of years apart. To make +# the file(1) command work with both the Java Bytecode magic was merged with +# the Mach-O magic in the file mach. +# +#0 belong 0xcafebabe +#>4 belong 0x0003002d Java bytecode #------------------------------------------------------------ # Java serialization diff -ru2N file-4.03/magic/Magdir/mach file-4.03-patched/magic/Magdir/mach --- file-4.03/magic/Magdir/mach Sun Feb 14 12:16:20 1999 +++ file-4.03-patched/magic/Magdir/mach Sun Apr 27 20:04:05 2003 @@ -2,16 +2,62 @@ # mach file description # -0 belong 0xcafebabe Mach-O fat file ->4 belong 1 with 1 architecture +# Since Java bytecode and Mach-O fat-files have the same magic number the test +# must be preformed in the same "magic" sequence to get both right. The long +# at offset 4 in a fat file tells the number of architectures. The short at +# offset 4 in a Java bytecode file is the compiler minor version and the +# short at offset 6 is the compiler major version. Since the minor version is +# never to be non-zero then the hack of testing for the number of architectures +# to be less that the maximum short is done here. +# +0 belong 0xcafebabe +>4 belong 0x0003002d Java bytecode +>4 belong 1 Mach-O fat file with 1 architecture >4 belong >1 ->>4 belong x with %ld architectures +>>4 belong <0xffff Mach-O fat file with %ld architectures +# +0 lelong 0xfeedface Mach-O +>12 lelong 1 object +>12 lelong 2 executable +>12 lelong 3 fixed virtual memory shared library +>12 lelong 4 core +>12 lelong 5 preload executable +>12 lelong 6 dynamically linked shared library +>12 lelong 7 dynamic linker +>12 lelong 8 bundle +>12 lelong >8 +>>12 lelong x filetype=%ld +>4 lelong <0 +>>4 lelong x architecture=%ld +>4 lelong 1 vax +>4 lelong 2 romp +>4 lelong 3 architecture=3 +>4 lelong 4 ns32032 +>4 lelong 5 ns32332 +>4 lelong 6 m68k +>4 lelong 7 i386 +>4 lelong 8 mips +>4 lelong 9 ns32532 +>4 lelong 10 architecture=10 +>4 lelong 11 hppa +>4 lelong 12 acorn +>4 lelong 13 m88k +>4 lelong 14 sparc +>4 lelong 15 i860-big +>4 lelong 16 i860 +>4 lelong 17 rs6000 +>4 lelong 18 ppc +>4 lelong >18 +>>4 lelong x architecture=%ld # 0 belong 0xfeedface Mach-O >12 belong 1 object >12 belong 2 executable ->12 belong 3 shared library +>12 belong 3 fixed virtual memory shared library >12 belong 4 core >12 belong 5 preload executable ->12 belong >5 +>12 belong 6 dynamically linked shared library +>12 belong 7 dynamic linker +>12 belong 8 bundle +>12 belong >8 >>12 belong x filetype=%ld >4 belong <0