home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-08-05 | 36.1 KB | 1,310 lines |
- Only in src: _getname.c
- diff -cr old/apprentice.c src/apprentice.c
- *** old/apprentice.c Thu Aug 05 16:20:38 1993
- --- src/apprentice.c Sat Apr 10 20:29:06 1993
- ***************
- *** 43,51 ****
- static int getvalue __P((struct magic *, char **));
- static int hextoint __P((int));
- static char *getstr __P((char *, char *, int, int *));
- static int parse __P((char *, int *, int));
- -
- static int maxmagic = 0;
-
- int
- apprentice(fn, check)
- --- 43,55 ----
- static int getvalue __P((struct magic *, char **));
- static int hextoint __P((int));
- static char *getstr __P((char *, char *, int, int *));
- + #ifdef OS2
- + static int parse __P((char *, unsigned int *, int));
- + static unsigned int maxmagic = 0;
- + #else
- static int parse __P((char *, int *, int));
- static int maxmagic = 0;
- + #endif
-
- int
- apprentice(fn, check)
- ***************
- *** 100,114 ****
- static int
- parse(l, ndx, check)
- char *l;
- ! int *ndx, check;
- {
- ! int i = 0, nd = *ndx;
- struct magic *m;
- char *t, *s;
-
- if (nd+1 >= maxmagic){
- maxmagic += 20;
- ! if ((magic = (struct magic *) realloc(magic,
- sizeof(struct magic) *
- maxmagic)) == NULL) {
- (void) fprintf(stderr, "%s: Out of memory.\n", progname);
- --- 104,140 ----
- static int
- parse(l, ndx, check)
- char *l;
- ! #ifdef OS2
- ! unsigned int *ndx;
- ! #else
- ! int *ndx;
- ! #endif
- ! int check;
- {
- ! int i = 0;
- ! #ifdef OS2
- ! unsigned int nd = *ndx;
- ! #else
- ! int nd = *ndx;
- ! #endif
- struct magic *m;
- char *t, *s;
-
- if (nd+1 >= maxmagic){
- + #ifdef MSC /* 16-bit int */
- + if (maxmagic >= MAXMAGIC) {
- + (void) fprintf(stderr, "%s: magic file too large.\n", progname);
- + if (check)
- + return -1;
- + else
- + exit(1);
- + }
- + else
- + maxmagic = min(maxmagic + 20, MAXMAGIC);
- + #else
- maxmagic += 20;
- ! #endif
- ! if ( (magic = (struct magic *) realloc(magic,
- sizeof(struct magic) *
- maxmagic)) == NULL) {
- (void) fprintf(stderr, "%s: Out of memory.\n", progname);
- ***************
- *** 286,291 ****
- --- 312,334 ----
- m->nospflag = 1;
- } else
- m->nospflag = 0;
- +
- + #ifdef OS2
- + #ifndef min
- + #define min(a,b) (((a) < (b)) ? (a) : (b))
- + #endif
- + i = min(strlen(l) + 1, MAXDESC);
- + if ((m->desc = (char *) malloc((size_t) i)) == NULL) {
- + (void) fprintf(stderr, "%s: Out of memory.\n", progname);
- + if (check)
- + return -1;
- + else
- + exit(1);
- + }
- + m->desc[i-1] = '\0';
- + i = 0;
- + #endif
- +
- while ((m->desc[i++] = *l++) != '\0' && i<MAXDESC)
- /* NULLBODY */;
-
- ***************
- *** 333,339 ****
- --- 376,391 ----
- case LONG:
- case BELONG:
- case LELONG:
- + #ifdef OS2 /* bugfix, not OS/2-specific (?) */
- + /* strtol() in EMX/gcc and MSC lib returns LONG_MAX on overflow.
- + Use strtoul() or the supplied localsrc/strtol.c. */
- + slen = (**p == '-') ? (-1) : (1);
- + if (**p == '-' || **p == '+')
- + *p++;
- + m->value.l = (long) strtoul(*p, p, 0) * slen;
- + #else
- m->value.l = (long) strtol(*p,p,0);
- + #endif
- break;
- default:
- magwarn("can't happen: m->type=%d\n", m->type);
- Only in src: apptype.c
- diff -cr old/ascmagic.c src/ascmagic.c
- *** old/ascmagic.c Thu Aug 05 16:20:40 1993
- --- src/ascmagic.c Mon Apr 05 19:55:30 1993
- ***************
- *** 30,36 ****
- --- 30,38 ----
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- + #ifndef MSC
- #include <unistd.h>
- + #endif
- #include "file.h"
- #include "names.h"
-
- ***************
- *** 79,86 ****
- --- 81,93 ----
-
- /* look for tokens from names.h - this is expensive! */
- /* make a copy of the buffer here because strtok() will destroy it */
- + #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
- while ((token = strtok((char*)s, " \t\n\r\f")) != NULL) {
- s = NULL; /* make strtok() keep on tokin' */
- for (p = names; p < names + NNAMES; p++) {
- diff -cr old/compress.c src/compress.c
- *** old/compress.c Thu Aug 05 16:20:40 1993
- --- src/compress.c Thu Apr 08 18:38:30 1993
- ***************
- *** 6,14 ****
- --- 6,22 ----
- */
- #include <stdio.h>
- #include <stdlib.h>
- + #ifndef MSC
- #include <unistd.h>
- + #endif
- #include <string.h>
- + #ifdef OS2
- + #include <fcntl.h>
- + #include <io.h>
- + #include <process.h>
- + #else
- #include <sys/wait.h>
- + #endif
-
- #include "file.h"
-
- ***************
- *** 30,35 ****
- --- 38,44 ----
- return *(p+2) & 0x1f;
- }
-
- +
- int
- uncompress(old, newch, n)
- const unsigned char *old;
- ***************
- *** 36,41 ****
- --- 45,101 ----
- unsigned char **newch;
- int n;
- {
- + #ifdef NO_PIPE /* Use tempnam() */
- +
- + FILE *fp;
- + char *tempname, filename[_MAX_PATH];
- + int p;
- +
- + if ((tempname = tempnam("./", "tmp")) == NULL) {
- + error("cannot create temporary file (%s).\n", strerror(errno));
- + /*NOTREACHED*/
- + }
- + /* uncompress needs ".Z"; new filename must not exist */
- + sprintf(filename, "%s.Z", tempname);
- + if (access(filename, 0) == 0 || (fp = fopen(filename, "wb")) == NULL)
- + error("cannot open tmp file %s (%s).\n", filename, strerror(errno));
- +
- + if (fwrite(old, 1, n, fp) != n) {
- + error("write failed (%s).\n", strerror(errno));
- + /*NOTREACHED*/
- + }
- + (void) fclose(fp);
- +
- + /* It appears that DOS wants "compress -d", not argv[0]=uncompress */
- + if (p = spawnlp(P_WAIT, "compress", "compress", "-d", filename, NULL)) {
- + unlink(filename);
- + if (p == -1)
- + error("could not execute `uncompress' (%s).\n", strerror(errno));
- + else
- + error("uncompress has failed on `%s'.\n", filename);
- + }
- + if ((*newch = (unsigned char *) malloc(n)) == NULL) {
- + error("out of memory.\n");
- + /*NOTREACHED*/
- + }
- + if ((fp = fopen(tempname, "rb")) == NULL) {
- + error("cannot open tmp file %s (%s).\n", tempname, strerror(errno));
- + /*NOTREACHED*/
- + }
- + if ((n = fread(*newch, 1, n, fp)) == 0) {
- + free(*newch);
- + error("read failed (%s).\n", strerror(errno));
- + /*NOTREACHED*/
- + }
- + fclose(fp);
- + unlink(tempname);
- + free(tempname);
- + return n;
- +
- + #else
- +
- + #ifdef USE_FORK
- +
- int fdin[2], fdout[2];
-
- if (pipe(fdin) == -1 || pipe(fdout) == -1) {
- ***************
- *** 83,86 ****
- --- 143,206 ----
- (void) wait(NULL);
- return n;
- }
- +
- + #else
- +
- + int fdin[2], fdout[2];
- + int handle[3], i, p;
- +
- + #ifdef MSC
- + #define pipe(handles) _pipe(handles, 1024, O_BINARY)
- + #endif
- +
- + if (pipe(fdin) == -1 || pipe(fdout) == -1) {
- + error("cannot create pipe (%s).\n", strerror(errno));
- + /*NOTREACHED*/
- + }
- + #ifdef OS2
- + setmode(fdin[1], O_BINARY);
- + setmode(fdout[0], O_BINARY);
- + #endif
- +
- + if (write(fdin[1], old, n) != n) {
- + error("write failed (%s).\n", strerror(errno));
- + /*NOTREACHED*/
- + }
- + (void) close(fdin[1]);
- +
- + for (i = 0; i <= 2; i++)
- + handle[i] = dup(i);
- + dup2(fdin[0], 0);
- + dup2(fdout[1], 1);
- + dup2(fdout[1], 2);
- + close(fdin[0]); close(fdout[1]);
- +
- + p = spawnlp(P_NOWAIT, "compress", "uncompress", "-c", NULL);
- + for (i = 0; i <= 2; i++) {
- + dup2(handle[i], i); close(handle[i]);
- + }
- + if (p == -1)
- + error("could not execute `uncompress' (%s).\n", strerror(errno));
- +
- + if ((*newch = (unsigned char *) malloc(n)) == NULL) {
- + error("out of memory.\n");
- + /*NOTREACHED*/
- + }
- + if ((n = read(fdout[0], *newch, n)) <= 0) {
- + free(*newch);
- + error("read failed (%s).\n", strerror(errno));
- + /*NOTREACHED*/
- + }
- + #ifdef MSC /* Clear the pipe. There must be a better way... */
- + {
- + char buf[256];
- + while (read(fdout[0], buf, 256) > 0 )
- + ;
- + }
- + #endif
- + (void) close(fdout[0]);
- + (void) wait(NULL);
- + return n;
- + #endif
- + #endif
- }
- Only in src: fapptyp.h
- Only in src: file-32.def
- Only in old: file.1
- diff -cr old/file.c src/file.c
- *** old/file.c Thu Aug 05 16:20:42 1993
- --- src/file.c Fri Jul 30 14:55:20 1993
- ***************
- *** 33,43 ****
- --- 33,52 ----
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- + #ifndef MSC
- #include <sys/param.h> /* for MAXPATHLEN */
- + #endif
- #include <sys/stat.h>
- #include <fcntl.h> /* for open() */
- + #ifdef OS2
- + #include <io.h>
- + #include <sys/utime.h>
- + #else
- #include <utime.h>
- + #endif
- + #ifndef MSC
- #include <unistd.h> /* for read() */
- + #endif
-
- #include "file.h"
-
- ***************
- *** 79,89 ****
- --- 88,109 ----
- {
- int c;
- int check = 0, didsomefiles = 0, errflg = 0, ret = 0;
- + #ifdef OS2
- + char path[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR], *p;
- + #endif
- +
- + #ifdef EMX
- + _wildcard(&argc, &argv);
- + #endif
-
- + #ifdef OS2
- + progname = _getname(argv[0]);
- + #else
- if ((progname = strrchr(argv[0], '/')) != NULL)
- progname++;
- else
- progname = argv[0];
- + #endif
-
- while ((c = getopt(argc, argv, "cdf:Lm:z")) != EOF)
- switch (c) {
- ***************
- *** 118,128 ****
- --- 138,168 ----
- exit(2);
- }
-
- + #ifdef OS2
- + if (access(magicfile, 4)) {
- + _splitpath(argv[0], drive, dir, NULL, NULL); /* Try dir of exe */
- + sprintf(path, "%s%s%s", drive, dir, p = _getname(magicfile));
- + if (access(path, 4)) {
- + _searchenv(p, "PATH", path); /* next, try PATH */
- + if (*path == '\0')
- + _searchenv(p, "DPATH", path); /* finally, try DPATH */
- + }
- + if (*path)
- + magicfile = path;
- + }
- + #endif
- +
- ret = apprentice(magicfile, check);
- if (check)
- exit(ret);
-
- if (optind == argc) {
- + #ifdef OS2
- + if (!isatty(fileno(stdin))) { /* Do stdin */
- + process("-", 1);
- + ++didsomefiles;
- + }
- + #endif
- if (!didsomefiles) {
- (void)fprintf(stderr, USAGE, progname);
- exit(2);
- ***************
- *** 176,181 ****
- --- 216,225 ----
- }
-
-
- + #ifdef OS2
- + static const char *apptypeName;
- + #endif
- +
- /*
- * process - process input file
- */
- ***************
- *** 191,196 ****
- --- 235,244 ----
- struct stat sb;
- int nbytes = 0; /* number of bytes read from a datafile */
-
- + #ifdef OS2
- + apptypeName = inname;
- + #endif
- +
- if (strcmp("-", inname) == 0) {
- if (fstat(0, &sb)<0) {
- error("cannot fstat `%s' (%s).\n", stdname,
- ***************
- *** 198,203 ****
- --- 246,256 ----
- /*NOTREACHED*/
- }
- inname = stdname;
- + #ifdef OS2
- + if (wid < strlen(inname)) /* bugfix (?), not OS/2-specific */
- + wid = strlen(inname);
- + apptypeName = NULL;
- + #endif
- }
-
- if (wid > 0)
- ***************
- *** 222,227 ****
- --- 275,283 ----
- }
- }
-
- + #ifdef OS2
- + setmode(fd, O_BINARY);
- + #endif
-
- /*
- * try looking at the first HOWMANY bytes
- ***************
- *** 244,251 ****
- --- 300,312 ----
- */
- utbuf.actime = sb.st_atime;
- utbuf.modtime = sb.st_mtime;
- + #ifdef OS2 /* OS/2 wants file closed before utime. MSC utime is broken. */
- + close(fd);
- + (void) utime((char *) inname, &utbuf); /* don't care if loses */
- + #else
- (void) utime(inname, &utbuf); /* don't care if loses */
- (void) close(fd);
- + #endif
- }
- (void) putchar('\n');
- }
- ***************
- *** 256,261 ****
- --- 317,331 ----
- unsigned char *buf;
- int nb;
- {
- + #ifdef OS2
- + /*
- + * try DosQueryAppType tests; best chances with complete file
- + */
- + const char *p = apptypeName;
- + apptypeName = NULL;
- + if (apptype(p, buf, nb) != 1)
- + #endif
- +
- /*
- * try tests in /etc/magic (or surrogate magic file)
- */
- Only in src: file.def
- diff -cr old/file.h src/file.h
- *** old/file.h Thu Aug 05 16:20:44 1993
- --- src/file.h Wed Apr 07 21:50:42 1993
- ***************
- *** 27,33 ****
- --- 27,38 ----
- */
-
- #define HOWMANY 1024 /* how much of the file to look at */
- + #ifdef MSC /* 16-bit int */
- + #define MAXMAGIC (0xff00 / sizeof(struct magic)) /* max entries in magicfile */
- + #define MAXMAGIS MAXMAGIC /* initial allocation */
- + #else
- #define MAXMAGIS 1000 /* max entries in /etc/magic */
- + #endif
- #define MAXDESC 50 /* max leng of text description */
- #define MAXstring 32 /* max leng of "string" types */
-
- ***************
- *** 65,71 ****
- --- 70,80 ----
- } value; /* either number or string */
- long mask; /* mask before comparison with value */
- char nospflag; /* supress space character */
- + #ifdef OS2
- + char *desc; /* description */
- + #else
- char desc[MAXDESC]; /* description */
- + #endif
- };
-
- #include <stdio.h> /* Include that here, to make sure __P gets defined */
- ***************
- *** 97,104 ****
- extern void ckfprintf __P((FILE *, const char *, ...));
-
-
- !
- extern int errno; /* Some unixes don't define this.. */
-
- extern char *progname; /* the program name */
- extern char *magicfile; /* name of the magic file */
- --- 106,114 ----
- extern void ckfprintf __P((FILE *, const char *, ...));
-
-
- ! #ifndef OS2
- extern int errno; /* Some unixes don't define this.. */
- + #endif
-
- extern char *progname; /* the program name */
- extern char *magicfile; /* name of the magic file */
- ***************
- *** 123,127 ****
- --- 133,145 ----
- #endif
-
- #ifndef MAXPATHLEN
- + #ifdef OS2
- + #define MAXPATHLEN _MAX_PATH
- + #else
- #define MAXPATHLEN 512
- + #endif
- + #endif
- +
- + #ifdef MSC
- + char *_getname(char *);
- #endif
- diff -cr old/fsmagic.c src/fsmagic.c
- *** old/fsmagic.c Thu Aug 05 16:20:44 1993
- --- src/fsmagic.c Mon Apr 05 22:03:52 1993
- ***************
- *** 29,39 ****
- --- 29,46 ----
- #include <string.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- + #ifndef MSC
- #include <unistd.h>
- + #endif
- #include <stdlib.h>
- #ifndef major /* if `major' not defined in types.h, */
- + #ifdef OS2 /* These will always return 0 in EMX */
- + #define major(x) ((int) x & 0xffff) /* will return driver in MSC */
- + #define minor(x) ((int) x >> 16)
- + #else
- #include <sys/sysmacros.h> /* try this one. */
- #endif
- + #endif
- #ifndef major /* still not defined? give up, manual intervention needed */
- /* If cc tries to compile this, read and act on it. */
- /* On most systems cpp will discard it automatically */
- ***************
- *** 49,54 ****
- --- 56,81 ----
- "@(#)$Id: fsmagic.c,v 1.22 93/02/19 12:09:04 ian Exp $";
- #endif /* lint */
-
- +
- + #ifdef MSC /* MSC stat() is broken on directories ending with '/' */
- + int Stat(fn, sb)
- + const char *fn;
- + struct stat *sb;
- + {
- + char path[_MAX_PATH], dir[_MAX_DIR], fname[_MAX_FNAME];
- + char *p;
- +
- + strcpy(path, fn);
- + _splitpath(path, NULL, dir, fname, NULL);
- + if (*fname == '\0')
- + if (strlen(dir) > 1)
- + if ( *(p = path + strlen(path) -1) == '/' || *p == '\\')
- + *p = '\0';
- + return(stat(path, sb));
- + }
- + #endif
- +
- +
- int
- fsmagic(fn, sb)
- const char *fn;
- ***************
- *** 65,71 ****
- --- 92,102 ----
- ret = lstat(fn, sb);
- else
- #endif
- + #ifdef MSC
- + ret = Stat(fn, sb); /* don't merge into if; see "ret =" above */
- + #else
- ret = stat(fn, sb); /* don't merge into if; see "ret =" above */
- + #endif
-
- if (ret) {
- ckfprintf(stdout,
- ***************
- *** 75,83 ****
- --- 106,116 ----
- return 1;
- }
-
- + #ifdef S_ISUID
- if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout);
- if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout);
- if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout);
- + #endif
-
- switch (sb->st_mode & S_IFMT) {
- case S_IFDIR:
- ***************
- *** 87,96 ****
- --- 120,131 ----
- (void) printf("character special (%d/%d)",
- major(sb->st_rdev), minor(sb->st_rdev));
- return 1;
- + #ifdef S_IFBLK
- case S_IFBLK:
- (void) printf("block special (%d/%d)",
- major(sb->st_rdev), minor(sb->st_rdev));
- return 1;
- + #endif
- /* TODO add code to handle V7 MUX and Blit MUX files */
- #ifdef S_IFIFO
- case S_IFIFO:
- diff -cr old/localsrc/strtol.c src/localsrc/strtol.c
- *** old/localsrc/strtol.c Thu Aug 05 16:20:46 1993
- --- src/localsrc/strtol.c Sat Apr 10 18:51:14 1993
- ***************
- *** 16,22 ****
- char *s, **p;
- int b;
- {
- ! int base = 10, n = 0, sign = 1, valid = 1;
-
- /*
- * leading sign?
- --- 16,23 ----
- char *s, **p;
- int b;
- {
- ! int base = 10, sign = 1, valid = 1;
- ! long n = 0;
-
- /*
- * leading sign?
- diff -cr old/Magdir/ar src/Magdir/ar
- *** old/Magdir/ar Thu Aug 05 16:20:46 1993
- --- src/Magdir/ar Sun Aug 01 09:51:34 1993
- ***************
- *** 55,66 ****
- #
- 0 string -h- Software Tools format archive text
- # "arc" archiver
- ! 0 byte 26 'arc' archive
- ! >1 byte 0 (empty)
- ! >1 byte 1 (old format)
- ! # Rahul Dhesi's zoo archive format, from keith@cerberus.uchicago.edu.
- ! 20 long 0xdca7c4fd Rahul Dhesi's "zoo" archive
- ! # ZIP archiver
- ! 0 string PK zip archive file
- ! >2 byte >0 - version [%d
- ! >3 byte >0 %d]
- --- 55,154 ----
- #
- 0 string -h- Software Tools format archive text
- # "arc" archiver
- ! #0 byte 26 'arc' archive
- ! #>1 byte 0 (empty)
- ! #>1 byte 1 (old format)
- ! #
- ! # >>>>> ARJ archiver <<<<< (source: arj 2.39a beta)
- ! # ARJ archives contains two types of header blocks:
- ! #
- ! # Archive main header - This is located at the head of the archive
- ! # Local file header - This is located before each archived file
- ! #
- ! # Structure of main header (low order byte first):
- ! #
- ! # Bytes Description
- ! # ----- -------------------------------------------------------------------
- ! # 2 header id (main and local file) = 0xEA60 or 60000U
- ! # 2 basic header size (from 'first_hdr_size' thru 'comment' below)
- ! # = first_hdr_size + strlen(filename) + 1 + strlen(comment) + 1
- ! # = 0 if end of archive
- ! #
- ! # 1 first_hdr_size (size up to and including 'extra data')
- ! # 1 archiver version number [2.30==v4 ? 2.39==v5 ?]
- ! # 1 minimum archiver version to extract
- ! # 1 host OS (0 = MSDOS, 1 = PRIMOS, 2 = UNIX, 3 = AMIGA, 4 = MAC-OS)
- ! # (5 = OS/2, 6 = APPLE GS, 7 = ATARI ST, 8 = NEXT)
- ! # (9 = VAX VMS)
- ! # [text deleted]
- ! 0 short 0xea60 arj archive
- ! #
- ! # >>>>> ARC <<<<< (source: Greg Roelofs roe2@midway.uchicago.edu)
- ! #
- ! 0 string \032\010 Arc archive
- ! # 0 short 0x1a08 Arc archive
- ! # 0 short 0x081a Arc archive
- ! #
- ! # >>>>> LHARC/LHA <<<<< (source: Greg Roelofs roe2@midway.uchicago.edu)
- ! #
- ! 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 <<<<< (source: Greg Roelofs roe2@midway.uchicago.edu)
- ! # [extract ver is from 1st file only]
- ! #
- ! 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)
- ! #
- ! # >>>>> ZOO <<<<< (source: Greg Roelofs roe2@midway.uchicago.edu)
- ! #
- ! # [GRR: don't know if all of these versions exist, or if some missing...]
- ! #0 string ZOO Zoo archive
- ! # [DH: Use GRR's alternate identifiers]
- ! 0x2a string \xdc\xa7\xc4\xfd
- ! >0 string >0 %.16s
- ! # >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)
- ! >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+)
- ! 0 string ZOO Zoo archive
- ! # [GRR: the following are alternate identifiers]
- ! #0x2a long 0xdca7c4fd Zoo archive
- ! #0x2a long 0xc4fddca7 Zoo archive
- ! #
- ! # >>>>> HPACK <<<<< (source: Peter Gutmann pgut1@cs.aukuni.ac.nz)
- ! # Here's the entry from the local magic file - it's for Ultrix, the format
- ! # may not be 100% the same as everyone else's. Basically the ID bytes are a
- ! # 4-byte string 'HPAK' at the start. Anything after that is indeterminate,
- ! # since for example if the archive is encrypted the entire thing will be one
- ! # big block of white noise - it's only the 4-byte ID you can rely on 100%.
- ! # Once the ISO approves ISO 8824 and 8825 I'll use that format, which will
- ! # provide a lot more information, but that will probably still take awhile....
- ! # 4 string HPAK 1,1 HPACK archive
- ! 0 string HPAK HPACK archive
- Only in old/Magdir: ar.orig
- diff -cr old/Magdir/audio src/Magdir/audio
- *** old/Magdir/audio Mon Apr 05 14:39:32 1993
- --- src/Magdir/audio Wed Aug 04 19:56:48 1993
- ***************
- *** 25,27 ****
- --- 25,33 ----
- >19 string L and a EL hash tabl
- >19 string B and a EB hash tabl
- >22 string X -- out of date
- +
- + # sound files from OS/2 (these are guesses)
- + 0 string RIFF
- + >8 string WAVE sound
- + 0 string MThd\0 MIDI sound
- +
- diff -cr old/Magdir/commands src/Magdir/commands
- *** old/Magdir/commands Mon Apr 05 14:39:38 1993
- --- src/Magdir/commands Sat Jul 31 08:37:10 1993
- ***************
- *** 15,22 ****
- 0 string #!\ /usr/local/tcsh Tenex C Shell script text
- 0 string #!/usr/local/bin/tcsh Tenex C Shell script text
- 0 string #!\ /usr/local/bin/tcsh Tenex C Shell script text
- ! 0 string #!/bin/awk Awk Commands text
- ! 0 string #!\ /bin/awk Awk Commands text
- 0 string #!\ / a
- >3 string >\0 %s script
- 0 string #!/ a
- --- 15,28 ----
- 0 string #!\ /usr/local/tcsh Tenex C Shell script text
- 0 string #!/usr/local/bin/tcsh Tenex C Shell script text
- 0 string #!\ /usr/local/bin/tcsh Tenex C Shell script text
- ! 0 string #!/bin/zsh Z Shell script text
- ! 0 string #!\ /bin/zsh Z Shell script text
- ! 0 string #!/bin/awk Awk commands text
- ! 0 string #!\ /bin/awk Awk commands text
- ! 0 string #!/bin/nawk new Awk commands text
- ! 0 string #!\ /bin/nawk new Awk commands text
- ! 0 string #!/bin/gawk GNU Awk commands text
- ! 0 string #!\ /bin/gawk GNU Awk commands text
- 0 string #!\ / a
- >3 string >\0 %s script
- 0 string #!/ a
- ***************
- *** 30,32 ****
- --- 36,45 ----
- 0 string #!/bin/perl perl commands text
- 0 string #!\ /bin/perl perl commands text
- 0 string eval\ "exec\ /bin/perl perl commands text
- +
- + # OS/2 EXTPROC uses specified program to process script
- + #
- + 0 string EXTPROC OS/2 ExtProc commands text
- + >8 string >\0 for %s
- + 0 string extproc OS/2 ExtProc commands text
- + >8 string >\0 for %s
- diff -cr old/Magdir/compress src/Magdir/compress
- *** old/Magdir/compress Mon Apr 05 14:39:38 1993
- --- src/Magdir/compress Fri Jul 30 14:45:00 1993
- ***************
- *** 46,52 ****
- >3 byte &0x10 encrypted,
- >4 date x last modified: %s,
- >8 byte x extra-flags: %x,
- ! >9 byte =0x00 os: MS/DOS
- >9 byte =0x01 os: Amiga
- >9 byte =0x02 os: VMS
- >9 byte =0x03 os: Unix
- --- 46,52 ----
- >3 byte &0x10 encrypted,
- >4 date x last modified: %s,
- >8 byte x extra-flags: %x,
- ! >9 byte =0x00 os: DOS
- >9 byte =0x01 os: Amiga
- >9 byte =0x02 os: VMS
- >9 byte =0x03 os: Unix
- ***************
- *** 53,57 ****
- >9 byte =0x05 os: Atari
- >9 byte =0x06 os: OS/2
- >9 byte =0x07 os: MacOS
- ! >9 byte =0x0A os: Tops/20
- >9 byte =0x0B os: Win/32
- --- 53,57 ----
- >9 byte =0x05 os: Atari
- >9 byte =0x06 os: OS/2
- >9 byte =0x07 os: MacOS
- ! >9 byte =0x0A os: TOPS-20
- >9 byte =0x0B os: Win/32
- Only in src/Magdir: emacs
- diff -cr old/Magdir/images src/Magdir/images
- *** old/Magdir/images Thu Aug 05 16:20:46 1993
- --- src/Magdir/images Wed Aug 04 19:56:54 1993
- ***************
- *** 26,33 ****
-
- # GIF
- 0 string GIF GIF picture
- ! >3 string 87a - version %s
- ! >3 string 89a - version %s
- >6 short >0 %d x
- >8 short >0 %d,
- >10 byte &0x40 interlaced,
- --- 26,33 ----
-
- # GIF
- 0 string GIF GIF picture
- ! >3 string 87a - version %.3s
- ! >3 string 89a - version %.3s
- >6 short >0 %d x
- >8 short >0 %d,
- >10 byte &0x40 interlaced,
- ***************
- *** 52,56 ****
- 0 string GKSM GKS Metafile
- 8 string ILBM IFF ILBM file
- 0 string yz MGR bitmap
- - 6 string JFIF JPEG picture
- 0 string ARF_BEGARF PHIGS clear text archive
- --- 52,85 ----
- 0 string GKSM GKS Metafile
- 8 string ILBM IFF ILBM file
- 0 string yz MGR bitmap
- 0 string ARF_BEGARF PHIGS clear text archive
- + 0 string \0\0\1\263 MPEG Paris
- + # PCX formats (source: Selke's filetype program, 1991)
- + 0 string \x0A\x00 PCX image (Paintbrush version 2.5)
- + 0 string \x0A\x02 PCX image (Paintbrush version 2.8, with palette)
- + 0 string \x0A\x03 PCX image (Paintbrush version 2.8, without palette)
- + 0 string \x0A\x05 PCX image (Paintbrush version 3.0)
- + # JPEG (source: Cameron Simpson cameron@cs.unsw.oz.au,
- + # John Adams J.Adams@ucl.ac.uk)
- + 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
- + #
- + # >>>>> BMP, etc. <<<<< (source: Greg Roelofs roe2@midway.uchicago.edu)
- + # [GRR: The >14 entries should really be strings of length four]
- + #
- + 0 string BM bitmap
- + >14 byte 12 (OS/2 1.x format)
- + >14 byte 64 (OS/2 2.x format)
- + >14 byte 40 (Windows 3.x format)
- + # [GRR says the following are untested]
- + 0 string IC icon
- + 0 string PI pointer
- + 0 string CI color icon
- + 0 string CP color pointer
- + 0 string BA bitmap array
- +
- + # movie files from OS/2 (these are guesses)
- + 0 string RIFF
- + >8 string AVI movie
- Only in old/Magdir: images.orig
- diff -cr old/Magdir/ispell src/Magdir/ispell
- *** old/Magdir/ispell Mon Apr 05 14:39:58 1993
- --- src/Magdir/ispell Wed Aug 04 20:28:20 1993
- ***************
- *** 3,9 ****
- #
- # XXX - byte order?
- #
- ! 0 short 0xffff9601 ispell hash file
- >2 short 0x00 - 8-bit, no capitalization, 26 flags
- >2 short 0x01 - 7-bit, no capitalization, 26 flags
- >2 short 0x02 - 8-bit, capitalization, 26 flags
- --- 3,10 ----
- #
- # XXX - byte order?
- #
- ! #0 short 0xffff9601 ispell hash file
- ! 0 short 0x9601 ispell hash file
- >2 short 0x00 - 8-bit, no capitalization, 26 flags
- >2 short 0x01 - 7-bit, no capitalization, 26 flags
- >2 short 0x02 - 8-bit, capitalization, 26 flags
- diff -cr old/Magdir/Makefile src/Magdir/Makefile
- *** old/Magdir/Makefile Thu Aug 05 16:20:48 1993
- --- src/Magdir/Makefile Thu Apr 08 19:32:12 1993
- ***************
- *** 1,16 ****
- ! #
- ! # Makefile for /etc/magic file for Ian Darwin's file(1) command.
- ! # Copyright (c) 1989 Ian F. Darwin, Toronto, Canada.
- ! # $Id: Makefile,v 1.8 93/01/05 13:22:31 ian Exp $
- ! #
- ! #
- SHELL = /bin/sh
- HEADER = Header
- LOCALSTUFF = Localstuff
-
- ! ALL = $(HEADER) $(LOCALSTUFF) [a-z]*
-
- install: ../magic
- ../magic: $(ALL)
- ! echo "# Magic file created `date` by `who am i`" > $@
- cat $(ALL) >> $@
- --- 1,12 ----
- ! # Makefile for OS/2 and dmake 3.8, adapted from the supplied Makefile.
- !
- SHELL = /bin/sh
- HEADER = Header
- LOCALSTUFF = Localstuff
-
- ! ALL = $(HEADER) $(LOCALSTUFF) $(shell ls [a-z]*)
-
- install: ../magic
- ../magic: $(ALL)
- ! echo "# Magic file created `date` by `whoami`" > $@
- cat $(ALL) >> $@
- Only in src/Magdir: Makefile.orig
- diff -cr old/Magdir/ms-dos src/Magdir/ms-dos
- *** old/Magdir/ms-dos Mon Apr 05 14:40:08 1993
- --- src/Magdir/ms-dos Wed Aug 04 17:36:22 1993
- ***************
- *** 1,8 ****
- #
- ! # Various MS-DOS magic numbers
- #
- ! 0 string MZ DOS executable (EXE)
- ! 0 string LZ DOS executable (built-in)
- ! 0 byte 0xe9 DOS executable (COM)
- ! 0 byte 0xeb DOS executable (COM)
- ! 0 byte 0xf0 MS-DOS program library
- --- 1,29 ----
- #
- ! # Various MS-DOS (and OS/2) magic numbers
- #
- ! # Contributions: Jouni Miettunen jon@stekt.oulu.fi
- ! # Greg Roelofs roe2@midway.uchicago.edu
- ! # Darrel Hankerson hankedr@mail.auburn.edu
- ! #
- ! 0 string MZ DOS executable
- ! >24 string @ (OS/2 or Windows format)
- ! # DH: OS/2 lh 2.22
- ! >>0xe7 string LH/2\ Self-Extract (%s)
- ! # DH: OS/2 PKZip 1.01
- ! >>0xe9 string PKSFX2 (%s)
- ! >0x19 string \x0\x0\x0LZ91 (lzexe compressed)
- ! >0x1c string RJSX\xff\xff (ARJ SFX)
- ! >0x1c string diet\xf9\x9c (diet compressed)
- ! >0x1e string Copyright\ 1989-1990\ PKWARE\ Inc. (PKSFX)
- ! # JM: 0x1e "PKLITE Copr. 1990-92 PKWARE Inc. All Rights Reserved\7\0\0\0"
- ! >0x1e string PKLITE\ Copr. (%.6s compressed)
- ! >0x24 string LHa's\ SFX (%.15s)
- ! >0x24 string LHA's\ SFX (%.15s)
- ! 0 string LZ DOS executable (built-in)
- ! 0 byte 0xe9 DOS executable (COM)
- ! >6 string SFX\ of\ LHarc (%s)
- ! 0 byte 0xeb DOS executable (COM)
- ! 0 byte 0xf0 MS-DOS program library
- !
- ! 0 string ?_\3\0 Windows HLP
- !
- Only in src/Magdir: os2
- diff -cr old/Magdir/psdbms src/Magdir/psdbms
- *** old/Magdir/psdbms Mon Apr 05 14:40:16 1993
- --- src/Magdir/psdbms Wed Aug 04 20:16:52 1993
- ***************
- *** 1,6 ****
- #
- # magic.ps: psdatabase magic
- #
- ! 0 byte 0126 ps database
- ! >1 string >\0 - version %s
- ! >4 string >\0 from kernel %s
- --- 1,6 ----
- #
- # magic.ps: psdatabase magic
- #
- ! #0 byte 0126 ps database
- ! #>1 string >\0 - version %s
- ! #>4 string >\0 from kernel %s
- diff -cr old/Magdir/tex src/Magdir/tex
- *** old/Magdir/tex Thu Aug 05 16:20:48 1993
- --- src/Magdir/tex Sat Jul 31 19:50:04 1993
- ***************
- *** 3,11 ****
- #
- # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
- #
- ! 0 short 0173402 DVI File
- ! >16 string >\0 (%s)
- ! 0 short 0173531 Packed TeX Font
- ! >4 string >\0 (%s)
- ! 2 string \000\022 Metafont Font Metric
- ! >34 string >\0 (%s)
- --- 3,27 ----
- #
- # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
- #
- ! #0 short 0173402 DVI File
- ! 0 string \xf7\x02\x01\x83 DVI
- ! >16 string >\0 (%s)
- ! # PK files and font lib entries from dvips
- ! 0 string \xf7\x59 TeX PK
- ! >3 string >\0 (%s)
- ! # font lib has string length (short) preceding comment
- ! 0 string FLIB\2\0 emTeX font lib
- ! >12 short >0
- ! >>14 string >\0 (%s)
- ! 0 short 0173531 Packed TeX Font
- ! >4 string >\0 (%s)
- ! 2 string \000\022 Metafont Font Metric
- ! >33 string >\0 (%s)
- ! # TeX vf entries from dvips: pre,id,len. String need not be asciiz.
- ! 0 string \xf7\xca TeX vf
- ! >3 string >\0 (%s)
- ! #
- ! 0 string This\ is\ Info\ file TeX Info text
- ! >18 string >\0 (%s)
- ! 0 string Info\ file TeX Info text
- ! >10 string >\0 (%s)
- Only in old/Magdir: tex.orig
- diff -cr old/Magdir/uuencode src/Magdir/uuencode
- *** old/Magdir/uuencode Mon Apr 05 14:40:30 1993
- --- src/Magdir/uuencode Sun Aug 01 10:27:18 1993
- ***************
- *** 1,3 ****
- --- 1,9 ----
- 0 string begin uuencoded mail text
- # Btoa(1) is an alternative to uuencode that requires less space.
- 0 string xbtoa\ Begin btoa'd text
- + # ship is used by INFO-Zip
- + 0 string $\015\012ship ship mail text
- + >8 string >\0 (%s)
- + 0 string $\012ship ship mail text
- + >7 string >\0 (%s)
- +
- Only in old: magic
- Only in old: magic.4
- Only in src: Makefile.os2
- Only in src: notes.os2
- Only in src: notes2.os2
- diff -cr old/print.c src/print.c
- *** old/print.c Thu Aug 05 16:20:50 1993
- --- src/print.c Fri Jul 30 14:57:42 1993
- ***************
- *** 34,40 ****
- --- 34,42 ----
- # include <varargs.h>
- #endif
- #include <stdlib.h>
- + #ifndef MSC
- #include <unistd.h>
- + #endif
- #include "file.h"
-
- #ifndef lint
- ***************
- *** 52,66 ****
- "long", "string", "date", "beshort",
- "belong", "bedate", "leshort", "lelong",
- "ledate" };
- (void) fprintf(stderr, "[%s,%d,%s,%s%c,",
- (m->flag >= 0 && m->flag < 4 ? offs[m->flag]: "*bad*"),
- m->offset,
- ! (m->type >= 0 && m->type < 7 ?
- typ[(unsigned char) m->type] : "*bad*"),
- m->reln & MASK ? "&" : "",
- m->reln & ~MASK);
- ! if (m->flag & INDIR)
- (void) fprintf(stderr, "(%s,%d)",
- (m->in.type >= 0 &&
- m->in.type < 6 ? typ[(unsigned char) m->in.type] : "*bad*"),
- m->in.offset);
- --- 54,81 ----
- "long", "string", "date", "beshort",
- "belong", "bedate", "leshort", "lelong",
- "ledate" };
- + #ifdef MSC
- + (void) fprintf(stderr, "[%s,%ld,%s,%s%c,",
- + #else
- (void) fprintf(stderr, "[%s,%d,%s,%s%c,",
- + #endif
- (m->flag >= 0 && m->flag < 4 ? offs[m->flag]: "*bad*"),
- m->offset,
- ! #ifdef OS2 /* bugfix, not OS/2 specific */
- ! (m->type >= 0 && m->type < sizeof(typ)/sizeof(typ[0]) ?
- ! #else
- ! (m->type >= 0 && m->type < 7 ?
- ! #endif
- typ[(unsigned char) m->type] : "*bad*"),
- m->reln & MASK ? "&" : "",
- m->reln & ~MASK);
- !
- ! if (m->flag & INDIR)
- ! #ifdef MSC
- ! (void) fprintf(stderr, "(%s,%ld)",
- ! #else
- (void) fprintf(stderr, "(%s,%d)",
- + #endif
- (m->in.type >= 0 &&
- m->in.type < 6 ? typ[(unsigned char) m->in.type] : "*bad*"),
- m->in.offset);
- diff -cr old/softmagic.c src/softmagic.c
- *** old/softmagic.c Thu Aug 05 16:20:50 1993
- --- src/softmagic.c Fri Jul 30 15:18:16 1993
- ***************
- *** 162,174 ****
- return 0; /* no match at all */
- }
-
- static void
- mprint(m, s)
- struct magic *m;
- unsigned char *s;
- {
- register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset);
- ! char *pp, *rt;
-
- switch (m->type) {
- case BYTE:
- --- 162,196 ----
- return 0; /* no match at all */
- }
-
- + #ifdef OS2
- static void
- + printf_eol(fmt, str)
- + char *fmt, *str;
- + {
- + char *rt, *nl;
- +
- + if ((nl = strchr(str, '\n')) != NULL)
- + *nl = '\0';
- + if ((rt = strrchr(str, '\r')) != NULL)
- + *rt = '\0';
- + (void) printf(fmt, str);
- + if (rt)
- + *rt = '\r';
- + if (nl)
- + *nl = '\n';
- + }
- + #endif
- +
- + static void
- mprint(m, s)
- struct magic *m;
- unsigned char *s;
- {
- register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset);
- ! char *pp;
- ! #ifndef OS2
- ! char *rt;
- ! #endif
-
- switch (m->type) {
- case BYTE:
- ***************
- *** 188,208 ****
- --- 210,238 ----
- (m->reln & MASK) ? p->l & m->mask : p->l);
- break;
- case STRING:
- + #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
- break;
- case DATE:
- case BEDATE:
- case LEDATE:
- pp = ctime((time_t*) &p->l);
- + #ifdef OS2 /* handle both "\r\n" and "\n" */
- + (void) printf_eol(m->desc, pp);
- + #else
- if ((rt = strchr(pp, '\n')) != NULL)
- *rt = '\0';
- (void) printf(m->desc, pp);
- if (rt)
- *rt = '\n';
- + #endif
- break;
- default:
- error("invalid m->type (%d) in mprint().\n", m->type);
- ***************
- *** 262,268 ****
- --- 292,302 ----
- case BELONG:
- case BEDATE:
- v = (long)
- + #ifdef MSC /* bugfix, required for 16-bit int */
- + (((long) p->hl[0]<<24)|((long) p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3]));
- + #else
- ((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3]));
- + #endif
- break;
- case LESHORT:
- v = (short)((p->hs[1]<<8)|(p->hs[0]));
- ***************
- *** 270,276 ****
- --- 304,314 ----
- case LELONG:
- case LEDATE:
- v = (long)
- + #ifdef MSC /* bugfix, required for 16-bit int */
- + (((long) p->hl[3]<<24)|((long) p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
- + #else
- ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
- + #endif
- break;
- default:
- error("invalid type %d in mcheck().\n", m->type);
-