Article View: comp.text.tex
Article #11192Re: Can I add an enty to /etc/magic to make file(1) understand DVI?
From: Ignatios Souvatzis
Date: Sat, 14 Sep 1991 13:34
Date: Sat, 14 Sep 1991 13:34
93 lines
4077 bytes
4077 bytes
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
Yes, but that depends on the comment field in the .dvi preamble... I
read parts of tex.web from the 3.? distribution and tried the
following (works on DECstations and Convexes, and PRINTS the comment
field. Research on how to print magnification is underway.)
---- Cut Here and unpack ----
#!/bin/sh
# This is a shell archive (shar 3.32)
# made 09/13/1991 14:30 UTC by u502sou@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
Technical Details
Message-ID:
<U502SOU.91Sep14153430@mpirbn.mpifr-bonn.mpg.de>Path:
arc1-ca.pugleaf.net!wupost!uunet!mcsun!unido!mpirbn!u502souReferences:
<949@ltb.ltb.bso.nl> <17637@chopin.udel.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!uunet!mcsun!unido!mpirbn!u502sou From: u502sou@mpirbn.mpifr-bonn.mpg.de (Ignatios Souvatzis) Newsgroups: comp.text.tex,alt.sources,sub.tex Subject: Re: Can I add an enty to /etc/magic to make file(1) understand DVI? Message-ID: <U502SOU.91Sep14153430@mpirbn.mpifr-bonn.mpg.de> Date: 14 Sep 91 13:34:30 GMT References: <949@ltb.ltb.bso.nl> <17637@chopin.udel.edu> Sender: u502sou@mpirbn.mpifr-bonn.mpg.de Reply-To: u502sou@c1a Distribution: world,alt,sub Organization: /mnt0/u502sou/.organization Lines: 93 In-reply-to: anita@chopin.udel.edu's message of 12 Sep 91 19:56:09 GMT X-Md4-Signature: 3374f8755abae06b1700a1d4403c2be1