home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
file39a.zip
/
src
/
notes.os2
< prev
next >
Wrap
Text File
|
1993-04-11
|
19KB
|
579 lines
This file, NOTES.OS2, contains various messages and remarks on the OS/2 port,
and some magicfile suggestions by John Adams and Gisbert W. Selke. The email
messages have been edited slightly for brevity and clarity.
General notes:
1. Versions were compiled with Microsoft C 6.00A and EMX/gcc 0.8f.
2. Some of the original code assumed 32-bit integers. The magic structure
was changed in order to reduce the memory requirement. EMX and MSC changes
can be found by searching for OS2, EMX, and MSC. Bugs in the original
sources can be found by searching for the word "bugfix".
3. MSC stat() is broken on directory names--see Stat() in fsmagic.c.
MSC utime() works as documented, but is still broken.
4. Use spawn instead of fork in EMX/gcc. No pipes in MSDOS; use tempfil.
5. Add apptype.c, which uses DosQ[uery]AppType to determine the type
of executable. If apptype.c has the filename, then apptype can determine
the file type (see apptype.c for one special bug).
However, when the program is reading from stdin (or from a pipe due to "-z"
unwinding), then apptype only sees the part of the file provided by the
program (HOWMANY bytes). In this case, DosQ[uery]AppType may not be able to
distinguish, for example, a DOS exe from an OS/2 exe.
6. The usual problems with binary vs text files, EOL, and directory
separators must be handled. strtol in EMX and MSC libs returns LONG_MAX
on overflow--use strtoul with sign check or the supplied localsrc/strtol.c
=============================================================================
To: Darrel R Hankerson <hankedr@mail.auburn.edu>
Cc: darwin@cs.toronto.edu
Subject: Re: file ported to OS/2 1.x--2.x
In-Reply-To: Your message of Mon, 05 Apr 93 07:39:25 -0500.
Date: Mon, 5 Apr 1993 10:51:49 -0400
From: ian@sq.com
On Mon, 5 Apr 1993 07:39:25 -0400 Darrel R Hankerson wrote:
>I have nearly finished a port of [file v3 patchlevel5]
>for OS/2 1.x--2.x.
Glad to see it's been made available for OS/2. Thanks!
>The main changes are:
> 1. Change fork() to spawn() (needed for 1.x).
> 2. Add API calls to determine executable type.
> 3. malloc() the magic->desc to reduce memory usage (needed for 1.x).
Yes, I'd like to get the source changes back. HOWEVER time has not
stood still; I am now distributing version 3.9, and would rather not
have version 3.[5] circulating. If you have your diffs as patch files,
would it be possible for you to get the lastest (by ftp from
ftp.cs.toronto.edu in /pub/darwin/file), apply and test them again, and
then send the new version both to me (for baseline source) and also:
>... upload this as "file3[9].zip" (with context diff's and suitable
>documentation) to the main OS/2 sites...
Then we'd all be distributing the same version...
[The current version given in] patchlevel.h now says:
#define FILE_VERSION_MAJOR 3
#define patchlevel 9
Actually, when I get your OS/2 changes in, it'll be 3.10!
You also mentioned some
>Minor magic-file problems:
which I'll track down.
>The porting was made easier by the excellent form of the sources. Your
>program is a fine piece of work.
Thanks for the feedback!
Ian Darwin Free Fine File(1) FTPable From Ftp.cs.toronto.edu
ian@sq.com cd /pub/darwin/file; get README.FTP -; binary;
Toronto, Canada mget dist.*
=============================================================================
Date: Tue, 6 Apr 93 09:20:50 CDT
From: Darrel R Hankerson <hankedr>
To: ian@sq.com
Cc: darwin@cs.toronto.edu
In-Reply-To: ian@sq.com's message of Mon, 5 Apr 1993 10:51:49 -0400 <m0nfsWp-0003bFC@sq.com>
Subject: file ported to OS/2 1.x--2.x
[...] I do see a few new buglets in 3.9:
1. In ascmagic.c, you've changed the check for the esc. But there are only
nbytes of valid data, right?
#ifdef OS2 /* bugfix, not OS/2 specific */
s = (unsigned char*) memcpy(nbuf, buf, nbytes);
has_escapes = (memchr(s, '\033', nbytes) != NULL);
#else
s = (unsigned char*) memcpy(nbuf, buf, HOWMANY);
has_escapes = (memchr(s, '\033', HOWMANY) != NULL);
#endif
This reminds me of another question: In compress.c, would it make more
sense to always read HOMANY bytes from the pipe (as uncompress will give back
more bytes than the orig buffer)?
2. print.c has not been updated to include the additional typ's:
#ifdef OS2 /* bugfix, not OS/2 specific */
(m->type >= 0 && m->type < sizeof(typ) ?
#else
(m->type >= 0 && m->type < 7 ?
#endif
You will see the bug if you try "file -c"
I have working 32-bit OS/2, 16-bit OS/2, and MSDOS versions. I've
added the API calls (in OS/2 versions) to determine the executable
type (can't do this with magic entries).
Notes:
1. OS/2 1.x can't fork()--added code to use pipes and spawn.
2. OS/2 2.x doesn't really like to fork; do spawn.
3. MSDOS can't pipe; added tmpnam code.
4. The 16-bit versions require some changes:
(a) a few int's need to be unsigned
(b) a few "%d" in printf need to be "%ld"
(c) change magic->desc to a pointer and malloc as needed. We need the
room. More changes here are probably desired, as the current magic
file has over 900 valid entries and MAXMAGIS=1000 is near the max for
the 16-bit version. I did have some problems changing
mag->value.s to pointer when I played with 3.5. This would give more
room, but I have not modified 3.9 in this area.
5. OS/2 and MSDOS programs need to handle the "traditional" EOL "\r\n" in
addition to "\n". A minor change to softmagic.c (in 2 places) is needed.
As an example,
#ifdef OS2 /* handle both "\r\n" and "\n" */
(void) printf_eol(m->desc, p->s);
#else
if ((rt=strchr(p->s, '\n')) != NULL)
*rt = '\0';
(void) printf(m->desc, p->s);
if (rt)
*rt = '\n';
#endif
printf_eol is suitably defined. Without this change, the printout will
be incorrect for the tst files c.misc*.
6. OS/2 and MSDOS programs need to handle both '/' and '\\' as directory
separators. Some minor changes are required. MSC stat() is partially broken
on dir names, minor change added.
--Darrel Hankerson hankedr@mail.auburn.edu or hank@ducvax.auburn.edu
=============================================================================
Date: Sat, 27 Mar 93 22:36:16 CST
From: Darrel R Hankerson <hankedr>
To: mattes@iema.e-technik.uni-stuttgart.de
Subject: How to recognise 16-bit apps
DH said:
>> Proposal: Maybe we need a working "file" program with a flexible approach
>> to magic entries. Mattes' apptype could be part of this project.
EM said:
> I can provide the code required for identifying the emx version (and
> whether a program is an emx program or isn't), if you need it. A
> "file"-like approach cannot be used for identifying the type of an
> .exe file -- the NE and LX headers can be almost anywhere.
I would like to add the code you mention. I also plan to add the "apptype"
code.
1. Do you have any suggestions on the way the output should look?
2. How can I identify EMX .o and .obj files?
3. Where can I get an extensive list of magic entries?
--Darrel Hankerson hankedr@mail.auburn.edu or hank@ducvax.auburn.edu
=============================================================================
From: Eberhard Mattes <mattes@azu.informatik.uni-stuttgart.de>
Date: Fri, 2 Apr 93 14:03:24 +0200
To: hankedr@mail.auburn.edu
In-Reply-To: Darrel R Hankerson's message of Sat, 27 Mar 93 22:36:16 CST <9303280436.AA04246@ducserv>
Subject: How to recognise 16-bit apps
> 1. Do you have any suggestions on the way the output should look?
It should be `machine readable'.
> 2. How can I identify EMX .o and .obj files?
Use the standard i386 Unix magic entry for .o files (0407). .obj
files start with a THEADR record (a byte of 0x80, followed by two
bytes indicating the length of the record).
> 3. Where can I get an extensive list of magic entries?
Try one of the Unix "file" programs. I think I've seen a list for all
the TeX file types somewhere, but they're probably included now in the
Unix "file" programs. TFM files are a bit hard -- there is no magic
word. You have to add up several values from the beginning of the
file and compare to some other values.
Yours,
Eberhard Mattes (mattes@azu.informatik.uni-stuttgart.de)
=============================================================================
From: Eberhard Mattes <mattes@azu.informatik.uni-stuttgart.de>
Date: Tue, 6 Apr 93 16:53:19 +0200
To: hankedr@mail.auburn.edu
In-Reply-To: Darrel R Hankerson's message of Fri, 2 Apr 93 23:26:11 CST
Subject: How to recognise 16-bit apps
> I added the ideas from the apptype program. I noticed that the api call
> has somewhat of a bug: The file "blob.com" will be called a DOS exe, unless
> it is an OS/2 program (e.g., a text file "blob.com" will be called a DOS
> exe).
Moreover, it reports the type of the (new and very bug ridden) Win
Emacs as "OS/2 executable".
> I have not received your code to identify the EMX version. I will add this,
> should you find time to do this.
I haven't sent it yet :-)
Yours,
Eberhard Mattes (mattes@azu.informatik.uni-stuttgart.de)
=============================================================================
Date: Mon, 29 Mar 1993 09:40:45 +0100
From: ccaajpa@ucl.ac.uk (John Paul Adams)
To: hankedr@mail.auburn.edu
Subject: Re: magic file entries needed
In article <1993Mar28.030820.21367@news.duc.auburn.edu> you write:
>Some time ago, someone posted a collection of magic file entries (these
>are used by "file" to determine the kind of file). I think they were posted
>here, as they included some entries for various kinds of image files, but
>I could be wrong.
I have saved variuos snippets of the network and sorted them out into quite
a nice magic file, though there have been many ideas posted to the network
that don't work on our IBM RS6000 machine, so have not been included. I
would be interested if you have any entries that do not appear on my list,
especially MPEG.
Thanks,
John Adams,
J.Adams@uk.ac.ucl
-------------------------- my magic files starts here --------------------
##### This file is a collection of formats of files that can be used with
##### the "file" command for determining what kind of file a file is.
##### This extends to systems files, file archives and graphics formats.
##### They are spread into these three sections. The data has been gathered
##### from a number of sources, mainly from Usenet postings in the pixutils
##### groups.
#####
##
## AIX SYSTEM FILES
## ================
## These have been collected from the AIX 3.1 and AIX 3.2 /etc/magic files
## and possibly will not run under other computers.
##
#####
0 short 070707 cpio archive
0 string 070707 ASCII cpio archive
0 short 017436 packed text
0 string <aiaff> archive
0 string Rast RST format font raster
0 short 0x01df executable (RISC System/6000 V3.2) or object module
>12 long >0 not stripped
0 short 0x0103 executable (RT Version 2) or obj module
>2 byte 0x50 pure
>28 long >0 not stripped
>6 short >0 - version %ld
0 short 0x0104 shared library
0 short 0x0105 ctab data
0 short 0xfe04 structured file
0 string 0xabcdef message catalog
#####
##
## GENERAL UNIX SYSTEM FILES
## =========================
## These are generally accepted Unix types that should work on any
## Unix system.
##
#####
0 short 017037 packed
0 short 8093 compressed
0 short 0433 curses-scrdump
0 short 0434 curses-scrdump
0 string %! PostScript
#####
##
## ARCHIVE FORMATS
## ===============
## These are a general collection of archivers and stuffers, not only
## Unix ones, but those that have come from DOS, Mac and other systems.
##
#####
#################
## ##
## DOS FILES ##
## ========= ##
## ##
#################
0 string MZ MS-DOS executable
###########
## ##
## ARC ##
## === ##
## ##
###########
0 string \032\010 Arc archive
0 short 0x1a08 Arc archive
0 short 0x081a Arc archive
#################
## ##
## LHARC/LHA ##
## ========= ##
## ##
#################
2 string -lh0- Lharc 1.x archive
2 string -lh1- Lharc 1.x archive
2 string -lz4- Lharc 1.x archive
2 string -lz5- Lharc 1.x archive
# [never seen any but the last:]
2 string -lzs- LHa 2.x? archive [lzs]
2 string -lh - LHa 2.x? archive [lh ]
2 string -lhd- LHa 2.x? archive [lhd]
2 string -lh2- LHa 2.x? archive [lh2]
2 string -lh3- LHa 2.x? archive [lh3]
2 string -lh4- LHa 2.x? archive [lh4]
2 string -lh5- LHa (2.x) archive
###########
## ##
## ZIP ##
## === ##
## ##
###########
# [newer, smarter "file" programs]
0 string PK\003\004 Zip archive
>4 string \011 (at least v0.9 to extract)
>4 string \012 (at least v1.0 to extract)
>4 string \013 (at least v1.1 to extract)
>4 string \024 (at least v2.0 to extract)
# [stupid "file" programs, big-endian]
0 long 0x504b0304 Zip archive
>1 long 0x4b030409 (at least v0.9 to extract)
>1 long 0x4b03040a (at least v1.0 to extract)
>1 long 0x4b03040b (at least v1.1 to extract)
>1 long 0x4b030414 (at least v2.0 to extract)
# [stupid "file" programs, little-endian]
0 long 0x04034b50 Zip archive
>1 long 0x0904034b (at least v0.9 to extract)
>1 long 0x0a04034b (at least v1.0 to extract)
>1 long 0x0b04034b (at least v1.1 to extract)
>1 long 0x1404034b (at least v2.0 to extract)
###########
## ##
## ZOO ##
## === ##
## ##
###########
# [GRR: don't know if all of these versions exist, or if some missing...]
0 string ZOO Zoo archive
>4 string 1.00 (v%4s)
>4 string 1.10 (v%4s)
>4 string 1.20 (v%4s)
>4 string 1.30 (v%4s)
>4 string 1.40 (v%4s)
>4 string 1.50 (v%4s)
>4 string 1.60 (v%4s)
>4 string 1.70 (v%4s)
>4 string 1.71 (v%4s)
>4 string 2.00 (v%4s)
>4 string 2.01 (v%4s)
>4 string 2.10 (v%4s)
# [newer, smarter "file" programs]
>32 string \001\000 (modify: v1.0+)
>32 string \001\004 (modify: v1.4+)
>32 string \002\000 (modify: v2.0+)
>70 string \001\000 (extract: v1.0+)
>70 string \002\001 (extract: v2.1+)
# [stupid "file" programs, big-endian]
>32 short 0x0100 (modify: v1.0+)
>32 short 0x0104 (modify: v1.4+)
>32 short 0x0200 (modify: v2.0+)
>70 short 0x0100 (extract: v1.0+)
>70 short 0x0201 (extract: v2.1+)
# [stupid "file" programs, little-endian]
>32 short 0x0001 (modify: v1.0+)
>32 short 0x0401 (modify: v1.4+)
>32 short 0x0002 (modify: v2.0+)
>70 short 0x0001 (extract: v1.0+)
>70 short 0x0102 (extract: v2.1+)
# [GRR: the following are alternate identifiers]
#20 long 0xdca7c4fd Zoo archive
#20 long 0xc4fddca7 Zoo archive
################
## ##
## COMPRESS ##
## ======== ##
## ##
################
# [newer, smarter "file" programs]
# [GRR: are the upper three bits (block size) ever different from 100?]
0 string \037\235 compress'd file
>2 string \211 (9 bits)
>2 string \212 (10 bits)
>2 string \213 (11 bits)
>2 string \214 (12 bits)
>2 string \215 (13 bits)
>2 string \216 (14 bits)
>2 string \217 (15 bits)
>2 string \220 (16 bits)
# [stupid "file" programs, big-endian]
0 short 0x1f9d compress'd file
>1 short 0x9d89 (9 bits)
>1 short 0x9d8a (10 bits)
>1 short 0x9d8b (11 bits)
>1 short 0x9d8c (12 bits)
>1 short 0x9d8d (13 bits)
>1 short 0x9d8e (14 bits)
>1 short 0x9d8f (15 bits)
>1 short 0x9d90 (16 bits)
# [stupid "file" programs, little-endian]
0 short 0x9d1f compress'd file
>1 short 0x899d (9 bits)
>1 short 0x8a9d (10 bits)
>1 short 0x8b9d (11 bits)
>1 short 0x8c9d (12 bits)
>1 short 0x8d9d (13 bits)
>1 short 0x8e9d (14 bits)
>1 short 0x8f9d (15 bits)
>1 short 0x909d (16 bits)
############
## ##
## BTOA ##
## ==== ##
## ##
############
0 string xbtoa btoa'd file
################
## ##
## UUDECODE ##
## ======== ##
## ##
################
0 string begin uuencoded file
#####
##
## GRAPHICS FORMATS
## ================
## The ever increasing number of formats makes this section quite
## large and the most useful of the collection
##
#####
###########
## ##
## GIF ##
## === ##
## ##
###########
0 string GIF GIF image archive
>3 string 87a - version %3s
>3 string 87A - version %3s
>3 string 89a - version %3s
>3 string 89A - version %3s
############
## ##
## JPEG ##
## ==== ##
## ##
############
0 long 0xffd8ffe0 JPEG image, big endian
0 long 0xe0ffd8ff JPEG image, little endian
0 string hsi1 HSI1 image (wrapper for JPEG?)
6 string JFIF JPEG JFIF
####################
## ##
## PBM+ FORMATS ##
## ============ ##
## ##
####################
0 string P1 PBM file
0 string P2 PGM file
0 string P3 PPM file
0 string P4 PBM "rawbits" file
0 string P5 PGM "rawbits" file
0 string P6 PPM "rawbits" file
##############################
## ##
## OTHER GRAPHICS FORMATS ##
## ====================== ##
## ##
##############################
0 string \361\0\100\273 CMU window manager bitmap
0 string \131\246\152\225 Sun rasterfile
0 string yz MGR bitmap
0 string \115\115 TIFF file, big-endian
0 string \111\111 TIFF file, little-endian
8 string ILBM IFF ILBM file
0 string This\040is\040a\040BitMap\040file Lisp Machine bit-array-file
0 string !! Bennet Yee's "face" format
0 long 0xf7020183 DVI
0 string \0\0\1\263 MPEG Paris
#####
##
## SOUND FORMATS
## =============
## A few different sound formats from different machines.
##
#####
0 string .snd Sun Audio
##### Here endeth the list.
##### Last Updated 10th December 1992.
##### John Adams, User Services, University College London.
##### J.Adams@ucl.ac.uk (J.Adams@uk.ac.ucl for JANET users)