From: Ian Darwin Date: Tue, 6 Oct 1987 20:15:39 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: FILE3_27~374 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62f3ce00507aa3646fe6903e2aa9ac13057e239a;p=file *** empty log message *** --- diff --git a/README b/README index 178a8a62..a4beb2ef 100644 --- a/README +++ b/README @@ -20,8 +20,13 @@ in magic(4) format please(!), to the author, Ian Darwin, LEGAL.NOTICE - read this first. README - read this second (you are currently reading this file). PORTING - read this next. -Makefile - read this next, fix it if needed, type "make" - to compile, "make test" to try it (expect some diffs!). +Makefile - read this next, adapt it as needed (particularly + the man page layouts), type "make" to compile, + "make test" to try it out against your old version. + Expect some diffs, particularly since your original + file(1) may not grok the imbedded-space ("\ ") in + the current magic file, or may even not use the + magic file. apprentice.c - parses /etc/magic to learn magic ascmagic.c - third & last set of tests, based on hardwired assumptions. core - not included in distribution due to mailer limitations. @@ -36,5 +41,6 @@ is_tar.c - knows about tarchives (courtesy of John Gilmore). magdir - directory of /etc/magic pieces names.h - header file for ascmagic.c softmagic.c - 2nd set of tests, based on /etc/magic -strtok.c - in case you need it (from Henry Spencer). -strtol.c - in case you need it +strtok.c, getopt.c - in case you them (courtesy of Henry Spencer). +strtol.c, strchr.c - in case you need them - public domain. +tst - simple test suite, built from tst/Makefile diff --git a/doc/file.man b/doc/file.man index f41b1d5a..abd8c26d 100644 --- a/doc/file.man +++ b/doc/file.man @@ -120,7 +120,7 @@ to test the standard input, use ``-'' as a filename argument. .I /etc/magic \- default list of magic numbers .SH SEE ALSO -.IR File (5) +.IR Magic (FILES) \- description of magic file format. .br .IR Strings (1), " od" (1) diff --git a/src/Makefile b/src/Makefile index 9f8f6c9e..ae2c4874 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ # Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Header: /home/glen/git/file/cvs/file/src/Attic/Makefile,v 1.10 1987/09/18 21:45:51 ian Exp $ +# @(#)$Header: /home/glen/git/file/cvs/file/src/Attic/Makefile,v 1.11 1987/10/06 20:15:52 ian 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. @@ -27,22 +27,35 @@ DEFS = -DMAGIC='"$(MAGIC)"' # -Dvoid=int COPTS = -O # -g CFLAGS = $(COPTS) $(DEFS) SHAR = bundle -OFILE = /usr/bin/file.orig # old or distributed version, for comparison +OFILE = /usr/bin/file.sun # old or distributed version, for comparison # Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG). -BINDIR = /usr/local -# For installing our man pages; typically MANDIR is /usr/man/man1 (BSD) -# or /usr/man/local (USG). MAN?EXT is [15] on BSD, l for BSD if -# installing in /usr/man/manl (for local), [14] on USG. -MANDIR = /usr/man/local -MAN1EXT = 1 -MAN4EXT = 4 +BINDIR = /usr/local/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: +# Variable V7 4BSD Sys V +# MANCDIR /usr/man/man1 /usr/man/man1 /usr/man/u_man/man1 +# MANFDIR /usr/man/man5 /usr/man/man5 /usr/man/u_man/man4 +# MANCEXT 1 1 1 +# MANFEXT 5 5 4 +# --- possible alternative for 4BSD --- +# MANCDIR /usr/man/manl +# MANCEXT l +# --- possible alternative for USG --- +# MANCDIR /usr/man/local/man1 +# MANCEXT 1 + +MANCDIR = /usr/man/manl +MANFDIR = /usr/man/man5 +MANCEXT = l +MANFEXT = 5 # There are no system-dependant configuration options (except maybe CFLAGS). -# Delete some of LOCALSRCS and LOCALOBJS if they're in your C library. -LOCALSRCS = getopt.c strtol.c strtok.c +# Delete any of LOCALSRCS and LOCALOBJS that are in your C library. +LOCALSRCS = getopt.c strtol.c strtok.c strchr.c SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c is_tar.c \ print.c $(LOCALSRCS) -LOCALOBJS = getopt.o strtol.o strtok.o +LOCALOBJS = getopt.o strtol.o strtok.o strchr.o OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o is_tar.o \ print.o $(LOCALOBJS) @@ -51,7 +64,7 @@ ALLSRC = LEGAL.NOTICE README PORTING $(SRCS) *.h \ all: file magic -test: all +test: all $(OFILE) cd tst; make time $(OFILE) -m ./magic * tst/* >/tmp/t1 time ./file -m ./magic * tst/* >/tmp/t2 @@ -70,15 +83,20 @@ ascmagic.o: names.h apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h -install: all - cp file $(BINDIR)/file - cp magic $(MAGIC) - cp file.1 $(MANDIR)/$(MAN1EXT) - cp magic.4 $(MANDIR)/$(MAN4EXT) +install: file magic file.1 magic.4 $(BINDIR) $(MANCDIR) $(MANCDIR) + cp file $(BINDIR)/file + cp magic $(MAGIC) + cp file.1 $(MANCDIR)/file.$(MANCEXT) + cp magic.4 $(MANFDIR)/magic.$(MANFEXT) clean: rm -f *.o file magic lint.out (cd tst; make clean) dist: $(ALLSRC) - (echo mkdir magdir tst; $(SHAR) $(ALLSRC) ) >$@ +# Some versions of shar can't handle a single file from +# a subdirectory, so we manually insert mkdir as needed. +# Put the extra "mkdir" AFTER the ": to unbundle..." line. + $(SHAR) $(ALLSRC) | sed -e '1a\ + mkdir magdir tst' >$@ + diff --git a/src/PORTING b/src/PORTING index e33c3814..b8853405 100644 --- a/src/PORTING +++ b/src/PORTING @@ -6,12 +6,13 @@ to un-comment-out the definition of `void=int' in the Makefile. I had hoped to be able to make a file command that didn't have any system-dependant #ifdefs, no special libraries, -etc., etc. Well, System V shot me down. They moved the definition -of major() and minor() out of into . -So, if major isn't defined after including types.h, I AUTOMATICALLY -include sys/sysmacros.h. ONLY if you have a system in which neither -types.h nor sysmacros.h defines `major' will this automatic include -fail. On such systems, you will get a compilation +etc., etc. I went to some lengths to include all the non-portable +library routines I used (getopt, str*). Well, System V shot me down. +They moved the definition of major() and minor() out of +into . So, if major isn't defined after including types.h, +I AUTOMATICALLY include sys/sysmacros.h. 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 (2nd) #include at the start of fsmagic.c