Debian Codegraph @

libhylafax/typerules

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
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 tiff %F/sgi2fax -%f -o %o -v %V\
102 -s %s %i
103 0 short 017436 error packed data support not configured
104 0 short 017635 error compressed data support not configured
105 0 short 0x0506 ps showcase -p -f %i
106 0 short 0x5343 ps showcase -p -f %i
107 0 short 0xf702 ps dvips -q -o %o %i
108 0 string GIF tiff
109 >3 string 87a tiff gif2tiff -%f -v %V %i %o
110 >3 string 89a error GIF (version 89a) support not configured
111 0 long 0x59a66a95 tiff ras2tiff -%f -v %V %i %o
112 0 short 0x1b45 pcl
113 0 short 0x1b25 pcl
114 0 short 0x1b26 pcl
115 0 short 0x1b2a pcl
116 #
117 # To do client-side PCL conversion to PostScript comment-out the above
118 # and uncomment this:
119 #0 short 0x1b25 ps pcl6 -dNOPAUSE -sDEVICE=pswrite -sOutputFile=%o %i
120 #
121 # HylaFAX now has server-side PDF conversion, so no need for pdf2ps.
122 # If you have trouble or if you prefer to use pdf2ps, comment this
123 # next line and uncomment the second.
124 0 string %PDF pdf
125 #0 string %PDF ps pdf2ps %i %o
126 #
127 # pdftk has the ability to auto-rotate pages to all make them portrait...
128 #
129 #0 string %PDF pdf pdftk %i cat 1-endN output %o
130 #
131 # NB: psdit is the Adobe Transcript program for converting ditroff output
132 0 string x T psc ps psdit <%i >%o
133 #
134 # These are from the PBMPLUS package's auxiliary magic numbers file
135 # Most of these entries use the "string" format so that they will work on
136 # both big-endian and little-endian machines.
137 #
138 0 string begin error uuencoded file support not configured
139 0 string xbtoa error btoa'd file support not configured
140 0 string P1 error PBM file support not configured
141 0 string P2 error PGM file support not configured
142 0 string P3 error PPM file support not configured
143 0 string P4 error PBM "rawbits" file support not configured
144 0 string P5 error PGM "rawbits" file support not configured
145 0 string P6 error PPM "rawbits" file support not configured
146 #
147 0 string WNGZWZSS error Wingz spreadsheet support not configured
148 0 string #Inventor V error IRIS Inventor file support not configured
149 >15 string binary error binary IRIS Inventor file support not configured
150 >15 string ascii ps %F/textfmt -B -f Courier-Bold\
151 -Ml=0.4in -p 11 -s %s >%o <%i
152 #
153 0 string \x89PNG error PNG support not configured
154 0 short 0xffd8 error filetype conversion support not configured
155 >6 string JFIF error JPEG support not configured
156 0 short 0xd8ff error filetype conversion support not configured
157 >6 string JFIF error JPEG support not configured
158 0 string #FIG error FIG support not configured
159
160 #
161 # Japanization (should help other iso-2022 variants too)
162 #
163 #>15 string asciiesc ps a2ps-j -l '' -p -ns -nt <%i >%o
164 #0 asciiesc x ps a2ps-j -l '' -p -ns -nt <%i >%o
165 #
166
167 #
168 # This causes anything else with ascii-only data to be treated as text.
169 #
170 0 ascii x ps %F/textfmt -B -f Courier-Bold\
171 -Ml=0.4in -p 11 -s %s >%o <%i
172
173 #
174 # Use enscript, instead of HylaFAX textfmt, for converting text into ps.
175 # 1) Comment out the 2 lines above referring to textfmt
176 # 2) Un-comment the following 3 lines
177 # Notes: - The '--margins' and '-s' params are set to produce output similar
178 # to the textfmt invocation above.
179 # - Page size is fixed, since enscript doesn't handle the values
180 # assigned to the %s macro. Use:
181 # '-M Letter' (not 'letter', not 'LETTER') for US letter
182 # '-M A4' (not 'a4') for ISO A4
183 #0 ascii x ps enscript -B -f Courier-Bold@11 \
184 # --margins=24::60:36 -s 2.2 \
185 # -q -M A4 -p %o %i
186
187 # Support 7-bit text which would otherwise be seen as binary.
188 #
189 #0 byte x ps %F/textfmt -B -f Courier-Bold \
190 # -p 11 -s %s >%o <%i