home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / ZOO21E.EXE / FILE.FIX < prev    next >
Text File  |  1991-07-11  |  2KB  |  53 lines

  1.           Making the "file" command recognize zoo archives
  2.  
  3. Zoo archives have the following magic number:  Beginning at offset 20
  4. decimal, there are four bytes with the values 0xdc, 0xa7, 0xc4, and
  5. 0xfd.  (But if you call the first byte of a zoo archive byte 1, then
  6. the magic bytes will be bytes 21 through 24.)
  7.  
  8. To make the "file" command identify zoo archives, changes can be made
  9. as follows.
  10.  
  11. 4.3BSD:  See the context diff near the end of this document, suitable
  12. for application with the "patch" utility, that works with the 4.3BSD
  13. "file" command on a VAX-11/785.  I don't know if this will also work
  14. under 4.2BSD or with any other implementation of the "file" command
  15. or on any other CPU.
  16.  
  17. System V Release 2 (as exemplified by Microport System V/AT):  At the
  18. end of the file "/etc/magic", add the following line:
  19.  
  20. 20    long        0xfdc4a7dc    zoo archive
  21.  
  22. This should work on a little-endian machine, in which the long value
  23. 0xfdc4a7dc is stored with the least-significant byte first.  For a big-
  24. endian machine, you will probably need to replace it with 0xdca7c4fd.
  25. This assumes that long occupies 4 bytes.  If not, use a data type name
  26. that is exactly 4 bytes.
  27.  
  28. =====
  29. Changes needed to make the 4.3BSD "file" command recognize zoo
  30. archives.  Known to work on a VAX-11/785.
  31.  
  32. *** file.c.old    Thu Mar  6 19:34:29 1986
  33. --- file.c    Sat Feb 21 19:28:52 1987
  34. ***************
  35. *** 172,181 ****
  36. --- 172,187 ----
  37.       case 070707:
  38.           printf("cpio data\n");
  39.           return;
  40.       }
  41.  
  42. +     if (buf[20] == (char) 0xdc && buf[21] == (char) 0xa7 &&
  43. +                     buf[22] == (char) 0xc4 && buf[23] == (char) 0xfd) {
  44. +         printf ("zoo archive\n");
  45. +         return;
  46. +     }
  47. +
  48.       if (buf[0] == '#' && buf[1] == '!' && shellscript(buf+2, &mbuf))
  49.           return;
  50.       if (buf[0] == '\037' && buf[1] == '\235') {
  51.           if (buf[2]&0x80)
  52.               printf("block ");
  53.