1# $OpenBSD: cafebabe,v 1.3 2009/04/24 18:54:34 chl Exp $ 2 3#------------------------------------------------------------------------------ 4# Cafe Babes unite! 5# 6# Since Java bytecode and Mach-O fat-files have the same magic number, the test 7# must be performed in the same "magic" sequence to get both right. The long 8# at offset 4 in a mach-O fat file tells the number of architectures; the short at 9# offset 4 in a Java bytecode file is the JVM minor version and the 10# short at offset 6 is the JVM major version. Since there are only 11# only 18 labeled Mach-O architectures at current, and the first released 12# Java class format was version 43.0, we can safely choose any number 13# between 18 and 39 to test the number of architectures against 14# (and use as a hack). Let's not use 18, because the Mach-O people 15# might add another one or two as time goes by... 16# 170 beshort 0xcafe 18>2 beshort 0xbabe 19!:mime application/x-java-applet 20>4 belong >30 compiled Java class data, 21>>6 beshort x version %d. 22>>4 beshort x \b%d 23>>4 belong 1 Mach-O fat file with 1 architecture 24>>4 belong >1 25>>>4 belong <20 Mach-O fat file with %ld architectures 26>2 beshort 0xd00d JAR compressed with pack200 27!:mime application/x-java-pack200 28