From 2d56c502b45e41c9318536c4ffce13b9cd2d43d7 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sun, 31 Oct 1999 22:23:03 +0000 Subject: [PATCH] Recent changes --- magic/Magdir/amanda | 11 ++++--- magic/Magdir/audio | 4 ++- magic/Magdir/netbsd | 29 ++++++++++++++--- src/AAWARN.TXT | 11 ------- src/PORTING | 76 --------------------------------------------- src/README.ftp | 9 ------ src/apprentice.c | 13 ++++++-- src/compress.c | 5 ++- src/file.c | 7 ++++- src/fsmagic.c | 15 ++++++++- src/print.c | 4 +-- src/readelf.c | 4 +-- 12 files changed, 73 insertions(+), 115 deletions(-) delete mode 100644 src/AAWARN.TXT delete mode 100644 src/PORTING delete mode 100644 src/README.ftp diff --git a/magic/Magdir/amanda b/magic/Magdir/amanda index 57c4359f..2b956508 100644 --- a/magic/Magdir/amanda +++ b/magic/Magdir/amanda @@ -1,7 +1,10 @@ #------------------------------------------------------------------------------ # amanda: file(1) magic for amanda file format # -0 string AMANDA:\ TAPESTART\ DATE AMANDA dump header file, ->23 string X ->>25 string >\ Unused %s ->23 string >\ DATE %s +0 string AMANDA:\ AMANDA +>8 string TAPESTART\ DATE tape header file, +>>23 string X +>>>25 string >\ Unused %s +>>23 string >\ DATE %s +>8 string FILE\ dump file, +>>13 string >\ DATE %s diff --git a/magic/Magdir/audio b/magic/Magdir/audio index 93ba1875..cb051c8e 100644 --- a/magic/Magdir/audio +++ b/magic/Magdir/audio @@ -112,7 +112,9 @@ 0 string TOC TOC sound file # sidfiles -0 string PSID PlaySID v2.2+ (AMIGA) sidtune, 0 string SIDPLAY\ INFOFILE Sidplay info file +0 string PSID PlaySID v2.2+ (AMIGA) sidtune +>4 beshort >0 w/ header v%d, >14 beshort =1 single song, >14 beshort >1 %d songs, +>16 beshort >0 default song: %d diff --git a/magic/Magdir/netbsd b/magic/Magdir/netbsd index 2ab15b31..3b50b08c 100644 --- a/magic/Magdir/netbsd +++ b/magic/Magdir/netbsd @@ -136,25 +136,46 @@ 0 belong&0377777777 042600507 NetBSD/pmax core >12 string >\0 from '%s' -0 belong&0377777777 043000413 NetBSD/vax demand paged +0 belong&0377777777 043000413 NetBSD/vax 1k demand paged >0 byte &0x80 >>20 lelong <4096 shared library >>20 lelong =4096 dynamically linked executable >>20 lelong >4096 dynamically linked executable >0 byte ^0x80 executable >16 lelong >0 not stripped -0 belong&0377777777 043000410 NetBSD/vax pure +0 belong&0377777777 043000410 NetBSD/vax 1k pure >0 byte &0x80 dynamically linked executable >0 byte ^0x80 executable >16 lelong >0 not stripped -0 belong&0377777777 043000407 NetBSD/vax +0 belong&0377777777 043000407 NetBSD/vax 1k >0 byte &0x80 dynamically linked executable >0 byte ^0x80 >>0 byte &0x40 position independent >>20 lelong !0 executable >>20 lelong =0 object file >16 lelong >0 not stripped -0 belong&0377777777 043000507 NetBSD/vax core +0 belong&0377777777 043000507 NetBSD/vax 1k core +>12 string >\0 from '%s' + +0 belong&0377777777 045400413 NetBSD/vax 4k demand paged +>0 byte &0x80 +>>20 lelong <4096 shared library +>>20 lelong =4096 dynamically linked executable +>>20 lelong >4096 dynamically linked executable +>0 byte ^0x80 executable +>16 lelong >0 not stripped +0 belong&0377777777 045400410 NetBSD/vax 4k pure +>0 byte &0x80 dynamically linked executable +>0 byte ^0x80 executable +>16 lelong >0 not stripped +0 belong&0377777777 045400407 NetBSD/vax 4k +>0 byte &0x80 dynamically linked executable +>0 byte ^0x80 +>>0 byte &0x40 position independent +>>20 lelong !0 executable +>>20 lelong =0 object file +>16 lelong >0 not stripped +0 belong&0377777777 045400507 NetBSD/vax 4k core >12 string >\0 from '%s' # NetBSD/alpha does not support (and has never supported) a.out objects, diff --git a/src/AAWARN.TXT b/src/AAWARN.TXT deleted file mode 100644 index 087041f3..00000000 --- a/src/AAWARN.TXT +++ /dev/null @@ -1,11 +0,0 @@ -LOOK AT THE README!! THE DOCUMENTATION IS ONE DELTA OUT OF SYNC -WITH THE SOURCE CODE. THIS IS AN INTERIM RELEASE ONLY. DO NOT -REPEAT DO NOT REDISTRIBUTE THIS RELEASE OR INCORPORATE IT INTO -ANYTHING. CONTACT THE AUTHOR FOR FURTHER INSTRUCTIONS. STOP. - -This interim release is just to let a few friends have a look at -it and make some last-minute changes before I go public with -this release. The real release should be in a week or two. -If you can, hold off until then. Thanks for your cooperation. - -$Id: AAWARN.TXT,v 1.2 1992/06/30 13:38:50 ian Exp $ diff --git a/src/PORTING b/src/PORTING deleted file mode 100644 index 06790e6a..00000000 --- a/src/PORTING +++ /dev/null @@ -1,76 +0,0 @@ -Portability of the new file(1) command. -@(#) $Id: PORTING,v 1.11 1993/09/23 21:47:23 christos Exp $ - -Read this file only if the program doesn't compile on your system. - -This release has been around UNIX; it has been compiled and tested -in the following environments: - -SunOS sqarc 4.1.1 8 sun4 - No problems. -ULTRIX squint 4.2 0 RISC - No problems. -A/UX sqmac 3.0a9 SVR22 mc68020 - No problems. -AIX sqibm 2 3 000XXXXXX100 - Had weird "make" problems making "magic" file automatically; just - built it by hand. Your mileage may vary. -SCO sqwang 3.2 2 i386 - Compiles fine; their weird make can't handle "[a-z]*" as a dependancy, - so build magic by hand. Runs fine. -sqzme sqzme 3.1.1 3 3B2 - The 3B2 SVR3 needed a few tweaks as well as COPTS = -Ilocalinc - in order to compile. - -This version, reluctanly, includes , which won't exist -on older systems or those that aren't even close to the ANSI C -standard. There is a null "stdlib.h", and some other bogus headers, -in subdirectory "localinc"; if you get complaints about missing -stdlib.h and others, uncomment the line with COPTS=-Ilocalinc -in the Makefile, and try again. - -You must have either or the older , otherwise you'll -have to butcher some routines in print.c. - -Beyond that, I have tried to make a program that doesn't need any -command-line defines (-D) to specify what version of UNIX is in use, -by using the definitions available in the system #include -files. For example, the lstat(2) call is normally found in -4BSD systems, but might be grafted into some other variant -of UNIX. If it's done right (ie., using the same definitions), -my program will compile and work correctly. Look at the #ifdefs -to see how it's done. - -I've also tried to include source for all the non-portable library routines -I used (getopt, str*). Non-portable here means `not in every -reasonably standard UNIX out there: V7, System V, 4BSD'. -These are in subdirectory "localsrc", and not used unless you -need them; again, see the Makefile. - -There is one area that just might cause problems. On System -V, they moved the definition of major() and minor() out of - into . Hence, if major isn't -defined after including types.h, I automatically include sys/sysmacros.h. -This will work for 99% of the systems out there. ONLY if you -have a system in which neither types.h nor sysmacros.h defines -`major' will this automatic include fail (I hope). On such -systems, you will get a compilation error in trying to compile -a warning message. Please do the following: - - 1) change the appropriate #include at the start of fsmagic.c -and 2) let me know the name of the system, the release number, - and the name of the header file that *does* include - this "standard" definition. - -If you are running the old Ritchie PDP-11 C compiler or -some other compiler that doesn't know about `void', you will have -to include `-Dvoid=int' in the variable COPTS in the Makefile. - -Other than this, there should be no portability problems, -but one never knows these days. Please let me know of any -other problems you find porting to a UNIX system. I don't much -care about non-UNIX systems but will collect widely-used magic -numbers for them as well as for UNIX systems. - -Mark Moraes and Christos Zoulas -(address in README) diff --git a/src/README.ftp b/src/README.ftp deleted file mode 100644 index da909832..00000000 --- a/src/README.ftp +++ /dev/null @@ -1,9 +0,0 @@ -This directory has two files, dist.src and dist.magic. -They are both shar (shell archive) files; to unpack, just -run them through /bin/sh. - -dist.src contains only the source code, Makefile, and various odds and ends. - -dist.magic contains only the pieces to make up /etc/magic. - -See README, LEGAL.NOTICE, and PORTING for more information. diff --git a/src/apprentice.c b/src/apprentice.c index d1dcd336..46ac353d 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -33,7 +33,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.28 1998/09/12 13:17:52 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.29 1999/10/31 22:23:03 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -182,7 +182,7 @@ int *ndx, check; struct magic *m; char *t, *s; -#define ALLOC_INCR 20 +#define ALLOC_INCR 200 if (nd+1 >= maxmagic){ maxmagic += ALLOC_INCR; if ((magic = (struct magic *) realloc(magic, @@ -291,7 +291,10 @@ int *ndx, check; } /* get type, skip it */ - if (strncmp(l, "byte", NBYTE)==0) { + if (strncmp(l, "char", NBYTE)==0) { /* HP/UX compat */ + m->type = BYTE; + l += NBYTE; + } else if (strncmp(l, "byte", NBYTE)==0) { m->type = BYTE; l += NBYTE; } else if (strncmp(l, "short", NSHORT)==0) { @@ -346,6 +349,10 @@ int *ndx, check; case '=': m->reln = *l; ++l; + if (*l == '=') { + /* HP compat: ignore &= etc. */ + ++l; + } break; case '!': if (m->type != STRING) { diff --git a/src/compress.c b/src/compress.c index 6020cedc..951f864f 100644 --- a/src/compress.c +++ b/src/compress.c @@ -6,6 +6,9 @@ * using method, return sizeof new */ #include "file.h" +#ifdef __CYGWIN__ +#include +#endif #include #include #ifdef HAVE_UNISTD_H @@ -16,7 +19,7 @@ #include #endif #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.13 1999/02/14 17:16:01 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.14 1999/10/31 22:23:03 christos Exp $") #endif diff --git a/src/file.c b/src/file.c index 9000f745..dc64bdb1 100644 --- a/src/file.c +++ b/src/file.c @@ -25,6 +25,9 @@ * 4. This notice may not be removed or altered. */ #include "file.h" +#ifdef __CYGWIN__ +#include +#endif #include #include #include @@ -52,7 +55,7 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.46 1999/02/14 17:16:05 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.47 1999/10/31 22:23:03 christos Exp $") #endif /* lint */ @@ -120,6 +123,8 @@ main(argc, argv) case 'v': (void) fprintf(stdout, "%s-%d.%d\n", progname, FILE_VERSION_MAJOR, patchlevel); + (void) fprintf(stdout, "magic file from %s\n", + magicfile); return 1; case 'b': ++bflag; diff --git a/src/fsmagic.c b/src/fsmagic.c index 9fd74f8c..ef5b5fbd 100644 --- a/src/fsmagic.c +++ b/src/fsmagic.c @@ -26,6 +26,9 @@ */ #include "file.h" +#ifdef __CYGWIN__ +#include +#endif #include #include #include @@ -54,7 +57,7 @@ #undef HAVE_MAJOR #ifndef lint -FILE_RCSID("@(#)$Id: fsmagic.c,v 1.29 1999/02/14 17:16:08 christos Exp $") +FILE_RCSID("@(#)$Id: fsmagic.c,v 1.30 1999/10/31 22:23:03 christos Exp $") #endif /* lint */ int @@ -83,14 +86,21 @@ struct stat *sb; return 1; } +#ifdef S_ISUID if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout); +#endif +#ifdef S_ISGID if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout); +#endif +#ifdef S_ISVTX if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout); +#endif switch (sb->st_mode & S_IFMT) { case S_IFDIR: ckfputs("directory", stdout); return 1; +#ifdef S_IFCHR case S_IFCHR: /* * If -s has been specified, treat character special files @@ -113,6 +123,8 @@ struct stat *sb; (void) printf("character special"); #endif return 1; +#endif +#ifdef S_IFBLK case S_IFBLK: /* * If -s has been specified, treat block special files @@ -135,6 +147,7 @@ struct stat *sb; (void) printf("block special"); #endif return 1; +#endif /* TODO add code to handle V7 MUX and Blit MUX files */ #ifdef S_IFIFO case S_IFIFO: diff --git a/src/print.c b/src/print.c index 146e8bb3..03f9b0c5 100644 --- a/src/print.c +++ b/src/print.c @@ -29,7 +29,7 @@ #include #include #include -#if __STDC__ +#ifdef __STDC__ # include #else # include @@ -41,7 +41,7 @@ #include #ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.28 1999/02/14 17:16:10 christos Exp $") +FILE_RCSID("@(#)$Id: print.c,v 1.29 1999/10/31 22:23:04 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) diff --git a/src/readelf.c b/src/readelf.c index daaf431e..74ee3325 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -14,7 +14,7 @@ #include "readelf.h" #ifndef lint -FILE_RCSID("@(#)$Id: readelf.c,v 1.10 1999/02/14 17:16:10 christos Exp $") +FILE_RCSID("@(#)$Id: readelf.c,v 1.11 1999/10/31 22:23:04 christos Exp $") #endif #ifdef ELFCORE @@ -147,7 +147,7 @@ doshn(class, swap, fd, off, num, size) for ( ; num; num--) { if (read(fd, sh_addr, size) == -1) error("read failed (%s).\n", strerror(errno)); - if (shs_type == SHT_SYMTAB || shs_type == SHT_DYNSYM) { + if (shs_type == SHT_SYMTAB /* || shs_type == SHT_DYNSYM */) { (void) printf (", not stripped"); return; } -- 2.40.0