From: Christos Zoulas Date: Sat, 27 Jun 1998 13:56:19 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: FILE3_27~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50fe05e05940df69383f688400b1979d14298d55;p=file *** empty log message *** --- diff --git a/Makefile.in b/Makefile.in index 3cb022c5..24b63729 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,6 @@ # Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile.in,v 1.3 1998/02/15 23:21:17 christos Exp $ +# @(#)$Id: Makefile.in,v 1.4 1998/06/27 14:01:39 christos Exp $ # # This software is not subject to any license of the American Telephone # and Telegraph Company or of the Regents of the University of California. @@ -21,7 +21,7 @@ # ever read sources, credits must appear in the documentation. # # 4. This notice may not be removed or altered. -VERSION = 3.24 +VERSION = 3.25 SHELL = /bin/sh #MAGIC = /etc/magic prefix = @prefix@ diff --git a/config.h.in b/config.h.in index c4d5fe25..efd00d4e 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,9 @@ /* Define if your struct stat has st_rdev. */ #undef HAVE_ST_RDEV +/* Define if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + /* Define to `long' if doesn't define. */ #undef off_t diff --git a/configure b/configure index 26983fbd..b252ac92 100755 --- a/configure +++ b/configure @@ -181,7 +181,7 @@ Features and packages: --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" + echo "--enable and --with options known (Default: + yes, - no, s system-specific):$ac_help" fi exit 0 ;; @@ -1131,6 +1131,49 @@ EOF fi +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1136: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:1157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure diff --git a/configure.in b/configure.in index 1788038b..74f2894c 100644 --- a/configure.in +++ b/configure.in @@ -12,4 +12,7 @@ AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_ST_RDEV +dnl Checks for headers +AC_HEADER_SYS_WAIT + AC_OUTPUT(Makefile config.h) diff --git a/magic/Magdir/adventure b/magic/Magdir/adventure index 18ab94af..67e108da 100644 --- a/magic/Magdir/adventure +++ b/magic/Magdir/adventure @@ -9,10 +9,11 @@ 0 leshort 0x602 ALAN text adventure code data >2 byte <10 version 2.6%d +# Conflicts with too much other stuff! # Infocom -0 byte <9 Infocom game data (Z-machine %d, ->3 leshort <0x7fff Release %3d, ->18 string >\0 Serial %.6s) +#0 byte <9 Infocom game data (Z-machine %d, +#>3 leshort <0x7fff Release %3d, +#>18 string >\0 Serial %.6s) # TADS (Text Adventure Development System) 0 string TADS TADS game data diff --git a/magic/Magdir/audio b/magic/Magdir/audio index b5ac2a47..e626c7c3 100644 --- a/magic/Magdir/audio +++ b/magic/Magdir/audio @@ -44,7 +44,7 @@ # Creative Labs AUDIO stuff 0 string MThd Standard MIDI data >9 byte >0 (format %d) ->11 byte >1 using %d channels +>11 byte >1 using %d tracks 0 string CTMF Creative Music (CMF) data 0 string SBI SoundBlaster instrument data 0 string Creative\ Voice\ File Creative Labs voice data diff --git a/magic/Magdir/compress b/magic/Magdir/compress index 44ef619e..dbc25a79 100644 --- a/magic/Magdir/compress +++ b/magic/Magdir/compress @@ -104,3 +104,42 @@ >3 string =7 \b, compression block size 700k >3 string =8 \b, compression block size 800k >3 string =9 \b, compression block size 900k + +# lzop from +0 string \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data +>9 beshort <0x0940 +>>9 byte&0xf0 =0x00 - version 0. +>>9 beshort&0x0fff x \b%03x, +>>13 byte 1 LZO1X-1, +>>13 byte 2 LZO1X-1(15), +>>13 byte 3 LZO1X-999, +## >>22 bedate >0 last modified: %s, +>>14 byte =0x00 os: MS-DOS +>>14 byte =0x01 os: Amiga +>>14 byte =0x02 os: VMS +>>14 byte =0x03 os: Unix +>>14 byte =0x05 os: Atari +>>14 byte =0x06 os: OS/2 +>>14 byte =0x07 os: MacOS +>>14 byte =0x0A os: Tops/20 +>>14 byte =0x0B os: WinNT +>>14 byte =0x0E os: Win32 +>9 beshort >0x0939 +>>9 byte&0xf0 =0x00 - version 0. +>>9 byte&0xf0 =0x10 - version 1. +>>9 byte&0xf0 =0x20 - version 2. +>>9 beshort&0x0fff x \b%03x, +>>15 byte 1 LZO1X-1, +>>15 byte 2 LZO1X-1(15), +>>15 byte 3 LZO1X-999, +## >>25 bedate >0 last modified: %s, +>>17 byte =0x00 os: MS-DOS +>>17 byte =0x01 os: Amiga +>>17 byte =0x02 os: VMS +>>17 byte =0x03 os: Unix +>>17 byte =0x05 os: Atari +>>17 byte =0x06 os: OS/2 +>>17 byte =0x07 os: MacOS +>>17 byte =0x0A os: Tops/20 +>>17 byte =0x0B os: WinNT +>>17 byte =0x0E os: Win32 diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems index 13a8731b..f3ae3a69 100644 --- a/magic/Magdir/filesystems +++ b/magic/Magdir/filesystems @@ -33,4 +33,30 @@ >>0x36 string FAT \b, %s >>>0x39 string 12 (%s bit) >>>0x39 string 16 (%s bit) +>>>43 string >NO\ NAME label: %.11s, +>>>43 string >>43 string NO\ NAME unlabeled, +>>>19 leshort >0 %d sectors +>>>19 leshort 0 +>>>>32 lelong x %d sectors >0x200 lelong 0x82564557 \b, BSD disklabel + +# Minix filesystems - Juan Cespedes +0x410 leshort 0x137f Minix filesystem +0x410 leshort 0x138f Minix filesystem, 30 char names +0x410 leshort 0x2468 Minix filesystem, version 2 +0x410 leshort 0x2478 Minix filesystem, version 2, 30 char names + +# romfs filesystems - Juan Cespedes +0 string -rom1fs-\0 romfs filesystem, version 1 +>8 belong x %d bytes, +>16 string x named %s. + +# netboot image - Juan Cespedes +0 lelong 0x1b031336L Netboot image, +>4 lelong&0xFFFFFF00 0 +>>4 lelong&0x100 0x000 mode 2 +>>4 lelong&0x100 0x100 mode 3 +>4 lelong&0xFFFFFF00 !0 unknown mode + +0x18b string OS/2 OS/2 Boot Manager diff --git a/magic/Magdir/frame b/magic/Magdir/frame index e2c10f11..1b397df0 100644 --- a/magic/Magdir/frame +++ b/magic/Magdir/frame @@ -6,6 +6,7 @@ # copyright, but this file is "published" as witness the following: # 0 string \11 string 5.5 (5.5 >11 string 5.0 (5.0 >11 string 4.0 (4.0 >11 string 3.0 (3.0 diff --git a/magic/Magdir/linux b/magic/Magdir/linux index ec6d5c89..ba37e24e 100644 --- a/magic/Magdir/linux +++ b/magic/Magdir/linux @@ -23,6 +23,18 @@ # 0 string \007\001\000 Linux/i386 object file >20 lelong >0x1020 \b, DLL library +# Linux-8086 stuff: +0 string \01\03\020\04 Linux-8086 impure executable +>28 long !0 not stripped +0 string \01\03\040\04 Linux-8086 executable +>28 long !0 not stripped +# +0 string \243\206\001\0 Linux-8086 object file +# +0 string \01\03\020\20 Minix-386 impure executable +>28 long !0 not stripped +0 string \01\03\040\20 Minix-386 executable +>28 long !0 not stripped # message catalogs, from Mitchum DSouza 0 string *nazgul* Linux compiled message catalog >8 lelong >0 \b, version %ld @@ -66,7 +78,7 @@ # # Linux kernel boot images, from Albert Cahalan # and others such as Axel Kohlmeyer -# and Nicolas Lichtmaier +# and Nicolás Lichtmaier # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 514 string HdrS Linux kernel >518 leshort >0 @@ -88,5 +100,5 @@ 0 belong 0xb8c0078e Linux kernel >0x1e3 string Loading version 1.3.79 or older >0x1e9 string Loading from prehistoric times -# LSM entries - Nicolas Lichtmaier +# LSM entries - Nicolás Lichtmaier 0 string Begin3 Linux Software Map entry text diff --git a/magic/Magdir/printer b/magic/Magdir/printer index a316f63d..4bf5f068 100644 --- a/magic/Magdir/printer +++ b/magic/Magdir/printer @@ -18,6 +18,16 @@ >>>16 string Query - type %s >>>16 string ExitServer - type %s +# DOS EPS Binary File Header +# From: Ed Sznyter +0 belong 0xC5D0D3C6 DOS EPS Binary File +>4 long >0 Postscript starts at byte %d +>>8 long >0 length %d +>>>12 long >0 Metafile starts at byte %d +>>>>16 long >0 length %d +>>>20 long >0 TIFF starts at byte %d +>>>>24 long >0 length %d + # Adobe's PostScript Printer Description (PPD) files # Yves Arrouye # diff --git a/magic/Magdir/tex b/magic/Magdir/tex index 5126be8c..79d5bbaa 100644 --- a/magic/Magdir/tex +++ b/magic/Magdir/tex @@ -34,3 +34,14 @@ 0 string \\setlength LaTeX document text 0 string \\documentstyle LaTeX document text 0 string \\chapter LaTeX document text +0 string \\documentclass LaTeX 2e document text +0 string \\relax LaTeX auxiliary file +0 string \\contentsline LaTeX table of contents + +# Index and glossary files +0 string \\indexentry LaTeX raw index file +0 string \\begin{theindex} LaTeX sorted index +0 string \\glossaryentry LaTeX raw glossary +0 string \\begin{theglossary} LaTeX sorted glossary +0 string This\ is\ makeindex Makeindex log file +# End of TeX diff --git a/magic/Magdir/timezone b/magic/Magdir/timezone index bae5abe8..40e7558f 100644 --- a/magic/Magdir/timezone +++ b/magic/Magdir/timezone @@ -6,9 +6,9 @@ # this should work on Linux, SunOS, and maybe others # Added new official magic number for recent versions of the Olson code 0 string TZif timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0 timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0 timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0 timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0 timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0 timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0 timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0 old timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0 old timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0 old timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0 old timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0 old timezone data +0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0 old timezone data diff --git a/src/Makefile b/src/Makefile index 548f4384..40aeb61b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,7 @@ +# Generated automatically from Makefile.in by configure. # Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile,v 1.56 1997/11/05 16:03:18 christos Exp $ +# @(#)$Id: Makefile,v 1.57 1998/06/27 14:01:39 christos Exp $ # # This software is not subject to any license of the American Telephone # and Telegraph Company or of the Regents of the University of California. @@ -21,21 +22,26 @@ # ever read sources, credits must appear in the documentation. # # 4. This notice may not be removed or altered. -VERSION = 3.23 +VERSION = 3.25 SHELL = /bin/sh #MAGIC = /etc/magic -MAGIC = /usr/local/etc/magic -DEFS = -DMAGIC='"$(MAGIC)"' -DBUILTIN_ELF # -Dvoid=int -CC = cc -COPTS = -O -g # newer compilers allow both; else drop -O +prefix = /usr/local +INSTALLCMD = /usr/bin/install -c +MAGICDIR = ${prefix}/share +MAGIC = $(MAGICDIR)/magic +DEFS = -DMAGIC='"$(MAGIC)"' -DBUILTIN_ELF -DHAVE_CONFIG_H +CPPFLAGS = $(DEFS) +CC = gcc +#COPTS = -O -g # newer compilers allow both; else drop -O # For truly antique environments, use this for (dummy) include files: -COPTS = -O # -Ilocalinc -CFLAGS = $(COPTS) $(DEFS) -LDFLAGS = $(COPTS) # -Bstatic # older gdb couldn't handle shared libs +#COPTS = -O # -Ilocalinc +#CFLAGS = $(COPTS) $(DEFS) +CFLAGS = -g -O2 +#LDFLAGS = $(COPTS) # -Bstatic # older gdb couldn't handle shared libs SHAR = bundle OFILE = /usr/bin/file # old or distributed version, for comparison # Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG). -BINDIR = /usr/local/bin +BINDIR = ${prefix}/bin # For installing our man pages; # MANCxxx is manual section for Commands, MANFxxx is section for file formats. # MANxDIR is directory names; MANxEXT is the filename extention. Usual values: @@ -54,9 +60,9 @@ BINDIR = /usr/local/bin # MANCDIR /usr/man/local/man1 # MANCEXT 1 -MANCDIR = /usr/local/man/man1 +MANCDIR = ${prefix}/man/man1 MANCEXT = 1 -MANFDIR = /usr/local/man/man4 +MANFDIR = ${prefix}/man/man4 MANFEXT = 4 # There are no system-dependant configuration options (except maybe CFLAGS). @@ -75,9 +81,11 @@ SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o \ compress.o is_tar.o readelf.o internat.o \ print.o $(LOCALOBJS) +HDRS = file.h names.h patchlevel.h readelf.h tar.h -ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) *.h \ - Makefile file.man magic.man +AUTOSRC=configure configure.in install-sh config.h.in Makefile.in +ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \ + Makefile.std file.man magic.man magic2mime $(AUTOSRC) ALLMAGIC = Magdir/Makefile Magdir/Localstuff Magdir/Header Magdir/[a-z]* all: file magic file.${MANCEXT} magic.${MANFEXT} @@ -103,8 +111,11 @@ ascmagic.o: names.h compress.o apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h install: file magic - cp file $(BINDIR)/file - cp magic $(MAGIC) + -mkdir $(BINDIR) $(MAGICDIR) $(MANCDIR) $(MANFDIR) + $(INSTALLCMD) file $(BINDIR)/file + $(INSTALLCMD) magic $(MAGIC) + $(INSTALLCMD) file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT) + $(INSTALLCMD) magic.${MANFEXT} $(MANFDIR)/magic.$(MANFEXT) install.man: file.${MANCEXT} magic.${MANFEXT} cp file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT) @@ -112,7 +123,8 @@ install.man: file.${MANCEXT} magic.${MANFEXT} clean: rm -f *.o core file magic lint dist.* MANIFEST \ - magic.${MANFEXT} file.${MANCEXT} + magic.${MANFEXT} file.${MANCEXT} \ + config.h config.status config.cache config.log clobber: cd tst; $(MAKE) clean diff --git a/src/Makefile.std b/src/Makefile.std index ae22b82b..9022de63 100644 --- a/src/Makefile.std +++ b/src/Makefile.std @@ -1,6 +1,6 @@ # Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile.std,v 1.3 1998/02/15 23:21:17 christos Exp $ +# @(#)$Id: Makefile.std,v 1.4 1998/06/27 14:01:39 christos Exp $ # # This software is not subject to any license of the American Telephone # and Telegraph Company or of the Regents of the University of California. @@ -21,7 +21,7 @@ # ever read sources, credits must appear in the documentation. # # 4. This notice may not be removed or altered. -VERSION = 3.24 +VERSION = 3.25 SHELL = /bin/sh #MAGIC = /etc/magic MAGIC = /usr/local/etc/magic diff --git a/src/apprentice.c b/src/apprentice.c index 2819df87..eb50b337 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.26 1998/06/27 13:23:39 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.27 1998/06/27 13:57:23 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -50,11 +50,11 @@ static void eatsize __P((char **)); static int maxmagic = 0; -static int apprentice_1 __P((char *, int)); +static int apprentice_1 __P((const char *, int)); int apprentice(fn, check) -char *fn; /* list of magic files */ +const char *fn; /* list of magic files */ int check; /* non-zero? checking-only run. */ { char *p, *mfn; @@ -93,7 +93,7 @@ int check; /* non-zero? checking-only run. */ static int apprentice_1(fn, check) -char *fn; /* name of magic file */ +const char *fn; /* name of magic file */ int check; /* non-zero? checking-only run. */ { static const char hdr[] = diff --git a/src/compress.c b/src/compress.c index 773d70e5..50647bf0 100644 --- a/src/compress.c +++ b/src/compress.c @@ -17,14 +17,14 @@ #endif #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.11 1998/06/27 13:23:39 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.12 1998/06/27 13:57:23 christos Exp $") #endif static struct { - char *magic; + const char *magic; int maglen; - char *argv[3]; + const char *const argv[3]; int silent; } compr[] = { { "\037\235", 2, { "uncompress", "-c", NULL }, 0 }, /* compressed */ @@ -97,7 +97,8 @@ int n; if (compr[method].silent) (void) close(2); - execvp(compr[method].argv[0], compr[method].argv); + execvp(compr[method].argv[0], + (char *const *)compr[method].argv); error("could not execute `%s' (%s).\n", compr[method].argv[0], strerror(errno)); /*NOTREACHED*/ diff --git a/src/file.c b/src/file.c index 7acd198c..e4040ea8 100644 --- a/src/file.c +++ b/src/file.c @@ -48,7 +48,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.40 1998/06/27 13:23:39 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.41 1998/06/27 13:57:23 christos Exp $") #endif /* lint */ @@ -73,7 +73,7 @@ int /* Misc globals */ struct magic *magic; /* array of magic entries */ -char *magicfile; /* where magic be found */ +const char *magicfile; /* where magic be found */ char *progname; /* used throughout */ int lineno; /* line number in the magic file */ @@ -85,6 +85,8 @@ static int byteconv4 __P((int, int, int)); static short byteconv2 __P((int, int, int)); #endif +int main __P((int, char *[])); + /* * main - parse arguments and handle options */ diff --git a/src/file.h b/src/file.h index 9bce3129..60cd42d0 100644 --- a/src/file.h +++ b/src/file.h @@ -1,6 +1,6 @@ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.26 1998/06/27 13:23:39 christos Exp $ + * @(#)$Id: file.h,v 1.27 1998/06/27 13:57:23 christos Exp $ * * Copyright (c) Ian F. Darwin, 1987. * Written by Ian F. Darwin. @@ -88,7 +88,7 @@ struct magic { # endif #endif -extern int apprentice __P((char *, int)); +extern int apprentice __P((const char *, int)); extern int ascmagic __P((unsigned char *, int)); extern void error __P((const char *, ...)); extern void ckfputs __P((const char *, FILE *)); @@ -112,7 +112,7 @@ extern void tryelf __P((int, char *, int)); extern int errno; /* Some unixes don't define this.. */ extern char *progname; /* the program name */ -extern char *magicfile; /* name of the magic file */ +extern const char *magicfile; /* name of the magic file */ extern int lineno; /* current line number in magic file */ extern struct magic *magic; /* array of magic entries */ diff --git a/src/names.h b/src/names.h index 54d1cbb1..a9abb5e5 100644 --- a/src/names.h +++ b/src/names.h @@ -10,22 +10,24 @@ * * See LEGAL.NOTICE * - * $Id: names.h,v 1.13 1997/01/15 17:23:24 christos Exp $ + * $Id: names.h,v 1.14 1998/06/27 13:57:23 christos Exp $ */ /* these types are used to index the table 'types': keep em in sync! */ -#define L_C 0 /* first and foremost on UNIX */ -#define L_CC 1 /* Bjarne's postincrement */ +#define L_C 0 /* first and foremost on UNIX */ +#define L_CC 1 /* Bjarne's postincrement */ #define L_FORT 2 /* the oldest one */ -#define L_MAKE 3 /* Makefiles */ -#define L_PLI 4 /* PL/1 */ -#define L_MACH 5 /* some kinda assembler */ -#define L_ENG 6 /* English */ +#define L_MAKE 3 /* Makefiles */ +#define L_PLI 4 /* PL/1 */ +#define L_MACH 5 /* some kinda assembler */ +#define L_ENG 6 /* English */ #define L_PAS 7 /* Pascal */ #define L_MAIL 8 /* Electronic mail */ #define L_NEWS 9 /* Usenet Netnews */ +#define L_JAVA 10 /* Java code */ +#define L_HTML 11 /* HTML */ -static char *types[] = { +static const char *types[] = { "C program text", "C++ program text", "FORTRAN program text", @@ -36,15 +38,54 @@ static char *types[] = { "Pascal program text", "mail text", "news text", + "Java program text", + "HTML document text", "can't happen error on names.h/types", 0}; +/* + * XXX - how should we distinguish Java from C++? + * The trick used in a Debian snapshot, of having "extends" or "implements" + * as tags for Java, doesn't work very well, given that those keywords + * are often preceded by "class", which flags it as C++. + * + * Perhaps we need to be able to say + * + * If "class" then + * + * if "extends" or "implements" then + * Java + * else + * C++ + * endif + * + * Or should we use other keywords, such as "package" or "import"? + * Unfortunately, Ada95 uses "package", and Modula-3 uses "import", + * although I infer from the language spec at + * + * http://www.research.digital.com/SRC/m3defn/html/m3.html + * + * that Modula-3 uses "IMPORT" rather than "import", i.e. it must be + * in all caps. + * + * So, for now, we go with "import". We must put it before the C++ + * stuff, so that we don't misidentify Java as C++. Not using "package" + * means we won't identify stuff that defines a package but imports + * nothing; hopefully, very little Java code imports nothing (one of the + * reasons for doing OO programming is to import as much as possible + * and write only what you need to, right?). + * + * Unfortunately, "import" may cause us to misidentify English text + * as Java, as it comes after "the" and "The". Perhaps we need a fancier + * heuristic to identify Java? + */ static struct names { - char *name; + const char *name; short type; } names[] = { /* These must be sorted by eye for optimal hit rate */ /* Add to this list only after substantial meditation */ + {"import", L_JAVA}, {"//", L_CC}, {"template", L_CC}, {"virtual", L_CC}, @@ -94,6 +135,10 @@ static struct names { {"Newsgroups:", L_NEWS}, {"Path:", L_NEWS}, {"Organization:",L_NEWS}, + {"href=", L_HTML}, + {"HREF=", L_HTML}, + {">>>>>>> %d" + 8 - (m->cont_level & 7), m->offset); diff --git a/src/readelf.c b/src/readelf.c index 7e6d14b4..157485d1 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -15,7 +15,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: readelf.c,v 1.7 1998/06/27 13:23:39 christos Exp $") +FILE_RCSID("@(#)$Id: readelf.c,v 1.8 1998/06/27 13:57:23 christos Exp $") #endif static void @@ -239,7 +239,8 @@ tryelf(fd, buf, nbytes) * Instead we traverse thru all section headers until a symbol table * one is found or else the binary is stripped. */ - if (buf[EI_MAG0] != ELFMAG0 || buf[EI_MAG1] != ELFMAG1 + if (buf[EI_MAG0] != ELFMAG0 + || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1) || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3) return; diff --git a/src/readelf.h b/src/readelf.h index c4b42d7e..9b63498b 100644 --- a/src/readelf.h +++ b/src/readelf.h @@ -1,6 +1,6 @@ /* * readelf.h - * @(#)$Id: readelf.h,v 1.4 1997/01/15 17:23:24 christos Exp $ + * @(#)$Id: readelf.h,v 1.5 1998/06/27 13:57:23 christos Exp $ * * Provide elf data structures for non-elf machines, allowing file * non-elf hosts to determine if an elf binary is stripped. @@ -92,6 +92,9 @@ typedef struct { #define ELFMAG3 'F' #define ELFMAG "\177ELF" +#define OLFMAG1 'O' +#define OLFMAG "\177OLF" + typedef struct { Elf32_Word p_type; Elf32_Off p_offset; diff --git a/src/tar.h b/src/tar.h index fd6f0c94..162459f5 100644 --- a/src/tar.h +++ b/src/tar.h @@ -5,7 +5,7 @@ * * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu. * - * $Id: tar.h,v 1.3 1992/09/08 15:32:41 ian Exp $ # checkin only + * $Id: tar.h,v 1.4 1998/06/27 13:57:23 christos Exp $ # checkin only */ /* @@ -167,6 +167,7 @@ TAR_EXTERN struct link *linklist; /* Points to first link in list */ TAR_EXTERN char read_error_flag; +#if 0 /* * Declarations of functions available to the world. */ @@ -177,3 +178,4 @@ union record *endofrecs(); void anno(); #define annorec(stream, msg) anno(stream, msg, 0) /* Cur rec */ #define annofile(stream, msg) anno(stream, msg, 1) /* Saved rec */ +#endif