#------------------------------------------------------------------------------
# Localstuff:  file(1) magic for locally observed files
#
# $File: Localstuff,v 1.4 2003/03/23 04:17:27 christos Exp $
# Add any locally observed files here.  Remember:
# text if readable, executable if runnable binary, data if unreadable.
#
# akm:  I finally managed to compile my additions into my
#       main /usr/share/misc/magic.mgc file.
#       But it was tricky. I think file is particular about
#       LF/CRLF, or tabs between fields, or line lengths,
#       or something. It is probably better to keep my changes here,
#       where they will not be stomped on by Yum/rpm updates.
#       I don't know if these tests for WarpIn archives are detailed enough
#       to submit to the file maintainer, but they work for my purposes.
#------------------------------------------------------------------------------
# OS/2 WarpIn archives (Anton Monroe, amonroe5301@gmail.com)
# WarpIn is an OS/2 package manager. A plain WarpIn archives
# normally has a filename with extension '.wpi' and a header ID
# at Offset 0.
0           string  \x77\x04\x02\xBE        OS/2 WarpIn archive

# A WarpIn archive may also be a self-extracting executable. It has an
# executable section that seems to vary from 40,000 to 42,500 bytes long,
# followed by the archive header. There is a duplicate header at the end
# of the file, but file can't start reading from the end. (no longer true
# in newer versions of file)
# All of the executable WarpIn archives I have seen contain "OS2STUB"
# at or near Offset 603.

# If I run file under OS/2, this test only works if I disable other OS/2
# tests with "-e apptype". I do not know how the apptype test works, but
# it seems to disable this test, even if I use '--keep-going'.
# (later: apptype.c simply calls OS/2 system DosQueryAppType(<filename>)
# and reports "32-bit", "physical device driver", "DOS executable", etc.
# I still do not understand why that should prevent doing other tests.

0           string MZ
>600        search/20 OS2STUB
>>40000     search/3000 \x77\x04\x02\xBE    OS/2 WarpIn self-extracting archive

# akm: negative offset from end-of-file is added in version 5.33
# akm: fix: the file 'msdos' says
#        "OS/2 batch files are REXX. ..." which is not quite true
#    and it does not check for /* as first two bytes

