Debian Codegraph @

libhylafax/typerules

raw ◀ ▶
1 Debian patch touch this file
1 # $Id$
2 #
3 # HylaFAX Facsimile Software
4 #
5 # Copyright (c) 1990-1996 Sam Leffler
6 # Copyright (c) 1991-1996 Silicon Graphics, Inc.
7 # HylaFAX is a trademark of Silicon Graphics, Inc.
8 #
9 # Permission to use, copy, modify, distribute, and sell this software and
10 # its documentation for any purpose is hereby granted without fee, provided
11 # that (i) the above copyright notices and this permission notice appear in
12 # all copies of the software and related documentation, and (ii) the names of
13 # Sam Leffler and Silicon Graphics may not be used in any advertising or
14 # publicity relating to the software without the specific, prior written
15 # permission of Sam Leffler and Silicon Graphics.
16 #
17 # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
18 # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
19 # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
20 #
21 # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
22 # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
23 # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
24 # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
25 # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26 # OF THIS SOFTWARE.
27 #
28
29 #
30 # HylaFAX file type rules.
31 #
32 # This file contains the file typing rules used by the sendfax
33 # program to deduce how input files should be prepared for fax
34 # transmission. The format of this file is based on the System V
35 # /etc/magic file used by the file(1) program. The code that
36 # reads this file was written entirely based on the comments that
37 # exist at the top of the magic file and describe how it works.
38 # The use of magic-style rules is intended to make it easier for
39 # users to reuse rules already designed for use with file(1).
40 #
41 # Each entry defines a type rule. Entries normally are terminated
42 # by the end of a line, thought they can be continued across lines
43 # with a ``\'' (when this is done leading white space is converted
44 # to a single space). ``#'' is a comment character; when it appears
45 # on a line, everything to the right is ignored.
46 #
47 # The fields in each entry are:
48 #
49 # offset: a byte offset in the file at which data should be extracted
50 # and compared to a matching string or value. If this value
51 # begins with '>', then an additional rule is used and scanning
52 # continues to the next type rule line that does not begin with
53 # a '>'. Only a single level of '>' is permitted.
54 # datatype: the type of data value to extract the specified offset in the
55 # for comparison purposes. This can be byte, short, long, ascii or
56 # string (a not necessarily null-terminated string of bytes).
57 # A byte is 8 bits, short 16 bits, and long 32 bits.
58 # match: the value and operation to use in matching; the value used is
59 # based on the datatype field. This value may be "x" to mean
60 # "match anything". The operation is "=" if nothing is specified;
61 # otherwise it can be one of ">", "<", "<=", ">=", "!=", "&"
62 # (for and-ing and comparing to zero), "^" (for xor-ing and
63 # comparing to zero), and "!" (for taking one's complement and
64 # comparing to zero).
65 # For string and ascii data, no comparison operator is allowed,
66 # and embedded spaces, but not embedded tabs, are allowed.
67 # These data are taken literally; no C-style character escapes
68 # are meaningful.
69 # result: one of "PS", "TIFF", "PDF", "PCL", or "error" (case insensitive).
70 # The first two results specifiy whether the rule generates a PostScript
71 # file or a bilevel TIFF image. The "error" result indicates a
72 # file is unsuitable for transmission and if supplied as an
73 # argument to sendfax, the command should be aborted.
74 # rule: a string passed to the shell to convert the input file
75 # to the result format (suitable for sending as facsimile).
76 # The rule string is a printf-like string that should use the
77 # following "%" escapes:
78 # %i input file name
79 # %o output file name
80 # %r output horizontal resolution in pixels/mm
81 # %R output horizontal resolution in pixels/inch
82 # %v output vertical resolution in lines/mm
83 # %V output vertical resolution in lines/inch
84 # %f data format, 1 for 1-d encoding or 2 for 2-d encoding
85 # %w page width in pixels
86 # %W page width in mm
87 # %l page length in pixels
88 # %L page length in mm
89 # %s page size by name
90 # %F the pathname of the fax library (e.g./usr/local/lib/fax)
91 # %<x> the <x> character (e.g. ``%%'' results in ``%''
92 #
93 # These are the "null rules"--i.e. for matching formats handled
94 # directly by the server.
95 #
96 #offset datatype match result rule
97 0 string %! ps
98 0 short 0x4d4d tiff
99 0 short 0x4949 tiff
100 #
•101 0 short 000732 error Cannot convert from SGI on Linux
102 0 short 017436 error packed data support not configured
103 0 short 017635 error compressed data support not configured
104 0 short 0x0506 ps showcase -p -f %i
105 0 short 0x5343 ps showcase -p -f %i
106 0 short 0xf702 ps dvips -q -o %o %i
107 0 string GIF tiff
108 >3 string 87a tiff gif2tiff -%f -v %V %i %o
•109 >3 string 89a ps gif2ps <%i >%o
110 0 byte 0x89 ps
111 >1 string PNG ps pngtopnm < %i| ppmtopgm | \
112 pnmscale -xysize %w %l | \
113 pnmtops -dpi %R -equalpixels >%o
114 0 long 0x59a66a95 tiff ras2tiff -%f -v %V %i %o
115 0 short 0x1b45 pcl
116 0 short 0x1b25 pcl
117 0 short 0x1b26 pcl
118 0 short 0x1b2a pcl
119 #
120 # To do client-side PCL conversion to PostScript comment-out the above
121 # and uncomment this:
122 #0 short 0x1b25 ps pcl6 -dNOPAUSE -sDEVICE=pswrite -sOutputFile=%o %i
123 #
124 # HylaFAX now has server-side PDF conversion, so no need for pdf2ps.
125 # If you have trouble or if you prefer to use pdf2ps, comment this
126 # next line and uncomment the second.
127 0 string %PDF pdf
128 #0 string %PDF ps pdf2ps %i %o
129 #
130 # pdftk has the ability to auto-rotate pages to all make them portrait...
131 #
132 #0 string %PDF pdf pdftk %i cat 1-endN output %o
133 #
134 # NB: psdit is the Adobe Transcript program for converting ditroff output
135 0 string x T psc ps psdit <%i >%o
136 #
137 # These are from the PBMPLUS package's auxiliary magic numbers file
138 # Most of these entries use the "string" format so that they will work on
139 # both big-endian and little-endian machines.
140 #
141 0 string begin error uuencoded file support not configured
142 0 string xbtoa error btoa'd file support not configured
•143 0 string P1 ps ppmtopgm < %i | \
144 pnmscale -xysize %w %l | \
145 pnmtops -dpi %R -equalpixels > %o
146 0 string P2 ps ppmtopgm < %i | \
147 pnmscale -xysize %w %l | \
148 pnmtops -dpi %R -equalpixels > %o
149 0 string P3 ps ppmtopgm < %i | \
150 pnmscale -xysize %w %l | \
151 pnmtops -dpi %R -equalpixels > %o
152 0 string P4 ps ppmtopgm < %i | \
153 pnmscale -xysize %w %l | \
154 pnmtops -dpi %R -equalpixels > %o
155 0 string P5 ps ppmtopgm < %i | \
156 pnmscale -xysize %w %l | \
157 pnmtops -dpi %R -equalpixels > %o
158 0 string P5 ps ppmtopgm < %i | \
159 pnmscale -xysize %w %l | \
160 pnmtops -dpi %R -equalpixels > %o
161 0 string P6 ps ppmtopgm < %i | \
162 pnmscale -xysize %w %l | \
163 pnmtops -dpi %R -equalpixels > %o
164 #
165 0 string WNGZWZSS error Wingz spreadsheet support not configured
166 0 string #Inventor V error IRIS Inventor file support not configured
167 >15 string binary error binary IRIS Inventor file support not configured
•168 >15 string ascii ps textfmt -B -f Courier-Bold\
169 -Ml=0.4in -p 11 -s %s >%o <%i
170 #
171 0 short 0xffd8 error filetype conversion support not configured
•172 >6 string JFIF ps jpegtopnm < %i| ppmtopgm | \
173 pnmscale -xysize %w %l | \
174 pnmtops -dpi %R -equalpixels > %o
175 0 short 0xd8ff error filetype conversion support not configured
•176 0 string #FIG ps fig2dev -L ps -p x -M -N -z %s < %i > %o
177
178 #
179 # Japanization (should help other iso-2022 variants too)
180 #
181 #>15 string asciiesc ps a2ps-j -l '' -p -ns -nt <%i >%o
182 #0 asciiesc x ps a2ps-j -l '' -p -ns -nt <%i >%o
183 #
184
185 #
186 # This causes anything else with ascii-only data to be treated as text.
187 #
•188 #0 ascii x ps textfmt -B -f Courier-Bold\
189 # -Ml=0.4in -p 11 -s %s >%o <%i
190
191 #
192 # Use enscript, instead of HylaFAX textfmt, for converting text into ps.
193 # 1) Comment out the 2 lines above referring to textfmt
194 # 2) Un-comment the following 3 lines
195 # Notes: - The '--margins' and '-s' params are set to produce output similar
196 # to the textfmt invocation above.
197 # - Page size is fixed, since enscript doesn't handle the values
198 # assigned to the %s macro. Use:
199 # '-M Letter' (not 'letter', not 'LETTER') for US letter
200 # '-M A4' (not 'a4') for ISO A4
•201 0 ascii x ps enscript -B -f Courier-Bold@11 \
202 --margins=24::60:36 -s 2.2 \
203 -q -M A4 -p %o %i
204
205 # Support 7-bit text which would otherwise be seen as binary.
206 #
•207 #0 byte x ps textfmt -B -f Courier-Bold \
208 # -p 11 -s %s >%o <%i