Xref: wupost comp.text.tex:10959 sub.tex:2188 alt.sources:4042
Path: wupost!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!nntp-server.caltech.edu!ira.uka.de!unido!mpirbn!u502sou
From: u502sou@mpirbn.mpifr-bonn.mpg.de (Ignatios Souvatzis)
Newsgroups: comp.text.tex,sub.tex,alt.sources
Subject: Re: Can I add an enty to /etc/magic to make file(1) understand DVI?
Message-ID: <U502SOU.91Sep13093111@mpirbn.mpifr-bonn.mpg.de>
Date: 13 Sep 91 07:31:11 GMT
References: <949@ltb.ltb.bso.nl> <17637@chopin.udel.edu>
Sender: u502sou@mpirbn.mpifr-bonn.mpg.de
Reply-To: u502sou@c1a
Organization: /mnt0/u502sou/.organization
Lines: 92
In-reply-to: anita@chopin.udel.edu's message of 12 Sep 91 19:56:09 GMT
X-Md4-Signature: 6031b73a618f32170996477905a5d8de

In article <17637@chopin.udel.edu> anita@chopin.udel.edu (Anita Marie
Hoover) writes:

   In article <949@ltb.ltb.bso.nl> wierda@ltb.ltb.bso.nl (Gerben
   Wierda) writes:

   =>If I run file(1) on a dvi file it returns "data". I want to make it return
   =>"dvi". What for magic number should I add to /etc/magic?
   =>
   =>

   The following worked for us:

   16 string		TeX		TeX dvi file 

The following would be the correct procedure, according to the WEB
source for TeX:
---- Cut Here and unpack ----
#!/bin/sh
# This is a shell archive (shar 3.32)
# made 09/13/1991 14:30 UTC by souva@babsy.mpifr-bonn.mpg.de
# Source directory /mnt0/u502sou
#
# existing files will NOT be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1503 -rw-r----- append-magic
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= append-magic ==============
if test X"$1" != X"-c" -a -f 'append-magic'; then
	echo "File already exists: skipping 'append-magic'"
else
echo "x - extracting append-magic (Text)"
sed 's/^X//' << 'SHAR_EOF' > append-magic &&
X##########################################################################
X# TeX support for the file command, to be appended to /usr/lib/file/magic,
X# /etc/magic or whatever applies on your system.
X# Version 1.1 (13 Sep 1991)
X#
X# Copyright 1991 Ignatios Souvatzis  (souva@babsy.mpifr-bonn.mpg.de)
X# All rights reserved.
X#
X# You may use this file or give it away under the conditions of the 
X# GNU copyleft, Version 1 or later, available from the Free Software 
X# Foundation, 675 Mass Ave, Campridge, MA 02139, USA
X# In short, you are  allowed to use, copy  and distribute this file as
X# long as you don't make any profit out of it (except for reasonable 
X# copying fees) and don't remove this notice from it.
X#########################################################################
X#
X# LaTeX file:
X#
X0	string	\documentstyle\\%[^}]*}\\%	1,1	LaTeX document %s
X#
X# .dvi file:
X#
X0	short	0x02f7	1,1	TeX82 .dvi file
X>12	short	x	1,1	, mag %d
X>15	string	^\\%[\040-\0176]*\\%	1,1	:%s
X0	short	0x03f7	1,1	TeX dvi-ivd file
X0	short	0x04f7	1,1	Impossible!   (TeX output generated after 2048)
X#
X#   ^         ^       ^     ^  these should be TABS!!!!
X#
X#The line with  the >12 at  the beginning should  be removed on Digital
X#Equipment  - byte sexed machines.  Anyway, it works only for specified
X#magnifications < 65536/1000. The last line is a joke ("2nd byte will be
X#changed from 2 or  3 to 4 when an  incompatible change is made  to the
X#.dvi format, about in 2048" (Knuth, approx. cited from tex.web 3.0).
X#
SHAR_EOF
$TOUCH -am 0913163091 append-magic &&
chmod 0640 append-magic ||
echo "restore of append-magic failed"
set `wc -c append-magic`;Wc_c=$1
if test "$Wc_c" != "1503"; then
	echo original size 1503, current size $Wc_c
fi
fi
exit 0

--
Paper mail: Ignatios Souvatzis, Radioastronomisches Institut der 
            Universitaet Bonn, Auf dem Huegel 71, D-5300 Bonn 1, FRG
Internet:   u502sou@mpirbn.mpifr-bonn.mpg.de
            souva@babsy.mpifr-bonn.mpg.de
