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.
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
.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)
# 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.
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)
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
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' >$@
+
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 <sys/types.h> into <sys/sysmacros.h>.
-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 <sys/types.h>
+into <sys/sysmacros.h>. 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